diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp index 68ec663..71882ba 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/AdminMenu.cpp @@ -163,7 +163,13 @@ Return type: void void AdminMenu::handleNotificationEvent() { auto notifications = m_controller.getNotifications(); - displayNewNotification(notifications); + const User* authenticatedUser = m_controller.getAuthenticatedUser(); + std::string name; + if (authenticatedUser) + { + name = authenticatedUser->getName(); + } + displayNewNotification(notifications, name); } /* diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp index 3932fba..a9d7990 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp @@ -134,7 +134,13 @@ Return type: void void CustomerMenu::handleNotificationEvent() { auto notifications = m_controller.getNotifications(); - displayNewNotification(notifications); + const User* authenticatedUser = m_controller.getAuthenticatedUser(); + std::string name; + if (authenticatedUser) + { + name = authenticatedUser->getName(); + } + displayNewNotification(notifications, name); } /* diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/Menu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/Menu.cpp index 2573c0e..e5881ff 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/Menu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/Menu.cpp @@ -133,10 +133,16 @@ Return type: void void Menu::handleAccountDisabledEvent() { m_isMenuActive.store(false); + const User* authenticatedUser = m_controller.getAuthenticatedUser(); + std::string messageTitle = "Account Disabled"; + if (authenticatedUser) + { + messageTitle += " - " + authenticatedUser->getName(); + } MessageBoxA( GetConsoleWindow(), "Your account has been disabled.", - "Account Disabled", + messageTitle.c_str(), MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/MenuHelper.h b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/MenuHelper.h index 0d0f695..a92bead 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/MenuHelper.h +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/MenuHelper.h @@ -1415,9 +1415,10 @@ Description: Displays the most recent notification from the supplied notification collection. Parameter: util::Vector notifications - collection of notifications + const std::string& - The name of the user currently authenticated with the system Return type: void */ -inline void displayNewNotification(util::Vector notifications) +inline void displayNewNotification(util::Vector notifications, const std::string& name) { const Notification* notification = nullptr; size_t numberOfNotifications = notifications.getSize(); @@ -1435,10 +1436,18 @@ inline void displayNewNotification(util::Vector notificatio } } } - MessageBoxA( - GetConsoleWindow(), - notification->getMessage().c_str(), - notification->getTitle().c_str(), - MB_OK | - MB_ICONINFORMATION); + if (notification) + { + std::string messageTitle = notification->getTitle(); + if (!name.empty()) + { + messageTitle += " - " + name; + } + MessageBoxA( + GetConsoleWindow(), + notification->getMessage().c_str(), + messageTitle.c_str(), + MB_OK | + MB_ICONINFORMATION); + } } \ No newline at end of file diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp index 4b090d8..ee4576c 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/TechnicianMenu.cpp @@ -108,7 +108,13 @@ Return type: void void TechnicianMenu::handleNotificationEvent() { auto notifications = m_controller.getNotifications(); - displayNewNotification(notifications); + const User* authenticatedUser = m_controller.getAuthenticatedUser(); + std::string name; + if (authenticatedUser) + { + name = authenticatedUser->getName(); + } + displayNewNotification(notifications, name); } /*