Minor fixes and formatting updates in payroll, enums, and menus
<SRS> SRS02 : Employee Management </SRS> <Changes> - Fixed variable naming issue in Payroll deserialization - Added braces for consistency in enum string-to-value helpers - Improved readability in validation logic - Corrected typo in Finance Executive payroll menu text </Changes> <Review> Smitha Mohan </Review>
This commit is contained in:
@@ -109,11 +109,11 @@ std::string Payroll::serialize() const
|
||||
std::shared_ptr<Payroll> Payroll::deserialize(const std::string& record)
|
||||
{
|
||||
std::string id, employeeId;
|
||||
std::string basicSalaryStr, houseRentAllowanceString, foodAllowanceString, employeePFString, employerPFString;
|
||||
std::string basicSalaryString, houseRentAllowanceString, foodAllowanceString, employeePFString, employerPFString;
|
||||
std::istringstream serializedPayroll(record);
|
||||
std::getline(serializedPayroll, id, ',');
|
||||
std::getline(serializedPayroll, employeeId, ',');
|
||||
std::getline(serializedPayroll, basicSalaryStr, ',');
|
||||
std::getline(serializedPayroll, basicSalaryString, ',');
|
||||
std::getline(serializedPayroll, houseRentAllowanceString, ',');
|
||||
std::getline(serializedPayroll, foodAllowanceString, ',');
|
||||
std::getline(serializedPayroll, employeePFString, ',');
|
||||
@@ -121,7 +121,7 @@ std::shared_ptr<Payroll> Payroll::deserialize(const std::string& record)
|
||||
|
||||
try
|
||||
{
|
||||
double basicSalary = std::stod(basicSalaryStr);
|
||||
double basicSalary = std::stod(basicSalaryString);
|
||||
double houseRentAllowance = std::stod(houseRentAllowanceString);
|
||||
double foodAllowance = std::stod(foodAllowanceString);
|
||||
double employeePFContribution = std::stod(employeePFString);
|
||||
|
||||
@@ -162,48 +162,76 @@ namespace Enums {
|
||||
inline AccountStatus getAccountStatus(const std::string& input)
|
||||
{
|
||||
if (input == "ACTIVE")
|
||||
{
|
||||
return AccountStatus::ACTIVE;
|
||||
}
|
||||
if (input == "INACTIVE")
|
||||
{
|
||||
return AccountStatus::INACTIVE;
|
||||
}
|
||||
return AccountStatus::INACTIVE;
|
||||
}
|
||||
|
||||
inline EmployeeType getEmployeeType(const std::string& input)
|
||||
{
|
||||
if (input == "GENERAL")
|
||||
{
|
||||
return EmployeeType::GENERAL;
|
||||
}
|
||||
if (input == "IT")
|
||||
{
|
||||
return EmployeeType::IT;
|
||||
}
|
||||
if (input == "FINANCE")
|
||||
{
|
||||
return EmployeeType::FINANCE;
|
||||
}
|
||||
if (input == "TALENT_ACQUISITION")
|
||||
{
|
||||
return EmployeeType::TALENT_ACQUISITION;
|
||||
}
|
||||
if (input == "HR")
|
||||
{
|
||||
return EmployeeType::HR;
|
||||
}
|
||||
if (input == "TEAM")
|
||||
{
|
||||
return EmployeeType::TEAM;
|
||||
}
|
||||
if (input == "ADMIN")
|
||||
{
|
||||
return EmployeeType::ADMIN;
|
||||
}
|
||||
return EmployeeType::INVALID;
|
||||
}
|
||||
|
||||
inline TeamStatus getTeamStatus(const std::string& str)
|
||||
{
|
||||
if (str == "IN_TEAM")
|
||||
{
|
||||
return TeamStatus::IN_TEAM;
|
||||
}
|
||||
if (str == "NOT_IN_TEAM")
|
||||
{
|
||||
return TeamStatus::NOT_IN_TEAM;
|
||||
}
|
||||
return TeamStatus::NOT_IN_TEAM;
|
||||
}
|
||||
|
||||
inline EmployeeDesignation getEmployeeDesignation(const std::string& input)
|
||||
{
|
||||
if (input == "JUNIOR")
|
||||
{
|
||||
return EmployeeDesignation::JUNIOR;
|
||||
}
|
||||
if (input == "SENIOR")
|
||||
{
|
||||
return EmployeeDesignation::SENIOR;
|
||||
}
|
||||
if (input == "TEAM_LEAD")
|
||||
{
|
||||
return EmployeeDesignation::TEAM_LEAD;
|
||||
}
|
||||
return EmployeeDesignation::INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,10 @@ bool util::isPhoneNumberValid(const std::string& phoneNumber) {
|
||||
|
||||
bool util::isEmailValid(const std::string& email) {
|
||||
size_t index = email.find('@');
|
||||
if (index == std::string::npos) return false;
|
||||
if (index == std::string::npos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (email.find('@', index + 1) != std::string::npos)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -43,7 +43,7 @@ void FinanceExecutiveMenu::updatePayroll()
|
||||
util::read(foodAllowance);
|
||||
std::cout << "Enter the New EmployeePFContribution: ";
|
||||
util::read(employeePFContribution);
|
||||
std::cout << "Enter the New EmplyerPFContribution: ";
|
||||
std::cout << "Enter the New EmployerPFContribution: ";
|
||||
util::read(employerPFContribution);
|
||||
m_zenvyController->updateSalary(employeeId, basicSalary, houseRentAllowance, foodAllowance, employeePFContribution, employerPFContribution);
|
||||
std::cout << "Payroll Updated";
|
||||
|
||||
Reference in New Issue
Block a user