blob: 607f225751b1fa3d0d93d75c7998d5a1e542931d (
plain) (
blame)
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
|
#include "Event.h"
#include "StatusCodes.h"
Event::Event() : Event(nullptr, "", DateTime()) {}
Event::Event(const Hall* hall, String name, DateTime time) {
this->hall = hall;
this->name = name;
this->time = time;
}
StatusCode Event::reserveTicket(const Ticket& ticket, const char* password, const char* note) {
if (tickets.contain(ticket)) return E_TicketAlreadyBought;
if (reservations.contain(ticket)) return E_TicketAlreadyReserved;
reservations.insert(Reservation(ticket, password, note));
return Success;
}
StatusCode Event::cancelReservation(const Ticket& ticket) {
unsigned ind = reservations.findIndex(ticket);
if (ind == reservations.get_count())
return W_TicketWasNotReserved;
reservations.removeAt(ind);
return Success;
}
|