added telephone support
This commit is contained in:
@@ -16,7 +16,7 @@ hood, it's still an int. This is here so you won't have to have global variables
|
||||
for these categories, or worse, use magic numbers in the code.
|
||||
|
||||
*/
|
||||
enum class Vehicle_type { bike = 1, small_car = 2, suv = 3, pickup = 4 };
|
||||
enum class Vehicle_type { twoweeler = 1, fourweeler = 2 };
|
||||
|
||||
/*
|
||||
Customer constructors do the same stuff as all the other constructors.
|
||||
@@ -38,9 +38,11 @@ class Customer {
|
||||
int id;
|
||||
string name;
|
||||
string password;
|
||||
Customer(string name_, string password_, Vehicle_type vehicle_);
|
||||
Vehicle_type vehicle;
|
||||
string telephone;
|
||||
Customer(string name_, string password_, Vehicle_type vehicle_, string telephone_);
|
||||
Customer(int id_, string name_, string password_, Vehicle_type vehicle_,
|
||||
vector<Park_time> instances);
|
||||
vector<Park_time> instances, string telephone_);
|
||||
void clock_in(int s_id);
|
||||
void clock_out(int s_id);
|
||||
bool parked();
|
||||
@@ -49,9 +51,6 @@ class Customer {
|
||||
void update_db();
|
||||
void delete_db();
|
||||
|
||||
void gen_monthly();
|
||||
Vehicle_type vehicle;
|
||||
|
||||
private:
|
||||
vector<Park_time> park_instances;
|
||||
void save_db();
|
||||
|
@@ -2,11 +2,12 @@
|
||||
|
||||
#include "Query.h"
|
||||
|
||||
|
||||
using std::cin;
|
||||
|
||||
|
||||
|
||||
void interface(vector<Park_spot>& spots);
|
||||
void interface_member(vector<Park_spot>& spots);
|
||||
void interface_admin(vector<Park_spot>& spots);
|
||||
void park(Customer& c, vector<Park_spot>& spots);
|
||||
void park(Customer& c, vector<Park_spot>& spots);
|
||||
void new_customer();
|
||||
void new_parkspot(vector<Park_spot>& spots);
|
@@ -19,7 +19,7 @@ class Park_spot {
|
||||
bool taken;
|
||||
int parked_customer;
|
||||
Vehicle_type v_type;
|
||||
|
||||
|
||||
Park_spot(Vehicle_type v_type_);
|
||||
Park_spot(int id_, bool taken_, int parked, Vehicle_type v_type_);
|
||||
void clock(Customer& c_customer);
|
||||
|
@@ -5,10 +5,10 @@
|
||||
#include "data.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
using namespace std::chrono;
|
||||
using std::cout;
|
||||
@@ -32,21 +32,21 @@ operator<< is << overload, can(should) be used for report generation.
|
||||
|
||||
|
||||
// implementation stuff------------------------
|
||||
start and end are time points representing when someone clocks in and out. they're from the chrono namespace.
|
||||
start and end are time points representing when someone clocks in and out. they're from the chrono
|
||||
namespace.
|
||||
|
||||
save and update save and update info in the database.
|
||||
auto_increment pulls the highest id stored in the db, to be used in the constructor.
|
||||
|
||||
start_to_int() is used to convert the start timepoint to an integer that can be saved in the database
|
||||
SQL datetime and chrono datetime don't seem the most compatible.
|
||||
start_to_int() is used to convert the start timepoint to an integer that can be saved in the
|
||||
database SQL datetime and chrono datetime don't seem the most compatible.
|
||||
|
||||
*/
|
||||
|
||||
class Park_time {
|
||||
public:
|
||||
Park_time(int c_id, int s_id);
|
||||
Park_time(int id_, int customer_id_, int spot_id_, int start_,
|
||||
int duration_);
|
||||
Park_time(int id_, int customer_id_, int spot_id_, int start_, int duration_);
|
||||
int id;
|
||||
int customer_id;
|
||||
int spot_id;
|
||||
@@ -64,8 +64,7 @@ class Park_time {
|
||||
int start_to_int(); // helper
|
||||
};
|
||||
|
||||
|
||||
//test funciton
|
||||
// test funciton
|
||||
void Wait(int sec);
|
||||
|
||||
#endif // Park_time
|
@@ -26,7 +26,7 @@ customers who have the same name.
|
||||
2. I have no clue how many of you have done error handling in c++
|
||||
(try/catch/finally).
|
||||
Ya boi is nice and doesn't want to bombard you with more new concepts than needed.
|
||||
so now you'd do
|
||||
so now you'd do
|
||||
|
||||
vector<Customer> test = query_customer_with_name("Testman");
|
||||
|
||||
@@ -34,7 +34,7 @@ if (!test.size()) {print no customers found, do stuff}
|
||||
else if (test.size() > 1) { do stuff to get the right one if you only need one
|
||||
}
|
||||
|
||||
instead of
|
||||
instead of
|
||||
try {
|
||||
customer test = query_customer_with_name("Testman");
|
||||
}
|
||||
@@ -46,7 +46,8 @@ finally{
|
||||
do more stuff
|
||||
}
|
||||
|
||||
3. Ya boi needs to brush up on how to create custom exceptions class, and it will complicate code furhter.
|
||||
3. Ya boi needs to brush up on how to create custom exceptions class, and it will complicate code
|
||||
furhter.
|
||||
|
||||
*/
|
||||
|
||||
@@ -59,8 +60,8 @@ vector<Park_spot> populate_spots();
|
||||
|
||||
Park_spot query_parkspot_with_id(int id, vector<Park_spot>& parkspots);
|
||||
|
||||
void reports_from_parkspot(int spotid, bool weekly=false);
|
||||
void reports_from_allparkspots(bool weekly=false);
|
||||
void reports_from_parkspot(int spotid, bool weekly = false);
|
||||
void reports_from_allparkspots(bool weekly = false);
|
||||
|
||||
void current_status_parkspots(vector<Park_spot>& spots);
|
||||
#endif // CUSTOMER_H
|
||||
|
@@ -8,8 +8,8 @@ namespace data {
|
||||
|
||||
/*
|
||||
start_db is the function that opens the database, and
|
||||
if the necesary tables are not there, creates them.
|
||||
db is the database, and is static to avoid multiple redefinition errors.
|
||||
if the necesary tables are not there, creates them.
|
||||
db is the database, and is static to avoid multiple redefinition errors.
|
||||
*/
|
||||
SQLite::Database start_db();
|
||||
static SQLite::Database db = start_db();
|
||||
|
@@ -10,11 +10,11 @@
|
||||
using std::string;
|
||||
/*
|
||||
hash_password takes the password, and encrypts it. This needs to be done,
|
||||
because storing passwords in plaintext is BAD!
|
||||
because storing passwords in plaintext is BAD!
|
||||
|
||||
verify_password takes in a password and the hashed password, and then does magic encryption stuff(no, not
|
||||
really. It basically hashes the password with the same salt and other
|
||||
parameters) and to see if the password stored and the given password match.
|
||||
verify_password takes in a password and the hashed password, and then does magic encryption
|
||||
stuff(no, not really. It basically hashes the password with the same salt and other parameters) and
|
||||
to see if the password stored and the given password match.
|
||||
*/
|
||||
|
||||
string hash_password(string password);
|
||||
|
Reference in New Issue
Block a user