Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit7ebafd399b62e7138a358cb062767f47f0d03a31 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 21:14:38 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 21:14:38 +0300
Files06bfbbb3917489cfc250a0dd0761acc105d91e50 /src
FMI-OOP-P1_TicketSystem-7ebafd399b62e7138a358cb062767f47f0d03a31.tar
FMI-OOP-P1_TicketSystem-7ebafd399b62e7138a358cb062767f47f0d03a31.tar.gz
FMI-OOP-P1_TicketSystem-7ebafd399b62e7138a358cb062767f47f0d03a31.zip
Parentb1a5dab44e70642e3bb43dacfa6968afa01e0a09 (diff)
Autocommit at 07.05.2022 @ 21:14
2 files changed, 29 insertions, 2 deletions
-rw-r--r--src/Services/HallService.cpp4
-rw-r--r--src/UserInterface/VenueConsoleUI.cpp27
diff --git a/src/Services/HallService.cpp b/src/Services/HallService.cpp
index 02bf040..b85746e 100644
--- a/src/Services/HallService.cpp
+++ b/src/Services/HallService.cpp
@@ -14,7 +14,7 @@ StatusCode HallService::load() {
if (!inFile.is_open())
return E_FileCouldNotBeOpened;
- events.read(inFile);
+ halls.read(inFile);
inFile.close();
return Success;
}
@@ -24,7 +24,7 @@ StatusCode HallService::save() {
if (!outFile.is_open())
return E_FileCouldNotBeOpened;
- events.write(outFile);
+ halls.write(outFile);
outFile.close();
return Success;
}
diff --git a/src/UserInterface/VenueConsoleUI.cpp b/src/UserInterface/VenueConsoleUI.cpp
index 062a4fb..8a1b18f 100644
--- a/src/UserInterface/VenueConsoleUI.cpp
+++ b/src/UserInterface/VenueConsoleUI.cpp
@@ -185,6 +185,31 @@ void submenu_reportManagement() {
/* Main */
+void load() {
+ StatusCode s = es->load();
+ if (s == E_FileCouldNotBeOpened) {
+ errorBox("Could not load events from file!");
+ pressEnterToContinue();
+ }
+ s = hs->load();
+ if (s == E_FileCouldNotBeOpened) {
+ errorBox("Could not load halls from file!");
+ pressEnterToContinue();
+ }
+}
+
+void save() {
+ StatusCode s = es->save();
+ if (s == E_FileCouldNotBeOpened) {
+ errorBox("Could not save events to file!");
+ pressEnterToContinue();
+ }
+ s = hs->save();
+ if (s == E_FileCouldNotBeOpened) {
+ errorBox("Could not save halls to file!");
+ pressEnterToContinue();
+ }
+}
void init() {
mainMenu.addCommand(Command("Ticket Management", submenu_ticketManagement));
@@ -208,6 +233,8 @@ void init() {
void runUI(EventService* eventService, HallService* hallService) {
es = eventService;
hs = hallService;
+ load();
init();
mainMenu.navigate();
+ save();
}