-
Notifications
You must be signed in to change notification settings - Fork 0
/
clsDeleteUser.h
38 lines (34 loc) · 875 Bytes
/
clsDeleteUser.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
#pragma once
#include "clsScreen.h"
class clsDeleteUser : public clsScreen {
static void _MarkUserForDelete(clsUser &User) {
User.markForDeletion = true;
}
public:
static void DeleteUser() {
string AreYouSure = "y";
string Username = clsInputValidate::ReadString("Enter Username : ");
bool IsUserExist = clsUser::IsUserExist(Username);
if (!IsUserExist)
{
cout << "\nUser is not exisit!\n";
}
else {
clsUser UserToDelete = clsUser::Find(Username);
PrintUserCard(UserToDelete);
cout << "\nAre You Sure Do You Want To Delete This User (y,n) ? ";
cin >> AreYouSure;
if (tolower(AreYouSure[0]) == 'y')
{
_MarkUserForDelete(UserToDelete);
if (UserToDelete.Delete())
{
cout << "\nUser Deleted Successfully!\nThank You!\n";
}
else {
cout << "User NOT Deleted!\nSomthing wrong happened!";
}
}
}
}
};