diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp index 579243c..d892e36 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/controllers/Controller.cpp @@ -623,6 +623,14 @@ void Controller::shutdown() dataStore.shutdown(); } +/* +Function: registerEvents +Description: Registers menu event handles with the authentication + service. +Parameter: HANDLE accountDisabledEvent - account disabled event handle + HANDLE notificationAvailableEvent - notification event handle +Return type: void +*/ void Controller::registerEvents(HANDLE accountDisabledEvent, HANDLE notificationAvailableEvent) { m_authenticationManagementService.registerEvents(accountDisabledEvent, notificationAvailableEvent); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp index 3a28261..40238d8 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/AuthenticationManagementService.cpp @@ -117,6 +117,14 @@ void AuthenticationManagementService::changePassword(const std::string& newPassw m_dataStore.saveUsers(); } +/* +Function: registerEvents +Description: Registers menu event handles used to notify the active + menu of account disable and notification events. +Parameter: HANDLE accountDisabledEvent - account disabled event handle + HANDLE notificationAvailableEvent - notification event handle +Return type: void +*/ void AuthenticationManagementService::registerEvents(HANDLE accountDisabledEvent, HANDLE notifictionAvailableEvent) { m_accountDisabledEvent = accountDisabledEvent; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp index 3dfd581..68ec663 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp @@ -153,6 +153,13 @@ bool AdminMenu::handleOperation(int choice) return true; } +/* +Function: handleNotificationEvent +Description: Retrieves and displays the latest notification for the + currently logged in admin. +Parameter: None +Return type: void +*/ void AdminMenu::handleNotificationEvent() { auto notifications = m_controller.getNotifications(); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h index ee91a70..f9aa415 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.h @@ -11,7 +11,7 @@ Date:19-May-2026 #include "Controller.h" #include "Menu.h" -class AdminMenu : Menu +class AdminMenu : public Menu { private: bool handleOperation(int choice); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp index c8094a8..3932fba 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp @@ -124,6 +124,13 @@ bool CustomerMenu::handleOperation(int choice) return true; } +/* +Function: handleNotificationEvent +Description: Retrieves and displays the latest notification for the + currently logged in admin. +Parameter: None +Return type: void +*/ void CustomerMenu::handleNotificationEvent() { auto notifications = m_controller.getNotifications(); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.h index caa1dfd..c619107 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.h +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.h @@ -12,7 +12,7 @@ Date:19-May-2026 #include "Menu.h" #include "Controller.h" -class CustomerMenu : Menu +class CustomerMenu : public Menu { private: bool handleOperation(int choice); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/Menu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/Menu.cpp index c8a4c19..2573c0e 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/Menu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/Menu.cpp @@ -1,5 +1,21 @@ +/* +File: Menu.cpp +Description: Implementation file containing common menu event listener + functionality, account disable handling, and notification + event dispatching for all menu types. +Author: Trenser +Date:16-Jun-2026 +*/ + #include "Menu.h" +/* +Function: Menu +Description: Constructs a Menu object and initializes event handles + and menu state. +Parameter: None +Return type: None +*/ Menu::Menu() : m_isMenuActive(false), @@ -7,11 +23,26 @@ Menu::Menu() m_notificationAvailableEvent(NULL), m_shutdownEvent(NULL) {} +/* +Function: ~Menu +Description: Destroys the Menu object and performs event listener + cleanup. +Parameter: None +Return type: None +*/ Menu::~Menu() { stopEventListener(); } +/* +Function: startEventListener +Description: Creates menu event handles, registers them with the + authentication service, and starts the event listener + thread. +Parameter: None +Return type: void +*/ void Menu::startEventListener() { if (m_isMenuActive.load()) @@ -26,6 +57,14 @@ void Menu::startEventListener() m_eventListenerThread = std::thread(&Menu::eventListenerLoop, this); } +/* +Function: eventListenerLoop +Description: Waits for account disabled, notification available, + and shutdown events and dispatches them to the + appropriate handlers. +Parameter: None +Return type: void +*/ void Menu::eventListenerLoop() { HANDLE handles[3]; @@ -49,6 +88,13 @@ void Menu::eventListenerLoop() } } +/* +Function: stopEventListener +Description: Stops the event listener thread and releases all + associated event handles. +Parameter: None +Return type: void +*/ void Menu::stopEventListener() { m_isMenuActive.store(false); @@ -77,6 +123,13 @@ void Menu::stopEventListener() m_shutdownEvent = NULL; } +/* +Function: handleAccountDisabledEvent +Description: Handles an account disabled event by marking the menu + inactive and notifying the user. +Parameter: None +Return type: void +*/ void Menu::handleAccountDisabledEvent() { m_isMenuActive.store(false); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/MenuHelper.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/MenuHelper.h index 15a1ae4..0d0f695 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/MenuHelper.h +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/MenuHelper.h @@ -1409,6 +1409,14 @@ inline std::string selectComboPackage(util::Map notifications - + collection of notifications +Return type: void +*/ inline void displayNewNotification(util::Vector notifications) { const Notification* notification = nullptr; diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp index 07b1461..2bd0d0f 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp @@ -99,6 +99,13 @@ bool TechnicianMenu::handleOperation(int choice) return true; } +/* +Function: handleNotificationEvent +Description: Retrieves and displays the latest notification for the + currently logged in admin. +Parameter: None +Return type: void +*/ void TechnicianMenu::handleNotificationEvent() { auto notifications = m_controller.getNotifications(); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.h index 9ba36e9..b00c1f3 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.h +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.h @@ -11,7 +11,7 @@ Date:19-May-2026 #include "Controller.h" #include "Menu.h" -class TechnicianMenu : Menu +class TechnicianMenu : public Menu { private: bool handleOperation(int choice);