KissCount/model/Database.h

40 lines
805 B
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);
double GetAccountAmount(wxString id, int month, int year);
void UpdateOperation(struct operation op);
void AddOperation(User* user, struct operation op);
void DeleteOperation(struct operation op);
void SetAccountAmount(int month, int year, wxString accountId, double amount);
private:
wxSQLite3Database _db;
void CreateDatabase();
};
#endif