KissCount/model/Database.h

48 lines
1.1 KiB
C
Raw Normal View History

#ifndef DATABASE_H
#define DATABASE_H
2010-05-15 11:21:42 +02:00
#include <stdio.h>
#include <fstream>
#include <list>
#include <wx/wxsqlite3.h>
#include <wx/wx.h>
#include <sha1.h>
2010-05-15 11:21:42 +02:00
#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);
2010-05-15 11:21:42 +02:00
User* LoadUser(wxString name);
2010-05-16 10:35:34 +02:00
void LoadYear(User* user, int year);
2010-06-03 18:28:38 +02:00
void UpdateOperation(struct operation op);
2010-06-21 13:02:02 +02:00
wxString AddOperation(User* user, struct operation op);
2010-06-03 18:28:38 +02:00
void DeleteOperation(struct operation op);
2010-06-21 10:53:43 +02:00
double GetAccountAmount(wxString id, int month, int year);
2010-06-12 15:59:27 +02:00
void SetAccountAmount(int month, int year, wxString accountId, double amount);
2010-06-03 18:28:38 +02:00
2010-06-21 13:02:02 +02:00
wxString AddAccount(User* user, struct Account ac);
2010-06-21 10:53:43 +02:00
void UpdateAccount(struct Account ac);
void DeleteAccount(struct Account ac);
2010-06-22 12:29:36 +02:00
wxString AddCategory(User* user, struct category category);
2010-06-22 11:35:21 +02:00
void UpdateCategory(User* user, wxString oldName, wxString name, wxString color);
2010-06-22 12:29:36 +02:00
void DeleteCategory(User* user, struct category category);
2010-06-22 11:35:21 +02:00
private:
wxSQLite3Database _db;
void CreateDatabase();
};
#endif