-
Notifications
You must be signed in to change notification settings - Fork 0
/
clsLockClientScreen.h
86 lines (58 loc) · 2.17 KB
/
clsLockClientScreen.h
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
#pragma once
#include "clsScreen.h"
#include "clsInputValidate.h"
class clsLockClientScreen : protected clsScreen
{
private:
static clsBankClient _ReadClientToLock()
{
string AccountNumber = "";
clsBankClient Client = clsBankClient::Find(AccountNumber);
bool ClientNotFound = false;
bool ClientIsAlreadyBlocked = false;
cout << "\nPlease Enter Account Number To Lock ? ";
AccountNumber = clsInputValidate::ReadString();
Client = clsBankClient::Find(AccountNumber);
do
{
ClientNotFound = Client.IsEmpty();
ClientIsAlreadyBlocked = Client.GetMarkedForLocked();
if (ClientNotFound)
{
cout << "\nThis Account Number is not found , please try a valid one ? ";
AccountNumber = clsInputValidate::ReadString();
}
else if (ClientIsAlreadyBlocked)
{
cout << "\nThis Account Number is already Locked , please try an unlocked one ? ";
AccountNumber = clsInputValidate::ReadString();
}
Client = clsBankClient::Find(AccountNumber);
} while (ClientNotFound || ClientIsAlreadyBlocked);
return Client;
}
public:
static void ShowLockClientScreen()
{
_DrawScreenHeader("\t Lock Client Screen");
clsBankClient Client = clsBankClient::Find("");
Client = _ReadClientToLock();
char Answer = 'N';
cout << "\nAre you sure you want to Lock this client ? Y/N ? ";
cin >> Answer;
if (toupper(Answer) == 'Y')
{
if (Client.Lock())
{
cout << "\n\nClient Locked Successfully :-) \n";
cout << "Date of Lock is : [ " << Client.GetLockDate() << " ] \n";
string MessageBody = "Dear Sir/Madam Your account have been locked , please contact the bank to unlock it !";
Client.SendEmail(CurrentUser.UserName, "Hi", MessageBody);
}
else
{
cout << "\n\nError Client Was Not Locked :-( \n";
}
}
}
};