-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathportal.cpp
More file actions
128 lines (108 loc) · 3.46 KB
/
portal.cpp
File metadata and controls
128 lines (108 loc) · 3.46 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
#include <iostream>
#include <string>
#include "portal.h"
using namespace std;
int main(int argc, char const *argv[])
{
login loginpage;
dataentry entry;
string username{};
string password{};
string inputusername{};
string inputpassword{};
string firstname{};
string middlename{};
string lastname{};
string email{};
string mob{};
string gender{};
string accounttype{};
long long int phone{};
long long int personid{};
long long int personidtofind{};
long long int personidtodelete{};
long long int personidtoupdate{};
int countrycode{};
int dob{};
int yob{};
int actionchoice{};
char choice{};
bool valid = false;
cout << "Welcome to UAP Datasystems. Unlock the Power of Data with Our Cutting-Edge Database Solutions." << endl;
valid = loginpage.checklogindata(inputusername, inputpassword, username, password);
if (valid == 0)
{
cout << "Terminating program.";
return -1;
}
do
{
actionchoice == 5;
cout << "Please enter a number depending on the action you wish to take: " << endl;
cout << "Enter 1 for adding an entry." << endl;
cout << "Enter 2 for viewing entries." << endl;
cout << "Enter 3 for updating an entry." << endl;
cout << "Enter 4 for deleting an entry." << endl;
cout << "Enter 5 to log out." << endl;
cin >> actionchoice;
while (cin.fail())
{
cout << "Enter a number from 1 to 5: ";
cin >> actionchoice;
}
if (actionchoice == 1) // add entries
{
do
{
choice == 'N';
entry.addentry(firstname, middlename, lastname, countrycode, personid, phone, email, dob, mob, yob, gender);
cout << "Entry has been added." << endl;
cout << "Do you want to add another entry(Y/N)?: ";
cin >> choice;
} while (choice == 'Y');
}
if (actionchoice == 2) // view entries
{
cout << "Do you want to view a specific entry(Y/N)? If no, all entries will be displayed: ";
cin >> choice;
if ((choice == 'Y') || (choice == 'y'))
{
cout << "Enter the person I.D.: ";
cin >> personidtofind;
entry.showentry(personidtofind);
}
else if ((choice == 'N') || (choice == 'n'))
{
entry.showdata();
}
else
{
cout << "Invalid input" << endl;
}
}
if (actionchoice == 3) // update entry
{
cout << "Enter the person I.D.: ";
cin >> personidtoupdate;
while (cin.fail())
{
cout << "Enter a valid person I.D.: ";
cin >> personidtoupdate;
}
entry.updateentry(firstname, middlename, lastname, countrycode, personidtoupdate, phone, email, dob, mob, yob, gender);
}
if (actionchoice == 4) // delete entry
{
cout << "Enter the person I.D.: ";
cin >> personidtodelete;
while (cin.fail())
{
cout << "Enter a valid person I.D.: ";
cin >> personidtodelete;
}
entry.deleteentry(personidtodelete);
}
} while (actionchoice != 5);
cout << "Logging out" << endl;
return 0;
}