-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.cpp
More file actions
130 lines (128 loc) · 5.51 KB
/
Copy pathUser.cpp
File metadata and controls
130 lines (128 loc) · 5.51 KB
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
#include "User.h"
#include "RoomType.h"
#include "Room.h"
#include "Service.h"
#include "ServiceUsage.h"
#include "Reservation.h"
#include "Contract.h"
#include "PaymentStatistics.h"
#include "Payment.h"
#include "Menu.h"
using namespace std;
void User::displayTenantMenu() {
cout << "\n========= TENANT MENU =========" << endl;
cout << " Current UserID: " << Account::currentTenantID << endl;
Payment::checkUnpaidPayments(Account::currentTenantID);
Service::notifyNewService();
cout << " 1. Account Management" << endl;
cout << " 2. Make Room Reservation" << endl;
cout << " 3. View My Room" << endl;
cout << " 4. Contract Management" << endl;
cout << " 5. Service Management" << endl;
cout << " 6. Payment Management" << endl;
cout << " 0. Sign Out" << endl;
cout << "===============================" << endl;
}
void User::controlTenantMenu() {
int choice;
do {
displayTenantMenu();
cout << "Please select an option: ";
cin >> choice;
switch (choice) {
case 1: {
int select;
do {
cout << "\n-- Account Management --" << endl
<< " 1. View Personal Information" << endl
<< " 2. Update Personal Information" << endl
<< " 3. Change Password" << endl
<< " 0. Back to Main Menu" << endl;
cout << "Please select an option: "; cin >> select;
switch (select) {
case 1:
Tenant::resetHeader();
cout << *Tenant::tenantList.searchID(Account::currentTenantID);
break;
case 2: Tenant::updateTenant(); break;
case 3: Account::changePassword(); break;
case 0: cout << "Exiting Account Management." << endl; break;
default: cout << "Invalid selection. Please try again." << endl; break;
}
} while (select != 0);
break;
}
case 2: Reservation::addReservation(); break;
case 3: Room::searchRoomByTenantID(Account::currentTenantID); break;
case 4: {
int contractChoice;
do {
cout << "\n=== Contracts Management ===" << endl;
cout << "1. View Active Contracts" << endl;
cout << "2. Contracts History" << endl;
cout << "3. Extension Contract" << endl;
cout << "4. Terminate Contract" << endl;
cout << "0. Back" << endl;
cout << "Enter your choice: ";
cin >> contractChoice;
switch(contractChoice) {
case 1: Contract::searchByTenantID(Account::currentTenantID,1); break;
case 2: Contract::searchByTenantID(Account::currentTenantID,0); break;
case 3: Contract::extensionContract(); break;
case 4: Contract::deleteContract(); break;
case 0: break;
default: cout << "Invalid choice. Please try again." << endl;
}
} while(contractChoice != 0);
break;
}
case 5: {
int serviceChoice;
do {
cout << "\n=== Service Management ===" << endl;
cout << "1. View Service Usage" << endl;
cout << "2. Register New Service" << endl;
cout << "3. Stop Using Service" << endl;
cout << "0. Back" << endl;
cout << "Enter your choice: ";
cin >> serviceChoice;
switch(serviceChoice) {
case 1: ServiceUsage::searchByTenantID(Account::currentTenantID); break;
case 2: ServiceUsage::addServiceUsage(); break;
case 3: ServiceUsage::stopService(); break;
case 0: break;
default: cout << "Invalid choice. Please try again." << endl;
}
} while(serviceChoice != 0);
break;
}
case 6: {
int paymentChoice;
do {
cout << "\n=== Payment Management ===" << endl;
cout << "1. View Payment Status" << endl;
cout << "2. Pay Bill" << endl;
cout << "0. Back" << endl;
cout << "Enter your choice: ";
cin >> paymentChoice;
switch(paymentChoice) {
case 1: Payment::searchByTenantID(Account::currentTenantID); break;
case 2: Payment::managePayments(); break;
case 0: break;
default: cout << "Invalid choice. Please try again." << endl;
}
} while(paymentChoice != 0);
break;
}
case 0:
cout << "Logging out..." << endl;
updateAllFile();
Account::currentTenantID = "";
displayLoginMenu();
return;
default:
cout << "Invalid selection. Please try again." << endl;
break;
}
} while (choice != 0);
}