3 Commits

Author SHA1 Message Date
ec089c66e7 id fix 2019-07-22 10:28:44 -03:00
ef607e7ffc cosmetic merge 2019-07-22 10:19:52 -03:00
aa52f96beb fixed customer role 2019-07-22 10:16:07 -03:00
5 changed files with 405 additions and 401 deletions

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

@ -277,7 +277,7 @@ void new_customer() {
cout << "\nWhat's the password? ";
std::getline(cin, password);
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())
newcustomer.update_db();
}
@ -294,10 +294,10 @@ void new_admin() {
std::getline(cin, telephone);
cout << "\nWhat's the password?";
std::getline(cin, password);
Customer newcustomer{name, password, Vehicle_type(vtype), telephone, role};
cout << "\nNew customer sucessfully created\n";
Customer newadmin{name, password, Vehicle_type(vtype), telephone, role};
cout << "\nNew customer sucessfully created with ID=" << newadmin.id << "\n";
if (confirm())
newcustomer.update_db();
newadmin.update_db();
}
void new_parkspot(vector<Park_spot>& spots) {

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();

BIN
test.db3

Binary file not shown.