YATiSh
Yet Another TIme SHeet
yatishDBsqlite.h
Go to the documentation of this file.
1 /********************************************************************
2  * Name: yatishDBsqlite.h
3  * Purpose: Declares 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/yatish)
7  * License: GPLv3
8  ********************************************************************/
9 
10 #ifndef YATISHDBSQLITE_H
11 #define YATISHDBSQLITE_H
12 
13 #include "wx_pch.h"
14 #include "yatishDB.h"
15 #include "yatishTypes.h"
16 
40 class yatishDBsqlite : public yatishDB {
41  public:
42  yatishDBsqlite ();
43  ~yatishDBsqlite ();
44  bool FillChoice (wxChoice *, tableID);
45  int ChoiceSelector (tableID, long);
46  bool StartTimeslot (int, int, int);
47  bool StopTimeslot ();
48  int RunningTimeslots ();
49  void SetLimit (bool b, int i) { limitRow = b; rowLimit = i; }
50  bool FillList (wxListCtrl *, tableID);
51  bool FillPlotData (RawData&);
52  void AddToFilter (tableID, int);
53  void AddToFilter (long);
54  wxString GetFilter () const { return filter; };
55  void ClearFilter () { filter.Clear(); }
56  long FilteredTotal (wxTimeSpan &) const;
57  wxString FilteredTotalFormatted ();
58  void SetFirstDay (const wxDateTime&);
59  void SetLastDay (const wxDateTime&);
60  wxDateTime GetFirstDay () const { return wxFirstDay; }
61  wxDateTime GetLastDay () const { return wxLastDay; }
62  wxDateTime First ();
63  wxDateTime Last ();
64  long LastActivity ();
65  long Activity (long);
66  bool Delete (tableID, long);
67  wxString ReadName (tableID, long);
68  bool ReadDates (long, wxDateTime&, wxDateTime&);
69  bool RecordName (tableID, long, const wxString&);
70  bool RecordProject (long, const wxString&, int);
71  bool RecordActivity (long, int, int, int);
72  bool RecordTimeslot (long, const wxDateTime&, const wxDateTime&, int, int, int);
73  private:
74  bool limitRow;
75  int rowLimit;
78  wxString firstDay, lastDay, filter;
79  wxDateTime wxFirstDay, wxLastDay;
80  wxTimeSpan totalSpan;
81 };
82 
83 #endif // YATISHDBSQLITE_H
Provides a few basic methods and (static) members to interact with yatish tables.
Definition: yatishDB.h:42
Interacts with yatish tables in a SQLite database.
bool ReadDates(long, wxDateTime &, wxDateTime &)
Reads the start and stop fields of a yatish_timeslot record.
wxDateTime wxFirstDay
bool FillChoice(wxChoice *, tableID)
Fills a wxChoice.
void SetLimit(bool b, int i)
wxArrayLong toolIDs
bool RecordActivity(long, int, int, int)
Modifies or creates a record in the yatish_activity table.
void SetFirstDay(const wxDateTime &)
Sets private member firstDay (for future SQL queries).
wxDateTime wxLastDay
wxString GetFilter() const
bool RecordTimeslot(long, const wxDateTime &, const wxDateTime &, int, int, int)
Modifies or creates a record in the yatish_timeslot table.
bool FillList(wxListCtrl *, tableID)
Fills a wxListCtrl.
long FilteredTotal(wxTimeSpan &) const
Returns the total duration of currently viewed timeslots (and their count).
bool FillPlotData(RawData &)
Fills a RawData (typedefined in yatishTypes.h).
wxArrayLong clientIDs
wxString firstDay
bool RecordName(tableID, long, const wxString &)
Modifies or creates a record with only one field (called name).
wxString FilteredTotalFormatted()
Writes the total and average durations of currently viewed timeslots.
yatishDBsqlite()
Mainly connects to the yatish.sqlite database.
wxString ReadName(tableID, long)
Reads a wxString from the name column.
wxDateTime Last()
Obtains the maximum time in column start from currently selected rows of table yatish_timeslot.
wxTimeSpan totalSpan
int RunningTimeslots()
Determines the number n of unfinished timeslots.
wxDateTime First()
Obtains the minimum time in column start from currently selected rows of table yatish_timeslot.
wxArrayLong projectIDs
wxArrayLong taskIDs
void SetLastDay(const wxDateTime &)
Sets private member lastDay (for future SQL queries).
bool Delete(tableID, long)
Marks a local record for deletion.
wxDateTime GetFirstDay() const
void AddToFilter(tableID, int)
Adds a condition to the WHERE clause of FillList().
bool RecordProject(long, const wxString &, int)
Modifies or creates a record in the yatish_project table.
bool StartTimeslot(int, int, int)
Starts a new row in the timeslot table.
int ChoiceSelector(tableID, long)
Finds the proper index for selection in a wxChoice.
long Activity(long)
Reads the activity_id in a record of yatish_timeslot.
wxString lastDay
bool StopTimeslot()
Stops current timeslot.
wxDateTime GetLastDay() const
long LastActivity()
Reads the last activity_id in yatish_timeslot.
tableID
Definition: yatishDB.h:13
vector< RawRecord > RawData
Definition: yatishTypes.h:25