Merge josh features and sagar features #11

Closed
MassiveAtoms wants to merge 20 commits from billing4real into billing
4 changed files with 14 additions and 55 deletions
Showing only changes of commit aa52f96beb - Show all commits

View File

@ -13,13 +13,14 @@ Customer::Customer(string name_, string password_, Vehicle_type vehicle_, string
}
Customer::Customer(int id_, string name_, string password_, Vehicle_type vehicle_,
vector<Park_time> instances, string telephone_)
vector<Park_time> instances, string telephone_, int role_)
: id{id_},
name{name_},
password{password_},
vehicle{vehicle_},
park_instances{instances},
telephone{telephone_} {}
telephone{telephone_},
role{role_} {}
// clock in/out methods
// ====================================================================================

View File

@ -12,7 +12,6 @@ void interface(vector<Park_spot>& spots) {
text_animation(introduction, 50);
*/
__label__ exit;
system("CLS");
cout << "\nWelcome to the parking system. Please login...";
int id;
string password;
@ -44,7 +43,6 @@ void interface_member(vector<Park_spot>& spots, Customer& c) {
cout << "\nLogged in succesfully!\n";
begin:
system("CLS");
cout << "Hello! " << c.name
<< ", please select an option:\n[1]Parking\n[2]Monthly report\n"
"[3]Edit information\n[4]Exit\n";
@ -57,21 +55,17 @@ begin:
break;
}
case 2: {
string lol;
report_customer(c.id);
std::cout<<"Enter any character to continue...";
std::cin>>lol;
cout << "Has not been implemented yet\n";
break;
}
case 3: {
edit_information(c);
cout << "Has not been implemented yet\n";
break;
}
case 4: {
cout << "Exiting...\n";
Sleep(2000);
goto exit;
break;
}
@ -163,7 +157,6 @@ begin:
break;
}
case 3: {
system("CLS");
cout << "[1] Make new customer\n";
cout << "[2] Make new admin\n";
cout << "[3] Return\n";
@ -188,8 +181,6 @@ begin:
break;
}
case 4: {
std::cout<<"Exiting...";
Sleep(2000);
goto exit;
break;
} break;
@ -200,7 +191,6 @@ begin:
}
goto begin;
exit:;
}
// --------- individual things.
@ -241,7 +231,7 @@ void park(Customer& c, vector<Park_spot>& spots) {
query_parkspot_with_id(c.parked_at(), spots).clock(c);
cout << "You have sucessfully clocked out.";
} else {
cout << "OK, have a nice day.";
cout << "OK, have a nice day."; // exit to customer login
}
}
exit:;
@ -287,7 +277,7 @@ void new_admin() {
}
void new_parkspot(vector<Park_spot>& spots) {
cout << "What type of parking spot? \n[1] Two-wheeler\n[2] Four-wheeler\n";
cout << "What type of parking spot? \n[1] Twowheeler\n[2] Fourwheeler\n";
int vtype;
cin >> vtype;
cin.ignore(10000, '\n');
@ -298,33 +288,6 @@ void new_parkspot(vector<Park_spot>& spots) {
}
}
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-----------------------------------------------------
pair<int, int> create_month_period() {
@ -367,18 +330,10 @@ bool confirm(void) {
"\n[Yes] Commit.";
std::cin >> ver;
if (ver == "YES" | ver == "Yes" | ver == "yes")
{
std::cout<<"Succes! Changes Saved.";
Sleep(1000);
return true;
}
else
{
std::cout<<"No changes committed.";
Sleep(1000);
return false;
}
}
// ------------------------------ report stuff

View File

@ -41,9 +41,10 @@ vector<Customer> query_customer_with_name(string name) {
string password = query.getColumn(2);
int vehicle = query.getColumn(3); // cast to vehicle
string telephone = query.getColumn(4);
int role = query.getColumn(5);
vector<Park_time> park_instances = query_parktimes_for_customer(id);
result.push_back(
Customer{id, name_, password, Vehicle_type(vehicle), park_instances, telephone});
Customer{id, name_, password, Vehicle_type(vehicle), park_instances, telephone, role});
}
return result;
}
@ -63,8 +64,10 @@ Customer query_customer_with_id(int id) {
string password = query.getColumn(2);
int vehicle = query.getColumn(3); // cast to vehicle
string telephone = query.getColumn(4);
int role = query.getColumn(5);
vector<Park_time> park_instances = query_parktimes_for_customer(id);
Customer result{id, name, password, Vehicle_type(vehicle), park_instances, telephone};
Customer result{id, name, password, Vehicle_type(vehicle), park_instances, telephone, role};
return result;
}
}

View File

@ -41,9 +41,9 @@ class Customer {
Vehicle_type vehicle;
string telephone;
int role;
Customer(string name_, string password_, Vehicle_type vehicle_, string telephone_, int role);
Customer(string name_, string password_, Vehicle_type vehicle_, string telephone_, int role_);
Customer(int id_, string name_, string password_, Vehicle_type vehicle_,
vector<Park_time> instances, string telephone_);
vector<Park_time> instances, string telephone_, int role_);
void clock_in(int s_id);
void clock_out(int s_id);
bool parked();