diff options
Autocommit at 07.05.2022 @ 21:14
2 files changed, 29 insertions, 2 deletions
| -rw-r--r-- | src/Services/HallService.cpp | 4 | ||||
| -rw-r--r-- | src/UserInterface/VenueConsoleUI.cpp | 27 |
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(); } |
