Added employee persistence, serialization, and file loading support

<SRS>SRS02 : Employee Management </SRS>

<Changes>
 - Implemented serialization and deserialization for Employee and GeneralEmployee models
 - Added FileManager integration to load employees from CSV files
 - Introduced ApplicationConfig entries for employee file paths
 - Updated Employee ID handling (getEmployeeId → getId) across project
 - Modified FileIO to auto-create file if not found instead of throwing exception
 - Added constructors for all employee types to support deserialization
 - Implemented loadEmployees in service and loadStates in controller
 - Ensured default admin creation if none exists during load
 - Added StringHelper utility for extracting numeric IDs
 - Extended Enums with string conversion and parsing utilities
 - Added initial CSV files for Employee and GeneralEmployee data
 - Improved login error message formatting and minor cleanup
 - Setup gitignore to not track csv files
</Changes>
This commit is contained in:
2026-04-10 13:17:50 +05:30
parent d29e38ef75
commit 451ed4fec2
26 changed files with 549 additions and 23 deletions
@@ -49,7 +49,7 @@ std::string FinanceExecutiveMenu::getSelectedUserId()
for (const auto& employee : employeeList)
{
std::cout << std::left << std::setw(6) << employee.first
<< std::setw(15) << employee.second->getEmployeeId()
<< std::setw(15) << employee.second->getId()
<< std::setw(25) << employee.second->getEmployeeName()
<< std::endl;
}
@@ -58,7 +58,7 @@ std::string FinanceExecutiveMenu::getSelectedUserId()
auto employeeIterator = employeeList.find(choice);
if (employeeIterator != employeeList.end())
{
return (employeeIterator->second->getEmployeeId());
return (employeeIterator->second->getId());
}
else
{
@@ -63,7 +63,7 @@ inline std::map<int, std::shared_ptr<const Employee>> listEmployees(const std::s
{
std::cout << std::left
<< std::setw(5) << index
<< std::setw(15) << activeEmployees->getEmployeeId()
<< std::setw(15) << activeEmployees->getId()
<< std::setw(25) << activeEmployees->getEmployeeName()
<< "\n";
employeeList[index] = activeEmployees;
@@ -90,7 +90,7 @@ inline void deactivateEmployee(const std::shared_ptr<ZenvyController>& controlle
auto iterator = employeeList.find(choice);
if (iterator != employeeList.end())
{
std::string id = iterator->second->getEmployeeId();
std::string id = iterator->second->getId();
bool success = controller->deactivateEmployee(id);
if (success)
{
@@ -19,6 +19,15 @@
void UserInterface::run()
{
bool isMenuActive = true;
try
{
m_controller->loadStates();
}
catch (const std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
return;
}
while (isMenuActive)
{
try
@@ -94,7 +103,7 @@ void UserInterface::login()
}
else
{
std::cout << "\nInvalid Password";
std::cout << "Error: Invalid Password\n";
util::pressEnter();
return;
}