2
2
* Name: datawithalarms.cpp
3
3
* Purpose: Alarm extension for TData
4
4
* Author: Igor Calì (igor.cali0@gmail.com)
6
6
* Copyright: Igor Calì (igor.cali0@gmail.com)
8
8
**************************************************************/
13
13
#include "ui/Alarm.h"
14
14
#include "../constants.h"
16
#ifdef _OMB_USE_CIPHER
17
extern int ExecuteUpdate(sqlite3 *m_db, const char* sql/*, bool saveRC = false*/);
18
#endif // _OMB_USE_CIPHER
16
20
TDataWithAlarms::TDataWithAlarms(void):TData_v32(NULL){
17
21
SoundFile = GetDataDir() + L"alarm_clock.wav";}
52
56
ShopItems[i].Alarm = AlarmF->DatePicker->GetValue();
53
database->ExecuteUpdate(L"update Shoplist set alarm = " +
57
#ifdef _OMB_USE_CIPHER
58
wxString update = L"update Shoplist set alarm = " +
59
wxString::Format(L"%d", (int) ShopItems[i].Alarm.GetTicks()) +
61
wxString::Format(L"%d", ShopItems[i].Id) +
64
ExecuteUpdate(database, update.c_str());
66
ExecuteUpdate(database, update);
69
database->ExecuteUpdate(L"update Shoplist set alarm = " +
54
70
wxString::Format(L"%d", (int) ShopItems[i].Alarm.GetTicks()) +
56
72
wxString::Format(L"%d", ShopItems[i].Id) +
74
#endif // _OMB_USE_CIPHER
77
#ifdef _OMB_USE_CIPHER
79
#endif // _OMB_USE_CIPHER
60
80
switch(AlarmF->ShowModal()){
62
82
ShopItems[i].Alarm=AlarmF->DatePicker->GetValue();
63
database->ExecuteUpdate(L"update Shoplist set alarm = " +
83
#ifdef _OMB_USE_CIPHER
84
Sql = L"update Shoplist set alarm = " +
85
wxString::Format(L"%d", (int) ShopItems[i].Alarm.GetTicks()) +
87
wxString::Format(L"%d", ShopItems[i].Id) +
90
ExecuteUpdate(database, Sql.c_str());
92
ExecuteUpdate(database, Sql);
95
database->ExecuteUpdate(L"update Shoplist set alarm = " +
64
96
wxString::Format(L"%d", (int) ShopItems[i].Alarm.GetTicks()) +
66
98
wxString::Format(L"%d", ShopItems[i].Id) +
100
#endif // _OMB_USE_CIPHER
68
101
if(AlarmF->cb_PostponeAll->IsChecked())PostAll=true;
91
124
Lent[i].Alarm=AlarmF->DatePicker->GetValue();
92
database->ExecuteUpdate(L"update Loans set alarm = " +
125
#ifdef _OMB_USE_CIPHER
126
wxString update = L"update Loans set alarm = " +
127
wxString::Format(L"%d", (int) Lent[i].Alarm.GetTicks()) +
129
wxString::Format(L"%d", Lent[i].Id) +
132
ExecuteUpdate(database, update.c_str());
134
ExecuteUpdate(database, update);
137
database->ExecuteUpdate(L"update Loans set alarm = " +
93
138
wxString::Format(L"%d", (int) Lent[i].Alarm.GetTicks()) +
95
140
wxString::Format(L"%d", Lent[i].Id) +
142
#endif // _OMB_USE_CIPHER
145
#ifdef _OMB_USE_CIPHER
147
#endif // _OMB_USE_CIPHER
99
148
switch(AlarmF->ShowModal()){
101
Lent[i].Alarm=AlarmF->DatePicker->GetValue();
150
Lent[i].Alarm=AlarmF->DatePicker->GetValue();
151
#ifdef _OMB_USE_CIPHER
152
Sql = L"update Loans set alarm = " +
153
wxString::Format(L"%d", (int) Lent[i].Alarm.GetTicks()) +
155
wxString::Format(L"%d", Lent[i].Id) +
158
ExecuteUpdate(database, Sql.c_str());
160
ExecuteUpdate(database, Sql);
102
163
database->ExecuteUpdate(L"update Loans set alarm = " +
103
164
wxString::Format(L"%d", (int) Lent[i].Alarm.GetTicks()) +
104
165
L" where id = " +
105
166
wxString::Format(L"%d", Lent[i].Id) +
107
if(AlarmF->cb_PostponeAll->IsChecked())PostAll=true;
168
#endif // _OMB_USE_CIPHER
169
if(AlarmF->cb_PostponeAll->IsChecked())PostAll=true;
109
171
case wxID_CANCEL:
110
Lent[i].Alarm.Add(wxDateSpan(100,0,0,0));}
172
Lent[i].Alarm.Add(wxDateSpan(100,0,0,0));}
111
173
FileData.Modified=true;}}
130
192
Borrowed[i].Alarm=AlarmF->DatePicker->GetValue();
131
database->ExecuteUpdate(L"update Borrows set alarm = " +
193
#ifdef _OMB_USE_CIPHER
194
wxString update = L"update Borrows set alarm = " +
195
wxString::Format(L"%d", (int) Borrowed[i].Alarm.GetTicks()) +
197
wxString::Format(L"%d", Borrowed[i].Id) +
200
ExecuteUpdate(database, update.c_str());
202
ExecuteUpdate(database, update);
205
database->ExecuteUpdate(L"update Borrows set alarm = " +
132
206
wxString::Format(L"%d", (int) Borrowed[i].Alarm.GetTicks()) +
133
207
L" where id = " +
134
208
wxString::Format(L"%d", Borrowed[i].Id) +
210
#endif // _OMB_USE_CIPHER
138
213
switch(AlarmF->ShowModal()){