-
Notifications
You must be signed in to change notification settings - Fork 0
/
clsDeleteUserScreen.h
68 lines (54 loc) · 1.7 KB
/
clsDeleteUserScreen.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
#pragma once
#include <iostream>
#include "clsScreen.h"
#include "clsPerson.h"
#include "clsUser.h"
#include "clsInputValidate.h"
class clsDeleteUserScreen :protected clsScreen
{
private:
static void _PrintUser(clsUser User)
{
cout << "\nUser Card:";
cout << "\n___________________";
cout << "\nFirstName : " << User.FirstName;
cout << "\nLastName : " << User.LastName;
cout << "\nFull Name : " << User.FullName();
cout << "\nEmail : " << User.Email;
cout << "\nPhone : " << User.Phone;
cout << "\nUser Name : " << User.UserName;
cout << "\nPassword : " << User.Password;
cout << "\nPermissions : " << User.Permissions;
cout << "\n___________________\n";
}
public:
static void ShowDeleteUserScreen()
{
_DrawScreenHeader("\tDelete User Screen");
string UserName = "";
cout << "\nPlease Enter UserName: ";
UserName = clsInputValidate::ReadString();
while (!clsUser::IsUserExist(UserName))
{
cout << "\nUser is not found, choose another one: ";
UserName = clsInputValidate::ReadString();
}
clsUser User1 = clsUser::Find(UserName);
_PrintUser(User1);
cout << "\nAre you sure you want to delete this User y/n? ";
char Answer = 'n';
cin >> Answer;
if (Answer == 'y' || Answer == 'Y')
{
if (User1.Delete())
{
cout << "\nUser Deleted Successfully :-)\n";
_PrintUser(User1);
}
else
{
cout << "\nError User Was not Deleted\n";
}
}
}
};