-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
164 lines (120 loc) · 4.27 KB
/
main.cpp
File metadata and controls
164 lines (120 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#include "Wujjit.h"
#include <hiredis/hiredis.h>
#include <iostream>
#include "DataAccessLayer.h"
#include "Declarations.h"
using namespace Enums::Income_Values;
Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
return new Wujjit(env);
}
int main(int argc, char **argv)
{
std::cout<<"BEGIN"<<std::endl;
/*
Wt::ApplicationCreator app(&createApplication);
return Wt::WRun(argc, argv, app);
redisReply *reply;
redisContext *c = redisConnect("localhost",6379);
reply = redisCommand(c,"get foo");
cout << reply->str << endl;
freeReplyObject(reply);
printf("\n\n");
//DAL::addUser("HelloWorld@HW.net","Hello World");
reply = redisCommand(c,"keys *");
for(int i=0; i < reply->elements; i++){
cout << reply->element[i]->str << endl;
}
freeReplyObject(reply);
printf("\n\n");
reply = redisCommand(c,"SMEMBERS users");
for(int i=0; i < reply->elements; i++){
cout << reply->element[i]->str << endl;
}
freeReplyObject(reply);
redisFree(c);
DAL::initialize();
std::map<DebtValues, std::string> debtArgs;
debtArgs[debt_source] = "small debt";
debtArgs[balance] = "100";
debtArgs[apr] = "0.1";
debtArgs[minimum_payment] = "10";
debtArgs[extra_payment] = "0";
debtArgs[due_date] = "1";
debtArgs[payment_scheduled] = "no";
debtArgs[payment_processed] = "no";
std::map<IncomeValues, std::string> incomeArgs;
incomeArgs[income_source] = "criminal wrong doings";
incomeArgs[amount] = "200";
std::map<AccountValues, std::string> accountArgs;
accountArgs[name]="Charlie";
accountArgs[phone] = "555 555 5555";
accountArgs[monthlyEmail] = "yes";
accountArgs[emailOnUpdate] = "yes";
accountArgs[email]="test2@test.test";
// std::string id = DAL::createAccount(accountArgs);
// std::string debtID = DAL::addDebt(id, debtArgs);
// std::string incomeID = DAL::addIncome(id, incomeArgs);
accountArgs[name]="Hillary";
accountArgs[phone] = "555 555 5555";
accountArgs[monthlyEmail] = "yes";
accountArgs[emailOnUpdate] = "yes";
accountArgs[email]="test33@test.test";
incomeArgs[income_source] = "engineering";
incomeArgs[savings] = "50";
incomeArgs[amount] = "500";
debtArgs[debt_source] = "scary debt";
debtArgs[balance] = "10000";
debtArgs[apr] = "0.8";
debtArgs[minimum_payment] = "100";
debtArgs[extra_payment] = "40";
debtArgs[due_date] = "15";
debtArgs[payment_scheduled] = "no";
debtArgs[payment_processed] = "no";
// DAL::createAccount(accountArgs);
// DAL::addDebt(id, debtArgs);
// DAL::addIncome(id, incomeArgs);
// DAL::deleteAccount(id);
// DAL::deleteIncome(id, incomeID);
// DAL::deleteDebt(id, debtID);
//std::map<AccountValues, std::string> newAccountArgs;
//newAccountArgs[email]="test4@test.test";
// newAccountArgs[phone] = "444 444 4444";
//DAL::updateAccount("2",newAccountArgs);
// std::map<DebtValues, std::string> newDebtArgs;
// newDebtArgs[due_date]="5";
// DAL::updateDebt(id,debtID,newDebtArgs);
// std::map<IncomeValues, std::string> newIncomeArgs;
// newIncomeArgs[income_source]="That's rather complicated";
// newIncomeArgs[amount]="7500";
// newIncomeArgs[savings]="5";
// DAL::updateIncome(id,debtID,newIncomeArgs);
// DAL::updateIncome(id,incomeID,income_source,"stealing things");
// DAL::updateDebt(id,debtID,debt_source,"bad debt");
std::string id = "1";
std::map<AccountValues, std::string> accountInfo = DAL::getAccountInfo(id);
for ( std::map<AccountValues, std::string>::iterator it = accountInfo.begin(); it != accountInfo.end(); it++){
std::cout<<accountInfo[it->first]<<std::endl;
}
std::cout<<"\n";
std::vector<std::map<DebtValues, std::string> > debtData = DAL::getDebtInfo(id);
for(unsigned int i=0; i< debtData.size(); i++){
for ( std::map<DebtValues, std::string>::iterator it = debtData.at(i).begin(); it != debtData.at(i).end(); it++){
std::cout<<debtData.at(i)[it->first]<<std::endl;
}
std::cout<<"\n";
}
*/
std::cout<<"Made it past the comments!"<<std::endl;
std::string id = "1";
std::vector<std::map<IncomeValues, std::string> > incomeData = DAL::getIncomeInfo(id);
std::cout<<"built the vector of maps!"<<std::endl;
int DEBUG = 0;
for(unsigned int i=0; i< incomeData.size(); i++){
for ( std::map<IncomeValues, std::string>::iterator it = incomeData.at(i).begin(); it != incomeData.at(i).end(); it++){
std::cout<<incomeData.at(i)[it->first]<<std::endl;
}
std::cout<<"\n";
}
return 0;
}