Compare commits
3 Commits
billing5re
...
ec089c66e7
Author | SHA1 | Date | |
---|---|---|---|
ec089c66e7 | |||
ef607e7ffc | |||
aa52f96beb |
@ -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_,
|
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_},
|
: id{id_},
|
||||||
name{name_},
|
name{name_},
|
||||||
password{password_},
|
password{password_},
|
||||||
vehicle{vehicle_},
|
vehicle{vehicle_},
|
||||||
park_instances{instances},
|
park_instances{instances},
|
||||||
telephone{telephone_} {}
|
telephone{telephone_},
|
||||||
|
role{role_} {}
|
||||||
|
|
||||||
// clock in/out methods
|
// clock in/out methods
|
||||||
// ====================================================================================
|
// ====================================================================================
|
||||||
|
@ -277,7 +277,7 @@ void new_customer() {
|
|||||||
cout << "\nWhat's the password? ";
|
cout << "\nWhat's the password? ";
|
||||||
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 with ID:" << newcustomer.id << "\n";
|
||||||
if (confirm())
|
if (confirm())
|
||||||
newcustomer.update_db();
|
newcustomer.update_db();
|
||||||
}
|
}
|
||||||
@ -294,10 +294,10 @@ void new_admin() {
|
|||||||
std::getline(cin, telephone);
|
std::getline(cin, telephone);
|
||||||
cout << "\nWhat's the password?";
|
cout << "\nWhat's the password?";
|
||||||
std::getline(cin, password);
|
std::getline(cin, password);
|
||||||
Customer newcustomer{name, password, Vehicle_type(vtype), telephone, role};
|
Customer newadmin{name, password, Vehicle_type(vtype), telephone, role};
|
||||||
cout << "\nNew customer sucessfully created\n";
|
cout << "\nNew customer sucessfully created with ID=" << newadmin.id << "\n";
|
||||||
if (confirm())
|
if (confirm())
|
||||||
newcustomer.update_db();
|
newadmin.update_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
void new_parkspot(vector<Park_spot>& spots) {
|
void new_parkspot(vector<Park_spot>& spots) {
|
||||||
|
@ -41,9 +41,10 @@ vector<Customer> query_customer_with_name(string name) {
|
|||||||
string password = query.getColumn(2);
|
string password = query.getColumn(2);
|
||||||
int vehicle = query.getColumn(3); // cast to vehicle
|
int vehicle = query.getColumn(3); // cast to vehicle
|
||||||
string telephone = query.getColumn(4);
|
string telephone = query.getColumn(4);
|
||||||
|
int role = query.getColumn(5);
|
||||||
vector<Park_time> park_instances = query_parktimes_for_customer(id);
|
vector<Park_time> park_instances = query_parktimes_for_customer(id);
|
||||||
result.push_back(
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
@ -63,8 +64,10 @@ Customer query_customer_with_id(int id) {
|
|||||||
string password = query.getColumn(2);
|
string password = query.getColumn(2);
|
||||||
int vehicle = query.getColumn(3); // cast to vehicle
|
int vehicle = query.getColumn(3); // cast to vehicle
|
||||||
string telephone = query.getColumn(4);
|
string telephone = query.getColumn(4);
|
||||||
|
int role = query.getColumn(5);
|
||||||
|
|
||||||
vector<Park_time> park_instances = query_parktimes_for_customer(id);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,9 @@ class Customer {
|
|||||||
Vehicle_type vehicle;
|
Vehicle_type vehicle;
|
||||||
string telephone;
|
string telephone;
|
||||||
int role;
|
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_,
|
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_in(int s_id);
|
||||||
void clock_out(int s_id);
|
void clock_out(int s_id);
|
||||||
bool parked();
|
bool parked();
|
||||||
|
Reference in New Issue
Block a user