2019-07-02 00:18:52 +00:00
|
|
|
#ifndef CUSTOMER_H
|
|
|
|
#define CUSTOMER_H
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Park_time.h"
|
|
|
|
#include "data.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
|
2019-07-02 18:40:37 +00:00
|
|
|
/*
|
|
|
|
enum classes make it easy to represent categories.
|
|
|
|
So you can use something like Verhicle_type::car instead of 2. but under the
|
|
|
|
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-02 00:18:52 +00:00
|
|
|
enum class Verhicle_type { bike = 1, small_car = 2, suv = 3, pickup = 4 };
|
|
|
|
|
|
|
|
/*
|
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;
|
|
|
|
Customer(string name_, string password_, Verhicle_type verhicle_);
|
2019-07-02 18:40:37 +00:00
|
|
|
Customer(int id_, string name_, string password_, Verhicle_type verhicle_,
|
2019-07-02 00:18:52 +00:00
|
|
|
vector<Park_time> instances);
|
|
|
|
void clock_in(int s_id);
|
|
|
|
void clock_out(int s_id);
|
|
|
|
|
|
|
|
void update_db();
|
|
|
|
void delete_db();
|
|
|
|
|
2019-07-02 18:40:37 +00:00
|
|
|
void gen_monthly();
|
2019-07-02 00:18:52 +00:00
|
|
|
Verhicle_type verhicle;
|
|
|
|
|
|
|
|
private:
|
|
|
|
vector<Park_time> park_instances;
|
|
|
|
void save_db();
|
|
|
|
int auto_increment_db();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CUSTOMER_H
|