2019-07-02 00:18:52 +00:00
|
|
|
#ifndef CUSTOMER_H
|
|
|
|
#define CUSTOMER_H
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Park_time.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
|
2019-07-02 18:40:37 +00:00
|
|
|
/*
|
|
|
|
enum classes make it easy to represent categories.
|
2019-07-06 14:52:01 +00:00
|
|
|
So you can use something like Vehicle_type::car instead of 2. but under the
|
2019-07-02 18:40:37 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
2019-07-08 20:57:09 +00:00
|
|
|
enum class Vehicle_type { twoweeler = 1, fourweeler = 2 };
|
2019-07-02 00:18:52 +00:00
|
|
|
|
|
|
|
/*
|
2019-07-02 18:40:37 +00:00
|
|
|
Customer constructors do the same stuff as all the other constructors.
|
|
|
|
clock_in and out create and modify park_time objects and store them to
|
|
|
|
park_instances. Technically, now that we have a working db, we don't need it.
|
|
|
|
TODO: fix this.
|
2019-07-02 00:18:52 +00:00
|
|
|
|
2019-07-02 18:40:37 +00:00
|
|
|
gen_monthly just prints out all the park_time objects in park_instances.
|
|
|
|
It should (and can safely) be removed, but it's here as a quick example of
|
|
|
|
report generation It has no logic to speak of that only generates report of
|
|
|
|
ptime objects of this month.
|
|
|
|
TODO: remove when have seperate report generation functions.
|
|
|
|
|
|
|
|
save, update, delete and auto increment are the same as in park_time.
|
|
|
|
*/
|
2019-07-02 00:18:52 +00:00
|
|
|
|
|
|
|
class Customer {
|
|
|
|
public:
|
|
|
|
int id;
|
|
|
|
string name;
|
|
|
|
string password;
|
2019-07-08 20:57:09 +00:00
|
|
|
Vehicle_type vehicle;
|
|
|
|
string telephone;
|
|
|
|
Customer(string name_, string password_, Vehicle_type vehicle_, string telephone_);
|
2019-07-06 14:52:01 +00:00
|
|
|
Customer(int id_, string name_, string password_, Vehicle_type vehicle_,
|
2019-07-08 20:57:09 +00:00
|
|
|
vector<Park_time> instances, string telephone_);
|
2019-07-02 00:18:52 +00:00
|
|
|
void clock_in(int s_id);
|
|
|
|
void clock_out(int s_id);
|
2019-07-06 16:32:00 +00:00
|
|
|
bool parked();
|
|
|
|
int parked_at();
|
2019-07-02 00:18:52 +00:00
|
|
|
|
|
|
|
void update_db();
|
|
|
|
void delete_db();
|
|
|
|
|
|
|
|
private:
|
|
|
|
vector<Park_time> park_instances;
|
|
|
|
void save_db();
|
|
|
|
int auto_increment_db();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CUSTOMER_H
|