-
Notifications
You must be signed in to change notification settings - Fork 1
/
operator.cpp
86 lines (68 loc) · 1.99 KB
/
operator.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "operator.h"
Operator::Operator(vector<Bike> *bikes, vector<Reservation> *reservations):
bikes(bikes), reservations(reservations)
{
}
void Operator::listReservations()
{
printTitle("List of Reservations");
for(auto res:*reservations)
res.print();
}
void Operator::searchReservation()
{
}
void Operator::addReservation()
{
printTitle("Add New Reservation");
int res_id = 0;
string status;
string name;
string idnumber;
string date_current;
string date_from;
string date_to;
vector<int> bike_ids;
string comment;
cout << "Name: ";
name = getString();
cout << "ID number: ";
idnumber = getString();
/*Itt még validálni kéne a dátumokat: //nem kell validálni, aszonták jó ez így
* nem arra kiváncsiak, hogy milyen fasza programot tudunk összehozni,
* hanem hogy mennyire tudjuk tartani magunkat a tervhez, az osztály diagramhoz
*/
cout << "Date from (accepted format: YYYY-MM-DD): ";
date_from = getString();
cout << "Date to (accepted format: YYYY-MM-DD): ";
date_to = getString();
/*Itt kéne egy lista az adott dátumok között elérhető biciklikről + validálás
* apró kérdés:
* - miért kéri be kétszer a bicajt?
*/
cout << "Select bike(s): ";
int bike_id = getInt();
bike_ids.push_back(bike_id);
cout << "Select bike(s): ";
bike_id = getInt();
bike_ids.push_back(bike_id);
cout << "Add comment (not required): ";
comment = getString();
//res_id automatikus megadása
for(auto res : *reservations){
if(res.getRes_id() >= res_id) res_id = res.getRes_id()+1;
}
date_current = getNow();
status = "Reserved";
reservations->push_back({res_id, status, name, idnumber, date_current, date_from, date_to, bike_ids, comment});
cout << "The reservation has been created." << endl;
}
void Operator::editReservation()
{
}
void Operator::deleteReservation()
{
}
void Operator::sendBikeToRepair()
{
}