Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Services / EventService.cpp
diff options
context:
space:
mode:
Commit7f87c0ba3838ddda550117c4bc74f46b7b0d94dc (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 09:12:02 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 09:12:02 +0300
Files18c10ea692da753259d2ef827413293ad7b2380e /src/Services/EventService.cpp
FMI-OOP-P1_TicketSystem-7f87c0ba3838ddda550117c4bc74f46b7b0d94dc.tar
FMI-OOP-P1_TicketSystem-7f87c0ba3838ddda550117c4bc74f46b7b0d94dc.tar.gz
FMI-OOP-P1_TicketSystem-7f87c0ba3838ddda550117c4bc74f46b7b0d94dc.zip
Parentdc13118c73b1fe6b54892c5e0584a97707e12b2d (diff)
Autocommit at 07.05.2022 @ 09:12
1 files changed, 19 insertions, 19 deletions
-rw-r--r--src/Services/EventService.cpp38
diff --git a/src/Services/EventService.cpp b/src/Services/EventService.cpp
index 95bd1c4..ec474a9 100644
--- a/src/Services/EventService.cpp
+++ b/src/Services/EventService.cpp
@@ -1,13 +1,13 @@
-#include "EventSystem.h"
+#include "EventService.h"
#include "StatusCodes.h"
/* Private */
-void EventSystem::updateSoonestUpcoming() {
+void EventService::updateSoonestUpcoming() {
}
-unsigned EventSystem::indexOfEvent(const Date& date) {
+unsigned EventService::indexOfEvent(const Date& date) {
// TODO: make binary search
for (unsigned i = indSoonestUpcoming; i < events.get_count(); i++) {
if (events[i].get_date().compare(date) == 0)
@@ -16,7 +16,7 @@ unsigned EventSystem::indexOfEvent(const Date& date) {
return events.get_count();
}
-unsigned EventSystem::indexOfEvent(const char* name, const Date& date) {
+unsigned EventService::indexOfEvent(const char* name, const Date& date) {
unsigned ind = indexOfEvent(date);
if (ind < events.get_count() && events[ind].get_name().compare(name) == 0)
return ind;
@@ -25,18 +25,18 @@ unsigned EventSystem::indexOfEvent(const char* name, const Date& date) {
/* Public */
-EventSystem::EventSystem() {
+EventService::EventService() {
events = OrderedList<Event>();
indSoonestUpcoming = 0;
}
-EventSystem::EventSystem(const Event* events, unsigned eventCount) {
+EventService::EventService(const Event* events, unsigned eventCount) {
this->events = OrderedList<Event>(events, eventCount);
indSoonestUpcoming = 0;
updateSoonestUpcoming();
}
-StatusCode EventSystem::createEvent(const Hall* hall, String name, Date date) {
+StatusCode EventService::createEvent(const Hall* hall, String name, Date date) {
if (indexOfEvent(date) < events.get_count())
return E_EventWillOverlap;
@@ -44,7 +44,7 @@ StatusCode EventSystem::createEvent(const Hall* hall, String name, Date date) {
return Success;
}
-StatusCode EventSystem::cancelEvent(const char* name, const Date& date) {
+StatusCode EventService::cancelEvent(const char* name, const Date& date) {
unsigned ind = indexOfEvent(name, date);
if (ind == events.get_count())
return E_EventDoesNotExist;
@@ -53,11 +53,11 @@ StatusCode EventSystem::cancelEvent(const char* name, const Date& date) {
return Success;
}
-StatusCode EventSystem::reserveTicket(const char* name, const Date& date, const char* password, const char* note, unsigned seatRow, unsigned seatColumn) {
+StatusCode EventService::reserveTicket(const char* name, const Date& date, const char* password, const char* note, unsigned seatRow, unsigned seatColumn) {
return reserveTicket(name, date, password, note, Ticket(seatRow, seatColumn));
}
-StatusCode EventSystem::reserveTicket(const char* name, const Date& date, const char* password, const char* note, const Ticket& ticket) {
+StatusCode EventService::reserveTicket(const char* name, const Date& date, const char* password, const char* note, const Ticket& ticket) {
unsigned ind = indexOfEvent(name, date);
if (ind == events.get_count())
return E_EventDoesNotExist;
@@ -65,11 +65,11 @@ StatusCode EventSystem::reserveTicket(const char* name, const Date& date, const
return events[ind].reserveTicket(ticket, password, note);
}
-StatusCode EventSystem::cancelTicketReservation(const char* name, const Date& date, unsigned seatRow, unsigned seatColumn) {
+StatusCode EventService::cancelTicketReservation(const char* name, const Date& date, unsigned seatRow, unsigned seatColumn) {
return cancelTicketReservation(name, date, Ticket(seatRow, seatColumn));
}
-StatusCode EventSystem::cancelTicketReservation(const char* name, const Date& date, const Ticket& ticket) {
+StatusCode EventService::cancelTicketReservation(const char* name, const Date& date, const Ticket& ticket) {
unsigned ind = indexOfEvent(name, date);
if (ind == events.get_count())
return E_EventDoesNotExist;
@@ -77,11 +77,11 @@ StatusCode EventSystem::cancelTicketReservation(const char* name, const Date& da
return events[ind].cancelReservation(ticket);
}
-StatusCode EventSystem::buyTicket(const char* name, const Date& date, unsigned row, unsigned seat) {
+StatusCode EventService::buyTicket(const char* name, const Date& date, unsigned row, unsigned seat) {
return buyTicket(name, date, Ticket(row, seat));
}
-StatusCode EventSystem::buyTicket(const char* name, const Date& date, const Ticket& ticket) {
+StatusCode EventService::buyTicket(const char* name, const Date& date, const Ticket& ticket) {
unsigned ind = indexOfEvent(name, date);
if (ind == events.get_count())
return E_EventDoesNotExist;
@@ -89,11 +89,11 @@ StatusCode EventSystem::buyTicket(const char* name, const Date& date, const Tick
return events[ind].buyTicket(ticket);
}
-StatusCode EventSystem::buyTicket(const char* name, const Date& date, unsigned row, unsigned seat, const char* password) {
+StatusCode EventService::buyTicket(const char* name, const Date& date, unsigned row, unsigned seat, const char* password) {
return buyTicket(name, date, Ticket(row, seat), password);
}
-StatusCode EventSystem::buyTicket(const char* name, const Date& date, const Ticket& ticket, const char* password) {
+StatusCode EventService::buyTicket(const char* name, const Date& date, const Ticket& ticket, const char* password) {
unsigned ind = indexOfEvent(name, date);
if (ind == events.get_count())
return E_EventDoesNotExist;
@@ -102,7 +102,7 @@ StatusCode EventSystem::buyTicket(const char* name, const Date& date, const Tick
}
-const Hall* EventSystem::queryEventHall(const char* name, const Date& date) {
+const Hall* EventService::queryEventHall(const char* name, const Date& date) {
unsigned ind = indexOfEvent(name, date);
if (ind == events.get_count())
return nullptr;
@@ -110,7 +110,7 @@ const Hall* EventSystem::queryEventHall(const char* name, const Date& date) {
return &events[ind].get_hall();
}
-OrderedList<Ticket> EventSystem::queryTickets(const char* name, const Date& date) {
+OrderedList<Ticket> EventService::queryTickets(const char* name, const Date& date) {
unsigned ind = indexOfEvent(name, date);
if (ind == events.get_count())
return OrderedList<Ticket>();
@@ -118,7 +118,7 @@ OrderedList<Ticket> EventSystem::queryTickets(const char* name, const Date& date
return events[ind].get_tickets();
}
-OrderedList<Reservation> EventSystem::queryReservations(const char* name, const Date& date) {
+OrderedList<Reservation> EventService::queryReservations(const char* name, const Date& date) {
unsigned ind = indexOfEvent(name, date);
if (ind == events.get_count())
return OrderedList<Reservation>();