Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dbc9abae6c | |||
| 9752a76cb2 | |||
| 505753cc77 | |||
| 384a9b05b1 | |||
| e054076175 | |||
| 329fc6e23f |
+1
-7
@@ -153,12 +153,9 @@
|
|||||||
<ClCompile Include="core\sharedmemory\SharedMemory.cpp">
|
<ClCompile Include="core\sharedmemory\SharedMemory.cpp">
|
||||||
<Filter>Source Files\Core\SharedMemory</Filter>
|
<Filter>Source Files\Core\SharedMemory</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="core\events\EventManager.cpp">
|
<ClCompile Include="EventManager.cpp">
|
||||||
<Filter>Source Files\Core\Events</Filter>
|
<Filter>Source Files\Core\Events</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="views\Menu.cpp">
|
|
||||||
<Filter>Source Files\Views</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="utilities\InputHelper.h">
|
<ClInclude Include="utilities\InputHelper.h">
|
||||||
@@ -290,8 +287,5 @@
|
|||||||
<ClInclude Include="core\events\EventManager.h">
|
<ClInclude Include="core\events\EventManager.h">
|
||||||
<Filter>Header Files\Core\Events</Filter>
|
<Filter>Header Files\Core\Events</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="views\Menu.h">
|
|
||||||
<Filter>Header Files\Views</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -623,14 +623,6 @@ void Controller::shutdown()
|
|||||||
dataStore.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)
|
void Controller::registerEvents(HANDLE accountDisabledEvent, HANDLE notificationAvailableEvent)
|
||||||
{
|
{
|
||||||
m_authenticationManagementService.registerEvents(accountDisabledEvent, notificationAvailableEvent);
|
m_authenticationManagementService.registerEvents(accountDisabledEvent, notificationAvailableEvent);
|
||||||
|
|||||||
+4
-10
@@ -8,6 +8,7 @@ Date:19-May-2026
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <iostream>
|
||||||
#include "AuthenticationManagementService.h"
|
#include "AuthenticationManagementService.h"
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "Utility.h"
|
#include "Utility.h"
|
||||||
@@ -51,6 +52,7 @@ bool AuthenticationManagementService::login(const std::string& username, const s
|
|||||||
},
|
},
|
||||||
[]()
|
[]()
|
||||||
{
|
{
|
||||||
|
HANDLE eventHandle = OpenEventA(EVENT_MODIFY_STATE, FALSE, "VehicleServiceSystem_NotificationAvailable");
|
||||||
if (m_notificationsAvailableEvent)
|
if (m_notificationsAvailableEvent)
|
||||||
{
|
{
|
||||||
SetEvent(m_notificationsAvailableEvent);
|
SetEvent(m_notificationsAvailableEvent);
|
||||||
@@ -115,16 +117,8 @@ void AuthenticationManagementService::changePassword(const std::string& newPassw
|
|||||||
m_dataStore.saveUsers();
|
m_dataStore.saveUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void AuthenticationManagementService::registerEvents(HANDLE accountDisabledEvent, HANDLE notifictionAvailableEvent)
|
||||||
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 notificationAvailableEvent)
|
|
||||||
{
|
{
|
||||||
m_accountDisabledEvent = accountDisabledEvent;
|
m_accountDisabledEvent = accountDisabledEvent;
|
||||||
m_notificationsAvailableEvent = notificationAvailableEvent;
|
m_notificationsAvailableEvent = notifictionAvailableEvent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,13 +153,6 @@ bool AdminMenu::handleOperation(int choice)
|
|||||||
return true;
|
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()
|
void AdminMenu::handleNotificationEvent()
|
||||||
{
|
{
|
||||||
auto notifications = m_controller.getNotifications();
|
auto notifications = m_controller.getNotifications();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Date:19-May-2026
|
|||||||
#include "Controller.h"
|
#include "Controller.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
|
||||||
class AdminMenu : public Menu
|
class AdminMenu : Menu
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool handleOperation(int choice);
|
bool handleOperation(int choice);
|
||||||
|
|||||||
@@ -124,13 +124,6 @@ bool CustomerMenu::handleOperation(int choice)
|
|||||||
return true;
|
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()
|
void CustomerMenu::handleNotificationEvent()
|
||||||
{
|
{
|
||||||
auto notifications = m_controller.getNotifications();
|
auto notifications = m_controller.getNotifications();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Date:19-May-2026
|
|||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "Controller.h"
|
#include "Controller.h"
|
||||||
|
|
||||||
class CustomerMenu : public Menu
|
class CustomerMenu : Menu
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool handleOperation(int choice);
|
bool handleOperation(int choice);
|
||||||
|
|||||||
@@ -1,21 +1,5 @@
|
|||||||
/*
|
|
||||||
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"
|
#include "Menu.h"
|
||||||
|
|
||||||
/*
|
|
||||||
Function: Menu
|
|
||||||
Description: Constructs a Menu object and initializes event handles
|
|
||||||
and menu state.
|
|
||||||
Parameter: None
|
|
||||||
Return type: None
|
|
||||||
*/
|
|
||||||
Menu::Menu()
|
Menu::Menu()
|
||||||
:
|
:
|
||||||
m_isMenuActive(false),
|
m_isMenuActive(false),
|
||||||
@@ -23,26 +7,11 @@ Menu::Menu()
|
|||||||
m_notificationAvailableEvent(NULL),
|
m_notificationAvailableEvent(NULL),
|
||||||
m_shutdownEvent(NULL) {}
|
m_shutdownEvent(NULL) {}
|
||||||
|
|
||||||
/*
|
|
||||||
Function: ~Menu
|
|
||||||
Description: Destroys the Menu object and performs event listener
|
|
||||||
cleanup.
|
|
||||||
Parameter: None
|
|
||||||
Return type: None
|
|
||||||
*/
|
|
||||||
Menu::~Menu()
|
Menu::~Menu()
|
||||||
{
|
{
|
||||||
stopEventListener();
|
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()
|
void Menu::startEventListener()
|
||||||
{
|
{
|
||||||
if (m_isMenuActive.load())
|
if (m_isMenuActive.load())
|
||||||
@@ -57,14 +26,6 @@ void Menu::startEventListener()
|
|||||||
m_eventListenerThread = std::thread(&Menu::eventListenerLoop, this);
|
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()
|
void Menu::eventListenerLoop()
|
||||||
{
|
{
|
||||||
HANDLE handles[3];
|
HANDLE handles[3];
|
||||||
@@ -88,13 +49,6 @@ 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()
|
void Menu::stopEventListener()
|
||||||
{
|
{
|
||||||
m_isMenuActive.store(false);
|
m_isMenuActive.store(false);
|
||||||
@@ -123,13 +77,6 @@ void Menu::stopEventListener()
|
|||||||
m_shutdownEvent = NULL;
|
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()
|
void Menu::handleAccountDisabledEvent()
|
||||||
{
|
{
|
||||||
m_isMenuActive.store(false);
|
m_isMenuActive.store(false);
|
||||||
|
|||||||
@@ -1409,14 +1409,6 @@ inline std::string selectComboPackage(util::Map<std::string, const ComboPackage*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Function: displayNewNotification
|
|
||||||
Description: Displays the most recent notification from the supplied
|
|
||||||
notification collection.
|
|
||||||
Parameter: util::Vector<const Notification*> notifications -
|
|
||||||
collection of notifications
|
|
||||||
Return type: void
|
|
||||||
*/
|
|
||||||
inline void displayNewNotification(util::Vector<const Notification*> notifications)
|
inline void displayNewNotification(util::Vector<const Notification*> notifications)
|
||||||
{
|
{
|
||||||
const Notification* notification = nullptr;
|
const Notification* notification = nullptr;
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ void TechnicianMenu::showMenu()
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
stopEventListener();
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
@@ -98,13 +99,6 @@ bool TechnicianMenu::handleOperation(int choice)
|
|||||||
return true;
|
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()
|
void TechnicianMenu::handleNotificationEvent()
|
||||||
{
|
{
|
||||||
auto notifications = m_controller.getNotifications();
|
auto notifications = m_controller.getNotifications();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Date:19-May-2026
|
|||||||
#include "Controller.h"
|
#include "Controller.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
|
||||||
class TechnicianMenu : public Menu
|
class TechnicianMenu : Menu
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool handleOperation(int choice);
|
bool handleOperation(int choice);
|
||||||
|
|||||||
Reference in New Issue
Block a user