From 44760d813cec1af2adcce9ccd01fdc01d677c589 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 7 May 2022 15:48:31 +0300 Subject: Autocommit at 07.05.2022 @ 15:48 --- src/Services/EventService.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Services/EventService.cpp') diff --git a/src/Services/EventService.cpp b/src/Services/EventService.cpp index 3eec0b5..3c3b668 100644 --- a/src/Services/EventService.cpp +++ b/src/Services/EventService.cpp @@ -157,3 +157,24 @@ String EventService::createSeatingString(const char* name, const Date& date, uns out[seatsCount * rowCount] = '\0'; return out; } + +bool cond_event_all(const Event& e1, const Event& e2) { + return true; +} + +bool cond_event_name(const Event& e1, const Event& e2) { + return e1.get_name().compare(e2.get_name()) == 0; +} + +bool cond_event_date(const Event& e1, const Event& e2) { + return e1.get_date().compare(e2.get_date()) == 0; +} + +StatusCode EventService::reportReservations(const char* name, const Date& date) { + List result; + bool (*cond_name)(const Event&, const Event&) = cond_event_name; + bool (*cond_date)(const Event&, const Event&) = cond_event_date; + + if (strcmp(name, "ALL") == 0) cond_name = cond_event_all; + if (date.compare(Date(0, 0, 0)) == 0) cond_date = cond_event_all; +} -- cgit v1.3.1-23-gd82d