59 lines
1.6 KiB
C++
59 lines
1.6 KiB
C++
#ifndef CUSTOMER_H
|
|
#define CUSTOMER_H
|
|
#pragma once
|
|
|
|
#include "Park_time.h"
|
|
#include "data.h"
|
|
|
|
#include <vector>
|
|
|
|
using std::vector;
|
|
|
|
/*
|
|
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.
|
|
|
|
*/
|
|
enum class Verhicle_type { bike = 1, small_car = 2, suv = 3, pickup = 4 };
|
|
|
|
/*
|
|
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.
|
|
|
|
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.
|
|
*/
|
|
|
|
class Customer {
|
|
public:
|
|
int id;
|
|
string name;
|
|
string password;
|
|
Customer(string name_, string password_, Verhicle_type verhicle_);
|
|
Customer(int id_, string name_, string password_, Verhicle_type verhicle_,
|
|
vector<Park_time> instances);
|
|
void clock_in(int s_id);
|
|
void clock_out(int s_id);
|
|
|
|
void update_db();
|
|
void delete_db();
|
|
|
|
void gen_monthly();
|
|
Verhicle_type verhicle;
|
|
|
|
private:
|
|
vector<Park_time> park_instances;
|
|
void save_db();
|
|
int auto_increment_db();
|
|
};
|
|
|
|
#endif // CUSTOMER_H
|