Convert shared pointer to raw pointer
This commit is contained in:
@@ -52,3 +52,17 @@ void ZenvyController::changePassword(const std::string& password)
|
||||
{
|
||||
m_authenticationManagementService->changePassword(password);
|
||||
}
|
||||
|
||||
ZenvyController::~ZenvyController()
|
||||
{
|
||||
delete m_authenticationManagementService;
|
||||
delete m_attendanceManagementService;
|
||||
delete m_bookingManagementService;
|
||||
delete m_employeeManagememtService;
|
||||
delete m_leaveManagementService;
|
||||
delete m_notificationManagementService;
|
||||
delete m_payslipManagementService;
|
||||
delete m_talentAcquisitionManagementService;
|
||||
delete m_teamManagementService;
|
||||
delete m_ticketManagementService;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include "AuthenticationManagementService.h"
|
||||
#include "AttendanceManagementService.h"
|
||||
@@ -23,31 +22,30 @@
|
||||
class ZenvyController
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<AuthenticationManagementService> m_authenticationManagementService;
|
||||
std::shared_ptr<AttendanceManagementService> m_attendanceManagementService;
|
||||
std::shared_ptr<BookingManagementService> m_bookingManagementService;
|
||||
std::shared_ptr<EmployeeManagememtService> m_employeeManagememtService;
|
||||
std::shared_ptr<LeaveManagementService> m_leaveManagementService;
|
||||
std::shared_ptr<NotificationManagementService> m_notificationManagementService;
|
||||
std::shared_ptr<PayslipManagementService> m_payslipManagementService;
|
||||
std::shared_ptr<TalentAcquisitionManagementService> m_talentAcquisitionManagementService;
|
||||
std::shared_ptr<TeamManagementService> m_teamManagementService;
|
||||
std::shared_ptr<TicketManagementService> m_ticketManagementService;
|
||||
AuthenticationManagementService* m_authenticationManagementService;
|
||||
AttendanceManagementService* m_attendanceManagementService;
|
||||
BookingManagementService* m_bookingManagementService;
|
||||
EmployeeManagememtService* m_employeeManagememtService;
|
||||
LeaveManagementService* m_leaveManagementService;
|
||||
NotificationManagementService* m_notificationManagementService;
|
||||
PayslipManagementService* m_payslipManagementService;
|
||||
TalentAcquisitionManagementService* m_talentAcquisitionManagementService;
|
||||
TeamManagementService* m_teamManagementService;
|
||||
TicketManagementService* m_ticketManagementService;
|
||||
public:
|
||||
ZenvyController() :
|
||||
m_authenticationManagementService(std::make_shared<AuthenticationManagementService>()),
|
||||
m_attendanceManagementService(std::make_shared<AttendanceManagementService>()),
|
||||
m_bookingManagementService(std::make_shared<BookingManagementService>()),
|
||||
m_employeeManagememtService(std::make_shared<EmployeeManagememtService>()),
|
||||
m_leaveManagementService(std::make_shared<LeaveManagementService>()),
|
||||
m_notificationManagementService(std::make_shared<NotificationManagementService>()),
|
||||
m_payslipManagementService(std::make_shared<PayslipManagementService>()),
|
||||
m_talentAcquisitionManagementService(std::make_shared<TalentAcquisitionManagementService>()),
|
||||
m_teamManagementService(std::make_shared<TeamManagementService>()),
|
||||
m_ticketManagementService(std::make_shared<TicketManagementService>()) {};
|
||||
|
||||
//Authentication
|
||||
m_authenticationManagementService(new AuthenticationManagementService()),
|
||||
m_attendanceManagementService(new AttendanceManagementService()),
|
||||
m_bookingManagementService(new BookingManagementService()),
|
||||
m_employeeManagememtService(new EmployeeManagememtService()),
|
||||
m_leaveManagementService(new LeaveManagementService()),
|
||||
m_notificationManagementService(new NotificationManagementService()),
|
||||
m_payslipManagementService(new PayslipManagementService()),
|
||||
m_talentAcquisitionManagementService(new TalentAcquisitionManagementService()),
|
||||
m_teamManagementService(new TeamManagementService()),
|
||||
m_ticketManagementService(new TicketManagementService()) {};
|
||||
AuthenticationDTO login(const std::string& email, const std::string& password);
|
||||
void logout();
|
||||
void changePassword(const std::string&);
|
||||
~ZenvyController();
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ logMap& DataStore::getLogs()
|
||||
* std::shared_ptr<Employee>& - reference to the authenticated employee object.
|
||||
*/
|
||||
|
||||
std::shared_ptr<Employee>& DataStore::getAuthenticatedEmployee()
|
||||
Employee*& DataStore::getAuthenticatedEmployee()
|
||||
{
|
||||
return m_authenticatedEmployee;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ std::shared_ptr<Employee>& DataStore::getAuthenticatedEmployee()
|
||||
* void - no return value.
|
||||
*/
|
||||
|
||||
void DataStore::setAuthenticatedEmployee(std::shared_ptr<Employee> authenticatedEmployee)
|
||||
void DataStore::setAuthenticatedEmployee(Employee* authenticatedEmployee)
|
||||
{
|
||||
m_authenticatedEmployee = authenticatedEmployee;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ employeeMap& DataStore::getEmployees()
|
||||
* std::shared_ptr<Employee>& - reference to the authenticated employee object.
|
||||
*/
|
||||
|
||||
std::shared_ptr<Employee>& DataStore::getAuthenticatedUser()
|
||||
Employee* DataStore::getAuthenticatedUser()
|
||||
{
|
||||
return m_authenticatedEmployee;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include "Employee.h"
|
||||
#include "Log.h"
|
||||
@@ -26,13 +25,13 @@
|
||||
#include "Announcement.h"
|
||||
#include "Faq.h"
|
||||
|
||||
using employeeMap = std::map<std::string, std::shared_ptr<Employee>>;
|
||||
using logMap = std::map<util::Timestamp, std::shared_ptr<Log>>;
|
||||
using employeeMap = std::map<std::string,Employee*>;
|
||||
using logMap = std::map<util::Timestamp, Log*>;
|
||||
|
||||
class DataStore
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<Employee> m_authenticatedEmployee;
|
||||
Employee* m_authenticatedEmployee;
|
||||
employeeMap m_employees;
|
||||
logMap m_logs;
|
||||
DataStore() = default;
|
||||
@@ -43,8 +42,8 @@ public:
|
||||
DataStore(DataStore&&) = delete;
|
||||
DataStore& operator=(DataStore&&) = delete;
|
||||
employeeMap& getEmployees();
|
||||
std::shared_ptr<Employee>& getAuthenticatedUser();
|
||||
Employee* getAuthenticatedUser();
|
||||
logMap& getLogs();
|
||||
std::shared_ptr<Employee>& getAuthenticatedEmployee();
|
||||
void setAuthenticatedEmployee(std::shared_ptr < Employee>);
|
||||
Employee*& getAuthenticatedEmployee();
|
||||
void setAuthenticatedEmployee(Employee*);
|
||||
};
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
class Factory
|
||||
@@ -24,8 +23,8 @@ public:
|
||||
*/
|
||||
|
||||
template<typename T, typename... Args>
|
||||
static std::shared_ptr<T> getObject(Args&&... args)
|
||||
static T* getObject(Args&&... args)
|
||||
{
|
||||
return std::make_shared<T>(std::forward<Args>(args)...);
|
||||
return T*(std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ const std::string& Booking::getEmployeeId() const
|
||||
return m_employeeId;
|
||||
}
|
||||
|
||||
std::shared_ptr<Team> Booking::getTeam() const
|
||||
Team* Booking::getTeam() const
|
||||
{
|
||||
return m_team;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ void Booking::setEmployeeId(const std::string& employeeId)
|
||||
m_employeeId = employeeId;
|
||||
}
|
||||
|
||||
void Booking::setTeam(std::shared_ptr<Team> team)
|
||||
void Booking::setTeam(Team* team)
|
||||
{
|
||||
m_team = team;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include "Team.h"
|
||||
#include "Timestamp.h"
|
||||
|
||||
@@ -17,25 +16,24 @@ private:
|
||||
util::Timestamp m_startTime;
|
||||
util::Timestamp m_endTime;
|
||||
std::string m_employeeId;
|
||||
std::shared_ptr<Team> m_team;
|
||||
Team* m_team;
|
||||
public:
|
||||
Booking() : m_id(""), m_startTime(), m_endTime(), m_employeeId(""), m_team(nullptr) {}
|
||||
Booking() : m_id(""), m_startTime(), m_endTime(), m_employeeId(""), m_team(nullptr) {};
|
||||
Booking(const std::string& id,
|
||||
const util::Timestamp& startTime,
|
||||
const util::Timestamp& endTime,
|
||||
const std::string& employeeId,
|
||||
std::shared_ptr<Team> team)
|
||||
: m_id(id), m_startTime(startTime), m_endTime(endTime), m_employeeId(employeeId), m_team(team) {}
|
||||
Team* team) : m_id(id), m_startTime(startTime), m_endTime(endTime), m_employeeId(employeeId), m_team(team) {};
|
||||
const std::string& getBookingId() const;
|
||||
const util::Timestamp& getStartTime() const;
|
||||
const util::Timestamp& getEndTime() const;
|
||||
const std::string& getEmployeeId() const;
|
||||
std::shared_ptr<Team> getTeam() const;
|
||||
Team* getTeam() const;
|
||||
void setBookingId(const std::string& id);
|
||||
void setStartTime(const util::Timestamp& startTime);
|
||||
void setEndTime(const util::Timestamp& endTime);
|
||||
void setEmployeeId(const std::string& employeeId);
|
||||
void setTeam(std::shared_ptr<Team> team);
|
||||
void setTeam(Team* team);
|
||||
double getDurationInHours() const;
|
||||
double getDurationInMinutes() const;
|
||||
};
|
||||
@@ -46,7 +46,7 @@ const std::string& Employee::getEmployeeTeamId() const
|
||||
return m_teamId;
|
||||
}
|
||||
|
||||
std::shared_ptr<Payroll> Employee::getPayroll() const
|
||||
Payroll* Employee::getPayroll() const
|
||||
{
|
||||
return m_payroll;
|
||||
}
|
||||
@@ -101,12 +101,12 @@ void Employee::setEmployeeTeamId(const std::string& teamId)
|
||||
m_teamId = teamId;
|
||||
}
|
||||
|
||||
void Employee::setEmployeePayroll(std::shared_ptr<Payroll> payroll)
|
||||
void Employee::setEmployeePayroll(Payroll* payroll)
|
||||
{
|
||||
m_payroll = payroll;
|
||||
}
|
||||
|
||||
void Employee::addPayslip(std::shared_ptr<Payslip> payslip)
|
||||
void Employee::addPayslip(Payslip* payslip)
|
||||
{
|
||||
if (payslip)
|
||||
{
|
||||
@@ -114,7 +114,7 @@ void Employee::addPayslip(std::shared_ptr<Payslip> payslip)
|
||||
}
|
||||
}
|
||||
|
||||
void Employee::addAttendance(std::shared_ptr<Attendance> attendance)
|
||||
void Employee::addAttendance(Attendance* attendance)
|
||||
{
|
||||
if (attendance)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ void Employee::addAttendance(std::shared_ptr<Attendance> attendance)
|
||||
}
|
||||
}
|
||||
|
||||
void Employee::addLeave(std::shared_ptr<Leave> leave)
|
||||
void Employee::addLeave(Leave* leave)
|
||||
{
|
||||
if (leave)
|
||||
{
|
||||
|
||||
@@ -6,16 +6,15 @@
|
||||
*/
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include "Payslip.h"
|
||||
#include "Attendance.h"
|
||||
#include "Leave.h"
|
||||
#include "Payroll.h"
|
||||
#include "Enums.h"
|
||||
using payslipMap = std::map<std::string, std::shared_ptr<Payslip>>;
|
||||
using attendanceMap = std::map<int, std::map<std::string, std::shared_ptr<Attendance>>>;
|
||||
using leaveMap = std::map<std::string, std::shared_ptr<Leave>>;
|
||||
using payslipMap = std::map<std::string, Payslip*>;
|
||||
using attendanceMap = std::map<int, std::map<std::string, Attendance*>>;
|
||||
using leaveMap = std::map<std::string, Leave*>;
|
||||
|
||||
class Employee
|
||||
{
|
||||
@@ -28,7 +27,7 @@ private:
|
||||
Enums::AccountStatus m_accountStatus;
|
||||
Enums::TeamStatus m_teamStatus;
|
||||
std::string m_teamId;
|
||||
std::shared_ptr<Payroll> m_payroll;
|
||||
Payroll* m_payroll;
|
||||
payslipMap m_payslips;
|
||||
attendanceMap m_attendances;
|
||||
leaveMap m_leaves;
|
||||
@@ -42,7 +41,7 @@ public:
|
||||
const std::string& email,
|
||||
const std::string& teamId,
|
||||
Enums::EmployeeType employeeType,
|
||||
std::shared_ptr<Payroll> payroll)
|
||||
Payroll* payroll)
|
||||
: m_id(id), m_password(password), m_name(name), m_phone(phone), m_email(email), m_accountStatus(Enums::AccountStatus::ACTIVE), m_teamStatus(Enums::TeamStatus::NOT_IN_TEAM), m_teamId(teamId), m_employeeType(employeeType), m_payroll(payroll) { }
|
||||
const std::string& getEmployeeId() const;
|
||||
const std::string& getEmployeePassword() const;
|
||||
@@ -52,7 +51,7 @@ public:
|
||||
Enums::AccountStatus getEmployeeAccountStatus() const;
|
||||
Enums::TeamStatus getEmployeeTeamStatus() const;
|
||||
const std::string& getEmployeeTeamId() const;
|
||||
std::shared_ptr<Payroll> getPayroll() const;
|
||||
Payroll* getPayroll() const;
|
||||
const payslipMap& getEmployeePayslips() const;
|
||||
const attendanceMap& getEmployeeAttendances() const;
|
||||
const leaveMap& getEmployeeLeaves() const;
|
||||
@@ -63,10 +62,10 @@ public:
|
||||
void setEmployeeAccountStatus(Enums::AccountStatus status);
|
||||
void setEmployeeTeamStatus(Enums::TeamStatus status);
|
||||
void setEmployeeTeamId(const std::string& teamId);
|
||||
void setEmployeePayroll(std::shared_ptr<Payroll> payroll);
|
||||
void addPayslip(std::shared_ptr<Payslip> payslip);
|
||||
void addAttendance(std::shared_ptr<Attendance> attendance);
|
||||
void addLeave(std::shared_ptr<Leave> leave);
|
||||
void setEmployeePayroll(Payroll* payroll);
|
||||
void addPayslip(Payslip* payslip);
|
||||
void addAttendance(Attendance* attendance);
|
||||
void addLeave(Leave* leave);
|
||||
Enums::EmployeeType getEmployeeType() const;
|
||||
virtual ~Employee() = default;
|
||||
};
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
const std::string& phone,
|
||||
const std::string& email,
|
||||
const std::string& teamId,
|
||||
std::shared_ptr<Payroll> payroll,
|
||||
Payroll* payroll,
|
||||
Enums::EmployeeDesignation designation) : Employee(id, password, name, phone, email, teamId,Enums::EmployeeType::GENERAL, payroll), m_designation(designation) {}
|
||||
Enums::EmployeeDesignation getDesignation() const;
|
||||
void setDesignation(Enums::EmployeeDesignation designation);
|
||||
|
||||
@@ -11,7 +11,7 @@ File: JobListing.h
|
||||
#include <memory>
|
||||
#include "Candidate.h"
|
||||
#include "Enums.h"
|
||||
using candidateMap = std::map<std::string, std::shared_ptr<Candidate>>;
|
||||
using candidateMap = std::map<std::string, Candidate*>;
|
||||
|
||||
class JobListing
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ void Room::setRoomName(const std::string& name)
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
void Room::addBooking(std::shared_ptr<Booking> booking)
|
||||
void Room::addBooking(Booking* booking)
|
||||
{
|
||||
if (booking)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ File: Room.h
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include "Booking.h"
|
||||
using bookingMap = std::map<std::string, std::shared_ptr<Booking>>;
|
||||
using bookingMap = std::map<std::string, Booking*>;
|
||||
|
||||
class Room
|
||||
{
|
||||
@@ -26,5 +26,5 @@ public:
|
||||
const bookingMap& getBookings() const;
|
||||
void setRoomId(const std::string& id);
|
||||
void setRoomName(const std::string& name);
|
||||
void addBooking(std::shared_ptr<Booking> booking);
|
||||
void addBooking(Booking* booking);
|
||||
};
|
||||
@@ -18,7 +18,7 @@ const std::string& Team::getTeamName() const
|
||||
return m_name;
|
||||
}
|
||||
|
||||
std::shared_ptr<Employee> Team::getTeamLead() const
|
||||
Employee* Team::getTeamLead() const
|
||||
{
|
||||
return m_lead;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ void Team::setTeamName(const std::string& name)
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
void Team::setTeamLead(std::shared_ptr<Employee> lead)
|
||||
void Team::setTeamLead(Employee* lead)
|
||||
{
|
||||
m_lead = lead;
|
||||
}
|
||||
|
||||
@@ -10,32 +10,32 @@ File: Team.h
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include "Employee.h"
|
||||
using employeeMap = std::map<std::string, std::shared_ptr<Employee>>;
|
||||
using employeeMap = std::map<std::string, Employee*>;
|
||||
|
||||
class Team
|
||||
{
|
||||
private:
|
||||
std::string m_id;
|
||||
std::string m_name;
|
||||
std::shared_ptr<Employee> m_lead;
|
||||
Employee* m_lead;
|
||||
employeeMap m_employees;
|
||||
int m_maximumNumberOfEmployees;
|
||||
public:
|
||||
Team() : m_id(""), m_name(""), m_lead(nullptr), m_maximumNumberOfEmployees(0) {}
|
||||
Team(const std::string& id,
|
||||
const std::string& name,
|
||||
std::shared_ptr<Employee> lead,
|
||||
Employee* lead,
|
||||
int maximumNumberOfEmployees)
|
||||
: m_id(id), m_name(name), m_lead(lead), m_maximumNumberOfEmployees(maximumNumberOfEmployees) {
|
||||
}
|
||||
const std::string& getTeamId() const;
|
||||
const std::string& getTeamName() const;
|
||||
std::shared_ptr<Employee> getTeamLead() const;
|
||||
Employee* getTeamLead() const;
|
||||
const employeeMap& getEmployeesInTeam() const;
|
||||
int getMaximumNumberOfEmployeesInTeam() const;
|
||||
void setTeamId(const std::string& id);
|
||||
void setTeamName(const std::string& name);
|
||||
void setTeamLead(std::shared_ptr<Employee> lead);
|
||||
void setTeamLead(Employee* lead);
|
||||
void setEmployeesInTeam(const employeeMap& employees);
|
||||
void setMaximumNumberOfEmployeesInTeam(int maximumNumberOfEmployees);
|
||||
};
|
||||
@@ -43,7 +43,7 @@ AuthenticationDTO AuthenticationManagementService::login(const std::string& emai
|
||||
employeeType = employee.second->getEmployeeType();
|
||||
if (employeeType == Enums::EmployeeType::GENERAL)
|
||||
{
|
||||
std::shared_ptr<GeneralEmployee> generalEmployee = std::dynamic_pointer_cast<GeneralEmployee>(employee.second);
|
||||
GeneralEmployee* generalEmployee = dynamic_cast<GeneralEmployee*>(employee.second);
|
||||
if (generalEmployee)
|
||||
{
|
||||
employeeDesignation = generalEmployee->getDesignation();
|
||||
@@ -77,7 +77,7 @@ AuthenticationDTO AuthenticationManagementService::login(const std::string& emai
|
||||
*/
|
||||
void AuthenticationManagementService::changePassword(const std::string& password)
|
||||
{
|
||||
std::shared_ptr<Employee> authenticatedUser = m_dataStore.getAuthenticatedUser();
|
||||
Employee* authenticatedUser = m_dataStore.getAuthenticatedUser();
|
||||
if (authenticatedUser)
|
||||
{
|
||||
authenticatedUser->setEmployeePassword(password);
|
||||
@@ -99,10 +99,12 @@ void AuthenticationManagementService::changePassword(const std::string& password
|
||||
* runtime_error if no user is currently logged in
|
||||
*/
|
||||
void AuthenticationManagementService::logout() {
|
||||
if (m_dataStore.getAuthenticatedUser()) {
|
||||
m_dataStore.getAuthenticatedUser() = nullptr;
|
||||
if (m_dataStore.getAuthenticatedEmployee())
|
||||
{
|
||||
m_dataStore.getAuthenticatedEmployee() = nullptr;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("No user currently logged In...");
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@ void LogService::log(const std::string& message)
|
||||
{
|
||||
DataStore& dataStore = DataStore::getInstance();
|
||||
logMap& logs = dataStore.getLogs();
|
||||
std::shared_ptr<Log> log = Factory::getObject<Log>(message);
|
||||
Log* log = Factory::getObject<Log>(message);
|
||||
logs.emplace(std::make_pair(log->getTimestamp(), log));
|
||||
}
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include<memory>
|
||||
#include"ZenvyController.h"
|
||||
|
||||
class AdminMenu
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<ZenvyController> m_zenvyController;
|
||||
ZenvyController* m_zenvyController;
|
||||
public:
|
||||
AdminMenu() :m_zenvyController(std::make_shared<ZenvyController>()) {};
|
||||
AdminMenu() :m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include<memory>
|
||||
#include"ZenvyController.h"
|
||||
|
||||
class EmployeeMenu
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<ZenvyController> m_zenvyController;
|
||||
ZenvyController m_zenvyController;
|
||||
public:
|
||||
EmployeeMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
|
||||
EmployeeMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include<memory>
|
||||
#include"ZenvyController.h"
|
||||
|
||||
class FinanceExecutiveMenu
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<ZenvyController> m_zenvyController;
|
||||
ZenvyController* m_zenvyController;
|
||||
public:
|
||||
FinanceExecutiveMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
|
||||
FinanceExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include<memory>
|
||||
#include"ZenvyController.h"
|
||||
|
||||
class HRManagerMenu
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<ZenvyController> m_zenvyController;
|
||||
ZenvyController* m_zenvyController;
|
||||
public:
|
||||
HRManagerMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
|
||||
HRManagerMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include<memory>
|
||||
#include"ZenvyController.h"
|
||||
|
||||
class ITExecutiveMenu
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<ZenvyController> m_zenvyController;
|
||||
ZenvyController* m_zenvyController;
|
||||
public:
|
||||
ITExecutiveMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
|
||||
ITExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include<memory>
|
||||
#include"ZenvyController.h"
|
||||
|
||||
class TalentExecutiveMenu
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<ZenvyController> m_zenvyController;
|
||||
ZenvyController* m_zenvyController;
|
||||
public:
|
||||
TalentExecutiveMenu() : m_zenvyController(std::make_shared < ZenvyController>()) {};
|
||||
TalentExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include<memory>
|
||||
#include"ZenvyController.h"
|
||||
|
||||
class TeamExecutiveMenu
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<ZenvyController> m_zenvyController;
|
||||
ZenvyController* m_zenvyController;
|
||||
public:
|
||||
TeamExecutiveMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
|
||||
TeamExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include<memory>
|
||||
#include"ZenvyController.h"
|
||||
|
||||
class TeamLeadMenu
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<ZenvyController> m_zenvyController;
|
||||
ZenvyController* m_zenvyController;
|
||||
public:
|
||||
TeamLeadMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
|
||||
TeamLeadMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include "UserInterface.h"
|
||||
#include "AdminMenu.h"
|
||||
@@ -132,7 +131,6 @@ void UserInterface::login()
|
||||
}
|
||||
}
|
||||
util::clear();
|
||||
// Route to appropriate menu
|
||||
switch (employeeType)
|
||||
{
|
||||
case Enums::EmployeeType::ADMIN:
|
||||
@@ -192,3 +190,16 @@ void UserInterface::login()
|
||||
}
|
||||
m_controller->logout();
|
||||
}
|
||||
|
||||
UserInterface::~UserInterface()
|
||||
{
|
||||
delete m_controller;
|
||||
delete m_employeeMenu;
|
||||
delete m_adminMenu;
|
||||
delete m_financeExecutiveMenu;
|
||||
delete m_hrManagerMenu;
|
||||
delete m_itExecutiveMenu;
|
||||
delete m_talentExecutiveMenu;
|
||||
delete m_teamExecutiveMenu;
|
||||
delete m_teamLeadMenu;
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include "AdminMenu.h"
|
||||
#include "EmployeeMenu.h"
|
||||
@@ -21,27 +20,28 @@
|
||||
class UserInterface
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<ZenvyController> m_controller;
|
||||
std::shared_ptr<EmployeeMenu> m_employeeMenu;
|
||||
std::shared_ptr<AdminMenu> m_adminMenu;
|
||||
std::shared_ptr<FinanceExecutiveMenu> m_financeExecutiveMenu;
|
||||
std::shared_ptr<HRManagerMenu> m_hrManagerMenu;
|
||||
std::shared_ptr<ITExecutiveMenu> m_itExecutiveMenu;
|
||||
std::shared_ptr<TalentExecutiveMenu> m_talentExecutiveMenu;
|
||||
std::shared_ptr<TeamExecutiveMenu> m_teamExecutiveMenu;
|
||||
std::shared_ptr<TeamLeadMenu> m_teamLeadMenu;
|
||||
ZenvyController* m_controller;
|
||||
EmployeeMenu* m_employeeMenu;
|
||||
AdminMenu* m_adminMenu;
|
||||
FinanceExecutiveMenu* m_financeExecutiveMenu;
|
||||
HRManagerMenu* m_hrManagerMenu;
|
||||
ITExecutiveMenu* m_itExecutiveMenu;
|
||||
TalentExecutiveMenu* m_talentExecutiveMenu;
|
||||
TeamExecutiveMenu* m_teamExecutiveMenu;
|
||||
TeamLeadMenu* m_teamLeadMenu;
|
||||
public:
|
||||
UserInterface() : m_controller(std::make_shared<ZenvyController>()),
|
||||
m_employeeMenu(std::make_shared<EmployeeMenu>()),
|
||||
m_adminMenu(std::make_shared<AdminMenu>()),
|
||||
m_financeExecutiveMenu(std::make_shared<FinanceExecutiveMenu>()),
|
||||
m_hrManagerMenu(std::make_shared<HRManagerMenu>()),
|
||||
m_itExecutiveMenu(std::make_shared<ITExecutiveMenu>()),
|
||||
m_talentExecutiveMenu(std::make_shared<TalentExecutiveMenu>()),
|
||||
m_teamExecutiveMenu(std::make_shared<TeamExecutiveMenu>()),
|
||||
m_teamLeadMenu(std::make_shared<TeamLeadMenu>()) {};
|
||||
UserInterface() :
|
||||
m_controller(new ZenvyController()),
|
||||
m_employeeMenu(new EmployeeMenu()),
|
||||
m_adminMenu(new AdminMenu()),
|
||||
m_financeExecutiveMenu(new FinanceExecutiveMenu()),
|
||||
m_hrManagerMenu(new HRManagerMenu()),
|
||||
m_itExecutiveMenu(new ITExecutiveMenu()),
|
||||
m_talentExecutiveMenu(new TalentExecutiveMenu()),
|
||||
m_teamExecutiveMenu(new TeamExecutiveMenu()),
|
||||
m_teamLeadMenu(new TeamLeadMenu()) {};
|
||||
void run();
|
||||
bool handleOperation(int choice);
|
||||
void login();
|
||||
~UserInterface();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user