YATISH
Yet Another TIme SHeet
/home/nicolas/sources/yatish/yatishDBsqlite.h
Go to the documentation of this file.
1 /***************************************************************
2  * Name: yatishDBsqlite.h
3  * Purpose: Defines a sqlite controller
4  * Author: Nicolas PĂ©renne (nicolas.perenne@eif-services.eu)
5  * Created: 2020-03-09
6  * Copyright: EIF-services (https://www.eif-services.eu)
7  * License: GPLv3
8  **************************************************************/
9 
10 #ifndef YATISHDBSQLITE_H
11 #define YATISHDBSQLITE_H
12 
13 #include <wx/listctrl.h>
14 #include "yatishDB.h"
15 
39 class yatishDBsqlite : public yatishDB {
40  public:
41  yatishDBsqlite ();
42  ~yatishDBsqlite ();
43  bool FillChoice (wxChoice *, tableID);
44  int ChoiceSelector (tableID, long);
45  bool StartTimeslot (int, int, int);
46  bool StopTimeslot ();
47  int RunningTimeslots ();
48  bool FillList (wxListCtrl *, tableID);
49  void AddToFilter (tableID, int);
50  void SetLimit (bool b, int i) { limitRow = b; rowLimit = i; }
51  wxString FilteredTotal ();
52  void ClearFilter () { filter.Clear(); }
53  void SetFirstDay (const wxDateTime&);
54  void SetLastDay (const wxDateTime&);
55  wxDateTime First ();
56  wxDateTime Last ();
57  long LastActivity ();
58  long Activity (long);
59  bool Delete(tableID, long);
60  wxString ReadName (tableID, long);
61  bool ReadDates (long, wxDateTime&, wxDateTime&);
62  bool RecordName (tableID, long, const wxString&);
63  bool RecordProject (long, const wxString&, int);
64  bool RecordActivity (long, int, int, int);
65  bool RecordTimeslot (long, const wxDateTime&, const wxDateTime&, int, int, int);
66  private:
67  bool limitRow;
68  int rowLimit;
71  wxString firstDay, lastDay, filter;
72  wxTimeSpan totalSpan;
73 };
74 
75 #endif // YATISHDBSQLITE_H
bool StopTimeslot()
Stops current timeslot.
long Activity(long)
Reads the activity_id in a record of yatish_timeslot.
wxDateTime First()
Obtains the minimum time in column start from currently selected rows of table yatish_timeslot.
int RunningTimeslots()
Determines the number n of unfinished timeslots.
wxString firstDay
wxString lastDay
void SetLastDay(const wxDateTime &)
Sets private member lastDay (for future SQL queries).
wxArrayLong clientIDs
long LastActivity()
Reads the last activity_id in yatish_timeslot.
bool ReadDates(long, wxDateTime &, wxDateTime &)
Reads the start and stop fields of a yatish_timeslot record.
bool RecordActivity(long, int, int, int)
Modifies or creates a record in the yatish_activity table.
void AddToFilter(tableID, int)
Add a condition to the WHERE clause of FillList().
yatishDBsqlite()
Mainly connects to the yatish.sqlite database.
void SetLimit(bool b, int i)
wxString FilteredTotal()
Writes the total and average durations of currently viewed timeslots.
bool StartTimeslot(int, int, int)
Starts a new row in the timeslot table.
wxArrayLong toolIDs
void SetFirstDay(const wxDateTime &)
Sets private member firstDay (for future SQL queries).
bool Delete(tableID, long)
Marks a local record for deletion.
bool RecordTimeslot(long, const wxDateTime &, const wxDateTime &, int, int, int)
Modifies or creates a record in the yatish_timeslot table.
tableID
Definition: yatishDB.h:20
Interacts with yatish tables in a SQLite database.
int ChoiceSelector(tableID, long)
Finds the proper index for selection in a wxChoice.
bool RecordProject(long, const wxString &, int)
Modifies or creates a record in the yatish_project table.
bool FillList(wxListCtrl *, tableID)
Fills a wxListCtrl.
bool RecordName(tableID, long, const wxString &)
Modifies or creates a record with only one field (called name).
wxArrayLong taskIDs
wxArrayLong projectIDs
wxDateTime Last()
Obtains the maximum time in column start from currently selected rows of table yatish_timeslot.
wxTimeSpan totalSpan
bool FillChoice(wxChoice *, tableID)
Fills a wxChoice.
wxString ReadName(tableID, long)
Reads a wxString from the name column.
Provides a few basic methods and (static) members to interact with yatish tables. ...
Definition: yatishDB.h:49