61 lines
1.7 KiB
C++
61 lines
1.7 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 Vehicle_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 Vehicle_type { twoweeler = 1, fourweeler = 2 };
|
|
|
|
/*
|
|
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;
|
|
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_);
|
|
void clock_in(int s_id);
|
|
void clock_out(int s_id);
|
|
bool parked();
|
|
int parked_at();
|
|
|
|
void update_db();
|
|
void delete_db();
|
|
|
|
private:
|
|
vector<Park_time> park_instances;
|
|
void save_db();
|
|
int auto_increment_db();
|
|
};
|
|
|
|
#endif // CUSTOMER_H
|