-
Notifications
You must be signed in to change notification settings - Fork 0
/
clsAddNewClientScreen.h
96 lines (77 loc) · 2.42 KB
/
clsAddNewClientScreen.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
86
87
88
89
90
91
92
93
#pragma once
#include "clsScreen.h"
#include "clsBankClient.h"
using namespace std;
class clsAddNewClientScreen :protected clsScreen
{
private:
static void _ReadClientInfo(clsBankClient& Client)
{
cout << "Please, Enter First Name:";
Client.FirstName = clsInputValidate::ReadString();
cout << "Please, Enter Last Name:" ;
Client.LastName = clsInputValidate::ReadString();
cout << "Please, Enter Email:";
Client.Email = clsInputValidate::ReadString();
cout << "Please, Enter Phone :";
Client.Phone = clsInputValidate::ReadString();
cout << "Please, Enter PassWord :";
Client.Pincode = clsInputValidate::ReadString();
cout << "Please, Enter Balance:";
Client.AccountBalance = clsInputValidate::ReadFloatNumber();
}
static void _Print(clsBankClient Client)
{
cout << "\n Client Card:";
cout << "\n------------------";
cout << "\nFirst Name :" << Client.FirstName;
cout << "\nLast Name :" << Client.LastName;
cout << "\nFull Name :" << Client.FullName();
cout << "\nEmail :" << Client.Email;
cout << "\nPhone :" << Client.Phone;
cout << "\nAcc. Number :" << Client.AccountNumber();
cout << "\nPassword :" << Client.Pincode;
cout << "\nBalance :" << Client.AccountBalance;
cout << "\n-------------------\n";
}
public:
static void AddNewclient()
{
if (!CheckAccessRights(clsUser::enPermissions::pAddNewClient))
{
return;// this will exit the function and it will not continue
}
_DrawMainScreenHeader("\t\tAdd New Client");
string AccountNumber = "";
cout << "\nPlease , Enter Account Number : " << endl;
AccountNumber = clsInputValidate::ReadString();
while (clsBankClient::ISClientExist(AccountNumber))
{
cout << "\n Account Number is already used choose , anther one" << endl;
AccountNumber = clsInputValidate::ReadString();
}
clsBankClient NewClient = clsBankClient::GetAddNewClientObject(AccountNumber);
_ReadClientInfo(NewClient);
clsBankClient::enSaveResults SaveResult;
SaveResult = NewClient.Save();
switch (SaveResult)
{
case clsBankClient::enSaveResults::SvSucceed:
{
cout << "\nAccount Addeded Successfully :-)\n";
_Print(NewClient);
break;
}
case clsBankClient::enSaveResults::SvFaildEmptyObject:
{
cout << "\nError account was not saved because it's Empty";
break;
}
case clsBankClient::svFaildAccountNumberExists:
{
cout << "\nError account was not saved because account number is used!\n";
break;
}
}
}
};