+Edit f, +CLS
This commit is contained in:
parent
23144deb04
commit
f3061fe3bc
@ -12,6 +12,7 @@ void interface(vector<Park_spot>& spots) {
|
|||||||
text_animation(introduction, 50);
|
text_animation(introduction, 50);
|
||||||
*/
|
*/
|
||||||
__label__ exit;
|
__label__ exit;
|
||||||
|
system("CLS");
|
||||||
cout << "\nWelcome to the parking system. Please login...";
|
cout << "\nWelcome to the parking system. Please login...";
|
||||||
int id;
|
int id;
|
||||||
string password;
|
string password;
|
||||||
@ -43,6 +44,7 @@ void interface_member(vector<Park_spot>& spots, Customer& c) {
|
|||||||
cout << "\nLogged in succesfully!\n";
|
cout << "\nLogged in succesfully!\n";
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
|
system("CLS");
|
||||||
cout << "Hello! " << c.name
|
cout << "Hello! " << c.name
|
||||||
<< ", please select an option:\n[1]Parking\n[2]Monthly report\n"
|
<< ", please select an option:\n[1]Parking\n[2]Monthly report\n"
|
||||||
"[3]Edit information\n[4]Exit\n";
|
"[3]Edit information\n[4]Exit\n";
|
||||||
@ -55,17 +57,21 @@ begin:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
cout << "Has not been implemented yet\n";
|
string lol;
|
||||||
|
report_customer(c.id);
|
||||||
|
std::cout<<"Enter any character to continue...";
|
||||||
|
std::cin>>lol;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 3: {
|
case 3: {
|
||||||
cout << "Has not been implemented yet\n";
|
edit_information(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 4: {
|
case 4: {
|
||||||
cout << "Exiting...\n";
|
cout << "Exiting...\n";
|
||||||
|
Sleep(2000);
|
||||||
goto exit;
|
goto exit;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -157,6 +163,7 @@ begin:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
|
system("CLS");
|
||||||
cout << "[1] Make new customer\n";
|
cout << "[1] Make new customer\n";
|
||||||
cout << "[2] Make new admin\n";
|
cout << "[2] Make new admin\n";
|
||||||
cout << "[3] Return\n";
|
cout << "[3] Return\n";
|
||||||
@ -181,6 +188,8 @@ begin:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
|
std::cout<<"Exiting...";
|
||||||
|
Sleep(2000);
|
||||||
goto exit;
|
goto exit;
|
||||||
break;
|
break;
|
||||||
} break;
|
} break;
|
||||||
@ -191,6 +200,7 @@ begin:
|
|||||||
}
|
}
|
||||||
goto begin;
|
goto begin;
|
||||||
exit:;
|
exit:;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------- individual things.
|
// --------- individual things.
|
||||||
@ -214,7 +224,7 @@ void park(Customer& c, vector<Park_spot>& spots) {
|
|||||||
cin.ignore(10000, '\n');
|
cin.ignore(10000, '\n');
|
||||||
for (Park_spot& i : spots) {
|
for (Park_spot& i : spots) {
|
||||||
if (i.id == parkID) {
|
if (i.id == parkID) {
|
||||||
if (verify()) {
|
if (confirm()) {
|
||||||
i.clock(c);
|
i.clock(c);
|
||||||
cout << "You have parked sucessfully!";
|
cout << "You have parked sucessfully!";
|
||||||
}
|
}
|
||||||
@ -231,7 +241,7 @@ void park(Customer& c, vector<Park_spot>& spots) {
|
|||||||
query_parkspot_with_id(c.parked_at(), spots).clock(c);
|
query_parkspot_with_id(c.parked_at(), spots).clock(c);
|
||||||
cout << "You have sucessfully clocked out.";
|
cout << "You have sucessfully clocked out.";
|
||||||
} else {
|
} else {
|
||||||
cout << "OK, have a nice day."; // exit to customer login
|
cout << "OK, have a nice day.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit:;
|
exit:;
|
||||||
@ -254,7 +264,7 @@ void new_customer() {
|
|||||||
std::getline(cin, password);
|
std::getline(cin, password);
|
||||||
Customer newcustomer{name, password, Vehicle_type(vtype), telephone, role};
|
Customer newcustomer{name, password, Vehicle_type(vtype), telephone, role};
|
||||||
cout << "\nNew customer sucessfully created\n";
|
cout << "\nNew customer sucessfully created\n";
|
||||||
if (verify())
|
if (confirm())
|
||||||
newcustomer.update_db();
|
newcustomer.update_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,22 +282,49 @@ void new_admin() {
|
|||||||
std::getline(cin, password);
|
std::getline(cin, password);
|
||||||
Customer newcustomer{name, password, Vehicle_type(vtype), telephone, role};
|
Customer newcustomer{name, password, Vehicle_type(vtype), telephone, role};
|
||||||
cout << "\nNew customer sucessfully created\n";
|
cout << "\nNew customer sucessfully created\n";
|
||||||
if (verify())
|
if (confirm())
|
||||||
newcustomer.update_db();
|
newcustomer.update_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
void new_parkspot(vector<Park_spot>& spots) {
|
void new_parkspot(vector<Park_spot>& spots) {
|
||||||
cout << "What type of parking spot? \n[1] Twowheeler\n[2] Fourwheeler\n";
|
cout << "What type of parking spot? \n[1] Two-wheeler\n[2] Four-wheeler\n";
|
||||||
int vtype;
|
int vtype;
|
||||||
cin >> vtype;
|
cin >> vtype;
|
||||||
cin.ignore(10000, '\n');
|
cin.ignore(10000, '\n');
|
||||||
Park_spot newspot{Vehicle_type(vtype)};
|
Park_spot newspot{Vehicle_type(vtype)};
|
||||||
if (verify()) {
|
if (confirm()) {
|
||||||
spots.push_back(newspot);
|
spots.push_back(newspot);
|
||||||
cout << "New parking spot sucessfully created.\n";
|
cout << "New parking spot sucessfully created.\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void edit_information(Customer& c)
|
||||||
|
{
|
||||||
|
string string0; int int0;
|
||||||
|
/*std::cout<<"\nInput to update name or press [0] to keep name:\n";
|
||||||
|
std::getline(cin,string0);
|
||||||
|
if (string0=="0");
|
||||||
|
else c.name=string0;*/
|
||||||
|
|
||||||
|
std::cout<<"\n Input to update vehicle to [1]Two-Wheeler,"
|
||||||
|
"[2]Four-Wheeler or press [0] to keep vehicle type:\n";
|
||||||
|
std::cin>>int0;
|
||||||
|
if (!int0);
|
||||||
|
else c.vehicle=Vehicle_type(int0);
|
||||||
|
cin.ignore();
|
||||||
|
std::cout<<"\n Input to update password or press [0] to keep current password:\n";
|
||||||
|
std::getline(cin,string0);
|
||||||
|
if (string0=="0");
|
||||||
|
else c.password=hash_password(string0);
|
||||||
|
|
||||||
|
std::cout<<"\n Input to update phone number or press [0] to keep current number:\n";
|
||||||
|
std::getline(cin,string0);
|
||||||
|
if (string0=="0");
|
||||||
|
else c.telephone=string0;
|
||||||
|
c.role=0;
|
||||||
|
if(confirm()){c.update_db();}
|
||||||
|
}
|
||||||
|
|
||||||
// time stuff-----------------------------------------------------
|
// time stuff-----------------------------------------------------
|
||||||
|
|
||||||
pair<int, int> create_month_period() {
|
pair<int, int> create_month_period() {
|
||||||
@ -323,16 +360,24 @@ pair<int, int> create_week_period() {
|
|||||||
return period;
|
return period;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool verify(void) {
|
bool confirm(void) {
|
||||||
string ver;
|
string ver;
|
||||||
std::cout << "\nAre you sure you want to commit these actions?"
|
std::cout << "\nAre you sure you want to commit these actions?"
|
||||||
"\n[No] Revert."
|
"\n[No] Revert."
|
||||||
"\n[Yes] Commit.";
|
"\n[Yes] Commit.";
|
||||||
std::cin >> ver;
|
std::cin >> ver;
|
||||||
if (ver == "YES" | ver == "Yes" | ver == "yes")
|
if (ver == "YES" | ver == "Yes" | ver == "yes")
|
||||||
|
{
|
||||||
|
std::cout<<"Succes! Changes Saved.";
|
||||||
|
Sleep(1000);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
std::cout<<"No changes committed.";
|
||||||
|
Sleep(1000);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------ report stuff
|
// ------------------------------ report stuff
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
#include "Query.h"
|
#include "Query.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <synchapi.h>
|
||||||
|
|
||||||
using std::cin;
|
using std::cin;
|
||||||
|
|
||||||
|
//interface functions
|
||||||
void interface(vector<Park_spot>& spots);
|
void interface(vector<Park_spot>& spots);
|
||||||
void interface_member(vector<Park_spot>& spots, Customer& c);
|
void interface_member(vector<Park_spot>& spots, Customer& c);
|
||||||
void interface_admin(vector<Park_spot>& spots);
|
void interface_admin(vector<Park_spot>& spots);
|
||||||
@ -9,15 +12,16 @@ void park(Customer& c, vector<Park_spot>& spots);
|
|||||||
void new_customer();
|
void new_customer();
|
||||||
void new_admin();
|
void new_admin();
|
||||||
void new_parkspot(vector<Park_spot>& spots);
|
void new_parkspot(vector<Park_spot>& spots);
|
||||||
|
void edit_information(Customer&);
|
||||||
|
|
||||||
// time creation
|
// time creation
|
||||||
pair<int, int> create_month_period();
|
pair<int, int> create_month_period();
|
||||||
pair<int, int> create_week_period();
|
pair<int, int> create_week_period();
|
||||||
|
|
||||||
// report stuff
|
// report functions
|
||||||
void report_single_spot(bool weekly = false);
|
void report_single_spot(bool weekly = false);
|
||||||
void report_all_spots(bool weekly = false);
|
void report_all_spots(bool weekly = false);
|
||||||
void report_customer(int customerID, bool weekly = false);
|
void report_customer(int customerID, bool weekly = false);
|
||||||
|
|
||||||
// stuff
|
// confirmation function
|
||||||
bool verify();
|
bool confirm();
|
Loading…
Reference in New Issue
Block a user