KissCount/model/Database.h
2010-06-23 19:32:42 +02:00

51 lines
1.3 KiB
C++

#ifndef DATABASE_H
#define DATABASE_H
#include <stdio.h>
#include <fstream>
#include <list>
#include <wx/wxsqlite3.h>
#include <wx/wx.h>
#include <sha1.h>
#include "model.h"
#define BDD_FILE "kc.bdd"
#define INIT_SCRIPT "init.sql"
class Database
{
public:
Database();
std::list<wxString> GetUsers();
bool IsValidUser(wxString user, wxString password);
User* LoadUser(wxString name);
void LoadYear(User* user, int year);
void UpdateOperation(struct operation op);
wxString AddOperation(User* user, struct operation op);
void DeleteOperation(struct operation op);
double GetAccountAmount(wxString id, int month, int year);
void SetAccountAmount(int month, int year, wxString accountId, double amount);
wxString AddAccount(User* user, struct Account ac);
void UpdateAccount(struct Account ac);
void DeleteAccount(struct Account ac);
wxString AddCategory(User* user, struct category category);
void UpdateCategory(User* user, wxString oldName, wxString name, wxString color);
void DeleteCategory(User* user, struct category category);
std::map<int, std::vector<int> > GetAllOperations(User* user);
void GenerateMonth(User* user, int monthFrom, int yearFrom, int monthTo, int yearTo);
private:
wxSQLite3Database _db;
void CreateDatabase();
};
#endif