-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclsScreen.cpp
184 lines (151 loc) · 5.14 KB
/
clsScreen.cpp
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#include "clsScreen.h"
void clsScreen::PrintSystemDate(clsDate Date)
{
Date.Print();
}
void clsScreen::ReadClientInfo(clsClient& Client)
{
Client.firstname = clsInputValidate::ReadString("Enter First Name : ");
Client.lastname = clsInputValidate::ReadString("Enter Last Name : ");
Client.email = clsInputValidate::ReadString("Enter Email : ");
Client.phone = clsInputValidate::ReadString("Enter Phone : ");
Client.pin_code = clsInputValidate::ReadString("Enter Pin Code : ");
cout << "Enter Balance : ";
Client.balance = clsInputValidate::ReadFloatNumber();
}
void clsScreen::ReadUserInfo(clsUser& User) {
User.firstname = clsInputValidate::ReadString("\nEnter First Name : ");
User.lastname = clsInputValidate::ReadString("\nEnter Last Name : ");
User.email = clsInputValidate::ReadString("\nEnter Email : ");
User.phone = clsInputValidate::ReadString("\nEnter Phone Number : ");
string Password= clsInputValidate::ReadString("\nEnter Password : ");
User.Password = clsString::Encrypt(Password);
cout << "\nEnter Permission: ";
User.Permissions= _ReadPermissionsToSet();
}
int clsScreen::_ReadPermissionsToSet() {
int Permissions = 0;
string Answer = "n";
cout << "\nDo you want to give full access? y/n? ";
cin >> Answer;
if (tolower(Answer[0]) == 'y')
{
return -1;
}
cout << "\nDo you want to give access to : \n ";
cout << "\nShow Client List? y/n? ";
cin >> Answer;
if (tolower(Answer[0]) == 'y')
{
Permissions += clsUser::enPermissions::pListClients;
}
cout << "\nAdd New Client? y/n? ";
cin >>ws>> Answer;
if (tolower(Answer[0]) == 'y')
{
Permissions += clsUser::enPermissions::pAddNewClient;
}
cout << "\nDelete Client? y/n? ";
cin >> Answer;
if (tolower(Answer[0]) == 'y')
{
Permissions += clsUser::enPermissions::pDeleteClient;
}
cout << "\nUpdate Client? y/n? ";
cin >> Answer;
if (tolower(Answer[0]) == 'y')
{
Permissions += clsUser::enPermissions::pUpdateClients;
}
cout << "\nFind Client? y/n? ";
cin >> Answer;
if (tolower(Answer[0]) == 'y')
{
Permissions += clsUser::enPermissions::pFindClient;
}
cout << "\nTransactions? y/n? ";
cin >> Answer;
if (tolower(Answer[0]) == 'y')
{
Permissions += clsUser::enPermissions::pTranactions;
}
cout << "\Login Logs? y/n? ";
cin >> Answer;
if (tolower(Answer[0]) == 'y')
{
Permissions += clsUser::enPermissions::pLoginLogs;
}
cout << "\nManage Users? y/n? ";
cin >> Answer;
if (tolower(Answer[0]) == 'y')
{
Permissions += clsUser::enPermissions::pManageUsers;
}
return Permissions;
}
void clsScreen::PrintClient(clsClient& client)
{
cout << "\nClient Card:";
cout << "\n___________________";
cout << "\nFull Name : " << client.fullname;
cout << "\nEmail : " << client.email;
cout << "\nPhone : " << client.phone;
cout << "\nAcc. Number : " << client.account_number;
cout << "\nPinCode : " << client.pin_code;
cout << "\nBalance : " << client.balance;
cout << "\n___________________\n";
}
void clsScreen::PrintShortlistedClient(clsClient& client)
{
cout << "\nClient Card:";
cout << "\n___________________";
cout << "\nFull Name : " << client.fullname;
cout << "\nAcc. Number : " << client.account_number;
cout << "\nBalance : " << client.balance;
cout << "\n___________________\n";
}
void clsScreen::PrintUserCard(clsUser& User) {
cout << "\nUser Card:";
cout << "\n___________________";
cout << "\nFull Name : " << User.fullname;
cout << "\nPhone : " << User.phone;
cout << "\nEmail : " << User.email;
cout << "\nUsername : " << User.UserName;
cout << "\nPassword : " << User.Password;
cout << "\nPermissions : " << User.Permissions;
cout << "\n___________________\n";
}
void clsScreen::PrintUserRecord(clsUser& User) {
cout << "| " << left << setw(22) << User.fullname;
cout << "| " << left << setw(20) << User.phone;
cout << "| " << left << setw(17) << User.email;
cout << "| " << left << setw(12) << User.UserName;
cout << "| " << left << setw(12) << User.Password;
cout << "| " << left << setw(12) << User.Permissions;
}
void clsScreen::_PrintCurrencyCard(clsCurrency Currency)
{
cout << "\nCurrency Card:\n";
cout << "_____________________________\n";
cout << "\nCountry : " << Currency.country;
cout << "\nCode : " << Currency.currencyCode;
cout << "\nName : " << Currency.currencyName;
cout << "\nRate(1$) = : " << Currency.rate;
cout << "\n_____________________________\n";
}
void clsScreen::_DrawScreenHeader(string Title, string SubTitle)
{
clsDate Date;
cout << "=================================================";
if (!UserSession::getCurrentUser().IsEmpty())
{
cout << endl<<" Welcome " << UserSession::getCurrentUser().UserName << endl;
}
cout << "\n " << Title<<" | ";
clsDate::PrintTodayAndTime();
if (SubTitle != "")
{
cout << "\n\t" << SubTitle;
}
cout << "\n=================================================\n";
}