104 Commits

Author SHA1 Message Date
joelthomastrenser 5f5e056dc2 Merge branch 'develop' into feature 2026-04-17 14:35:36 +05:30
joelthomastrenser 3756ea761e Merged PR 976: SRS02 : Employee Management
Related work items: #939, #943, #946, #947, #948, #949, #951, #952, #953, #954, #955, #956, #957
2026-04-17 13:51:31 +05:30
joelthomastrenser 1e6fc4e7bd Merged PR 952: SRS01 Authentication
Implemented Authentication Logic

Related work items: #930, #932, #933, #935, #936
2026-04-17 13:28:49 +05:30
joelthomastrenser 2895343045 Merged PR 975: Convert smart pointers to native pointers 2026-04-17 12:32:00 +05:30
Jissin Sam Mathew 8fd0366a35 Add headers to the views and remove Leave static members 2026-04-17 12:29:54 +05:30
Ajmal Jalaludeen 7d75f97832 Add function headers to Service Layers 2026-04-17 12:01:48 +05:30
Princy Jerin 6496fcbc85 Add function headers to models 2026-04-17 10:37:55 +05:30
joelthomastrenser a8d50c29f8 Add function headers in Controller, DataStore, and Utilities 2026-04-17 10:27:59 +05:30
Tinu Johnson a0c499d78f Add function headers in models 2026-04-17 10:26:33 +05:30
joelthomastrenser 133785dd3f refactor: change memory management and fix related code
- Switched shared_ptr to raw pointers
- Added cleanup logic in DataStore
- Fixed Factory object creation
- Updated function signatures to match changes
- Small refactors and formatting fixes
2026-04-17 09:36:34 +05:30
Princy Jerin 703cea447e Change shared pointers to raw pointers in model classes 2026-04-16 18:12:04 +05:30
Ajmal Jalaludeen c7b9d7bcd5 Changed shared pointers to raw pointers in PayslipManagementService.h and PayslipManagementService.cpp 2026-04-16 18:07:19 +05:30
Jissin Sam Mathew 138901b8e9 Changed Shared Pointers to raw pointers in the service classes 2026-04-16 18:05:49 +05:30
Tinu Johnson 6a373b48df Change shared pointer to raw pointer in views 2026-04-16 18:02:07 +05:30
joelthomastrenser 9e05bac97c Merge branch 'feature' into feature-employee-management-native-pointers 2026-04-16 17:16:31 +05:30
Jissin Sam Mathew b6ba8ef508 Review Fix: Handle Empty Payslip History
<SRS> SRS02: Employee Management </SRS>

<Changes>
 - Enhanced viewPayslipHistory() in MenuHelper.h to handle empty payslip scenarios.
 - Displayed "No Payslips Generated" message when no records exist.
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-16 15:39:36 +05:30
joelthomastrenser 92cec0521e Fix payslip option call in employee menu
<SRS> SRS02 : Payroll and Payslip Management </SRS>

<Changes>
 - Updated payslip option to use viewPayslip helper
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-16 15:24:55 +05:30
Jissin Mathew 435426c435 Merged PR 968: UserStory EMP011 View Payslip History
Related work items: #956
2026-04-16 14:55:33 +05:30
joelthomastrenser f29e8e2e90 Merge branch 'feature-employee-management' into feature-employee-management-emp011 2026-04-16 14:53:53 +05:30
Jissin Sam Mathew 0af64c140b Implement Review Fixes
<UserStory> EMP011 : View Payslip History </UserStory>

<Changes>
 - Removed getPayslips() method from ZenvyController and PayslipManagementService as part of review cleanup.
 - Reformatted Enums::getMonthString() and Enums::getMonth() functions for consistent indentation and readability.
 - Ensured switch-case blocks in Enums.h follow proper alignment and coding standards.
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-16 14:31:35 +05:30
Princy Jerin a5b95d29b5 Merged PR 966: UserStory EMP010 View Payslip
Related work items: #955
2026-04-16 14:11:46 +05:30
Princy Jerin 04ef7744f7 Fix payslip lookup logic and enable view option for finance executive
<UserStory> EMP010 : View Payslip </UserStory>

<Changes>
 - Refactored getPayslipForMonth() to fetch payroll and payslips via employee data
 - Added validation for invalid employee ID
 - Simplified payslip search using employee-specific payslip records
 - Enabled “View Payslip” option in Finance Executive menu
 - Minor UI cleanup in payslip view (spacing and screen clear)
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-16 14:09:28 +05:30
Princy Jerin 47ca953eac Implement Review Fixes 2026-04-16 12:41:53 +05:30
Jissin Sam Mathew a1c9edce31 Implement View Payslip History
<UserStory> EMP011 : View Payslip History </UserStory>

<Changes>
 - Implemented Enums::Month enum and helper functions getMonth() and getMonthString() for month formatting.
 - Created viewPayslipHistory() helper in MenuHelper.h to display payslip history in aligned tabular format.
 - Integrated viewPayslipHistory() option into EmployeeMenu, FinanceExecutiveMenu, HRManagerMenu, ITExecutiveMenu, TalentExecutiveMenu, TeamExecutiveMenu, and TeamLeadMenu.
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-16 12:36:13 +05:30
Princy Jerin b9b83ad429 Add View Payslip feature for employees
<UserStory> EMP010 : View Payslip </UserStory>

<Changes>
- Added Timestamp support to Payroll and Payslip models
- Implemented getPayslipForMonth flow from Controller to Service
- Enabled payslip retrieval based on year and month
- Updated menus to allow payslip viewing
- Enhanced MenuHelper with a unified viewPayslip helper
- Added date-based filtering using Timestamp utilities
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-16 12:34:18 +05:30
Ajmal Jalaludeen 5318b9eed6 Merged PR 963: UserStory EMP012 Add Shortlisted Candidates As Employee
Related work items: #957
2026-04-16 10:29:21 +05:30
joelthomastrenser 72e7db04a5 Fix HR Manager menu option ordering and switch mapping
<UserStory> EMP012 : Employee Management </UserStory>

<Changes>
 - Updated HR Manager menu text to remove obsolete options
 - Reordered menu items to match current functionality
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-16 10:26:54 +05:30
joelthomastrenser 7351186baf Refactor shortlisted candidates access and fix index check
<UserStory> EMP0012 : Employee Management </UserStory>

<Changes>
 - Changed getShorlistedCandidates() to return by value instead of reference
 - Updated controller and service method signatures accordingly
 - Fixed off-by-one error when selecting shortlisted candidate
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-16 10:16:16 +05:30
Ajmal Jalaludeen f15d5b7f1d Updates based on comments
<UserStory> EMP012 : Add Shorlisted Candidates As Employee </UserStory>

<Changes>
- Added clear method to clear console before displaying candidate details in MenuHelper.cpp
- Removed spaces in MenuHelper.h
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-16 10:15:16 +05:30
Ajmal Jalaludeen 1836be1234 To Add Shortlisted Candidates As Employee
<UserStory> EMP012 : Add Shorlisted Candidates As Employee </UserStory>

<Changes>
- Added getShorlistedCandidates method in ZenvyController
- Added candidateMap to store candidate data in DataStore.h
- Added addShortlistedCandidatesAsEmployee method in EmployeeManagementService.h and implemented the logic.
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-16 10:14:43 +05:30
Tinu Johnson 508f043228 Merged PR 964: UserStory EMP005 Update Designation
Related work items: #949
2026-04-16 09:42:01 +05:30
Tinu Johnson ce86b7f59e Update Update Designation functionality based on review
<UserStory> EMP005 : Update Designation </UserStory>

<Changes>
 - Refactor GeneralEmployee constructors clean.
 - update Designation logic.
 - Improve menu display messages.
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-16 09:31:22 +05:30
Tinu Johnson 55f94f4d45 Update Update Designation functionality
<UserStory> EMP005 : Update Designation </UserStory>

<Changes>
 - Enabled HR Manager menu option to update employee designation
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-16 09:31:16 +05:30
Tinu Johnson 5398f5a0ee Add Update Designation functionality for General Employees
<UserStory> EMP005 : Update Designation </UserStory>

<Changes>
 - Added updateDesignation method in ZenvyController and EmployeeManagementService.
 - Implemented update designation logic with authorization checks.
 - Enabled Admin menu option to update employee designation
 - Display employee designation in employee selection list
 - Extended GeneralEmployee to expose and update designation
 - Integrated role selection flow in MenuHelper.
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-16 09:28:38 +05:30
joelthomastrenser a8ca6be135 Merged PR 965: UserStory EMP009 Generate Payslips
Related work items: #954
2026-04-14 17:32:19 +05:30
joelthomastrenser 454cd2d342 Implement Payslip Generation Feature
<UserStory> EMP009 : Generate Payslips </UserStory>

<Changes>
 - Updated Payslip model to store employee, salary, and date details
 - Added payslip storage to DataStore and file load/save support
 - Added logic to generate payslips once per month per employee
 - Restricted payslip generation to finance role
 - Linked payslips to employees during load and creation
 - Added month, year, and day helpers to Timestamp
 - Added payslip generation option to Finance Executive menu
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-14 17:31:27 +05:30
Jissin Mathew be01a05937 Merged PR 962: Implement View Employee Profile
Related work items: #947
2026-04-14 17:12:30 +05:30
joelthomastrenser 06d3760663 Implement Review Fixes
<UserStory> EMP003 : View Profile </UserStory>

<Changes>
- Avoid unecessary copies.
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-14 17:09:29 +05:30
Jissin Sam Mathew f5adcdea30 Implement View Employee Profile
<UserStory>EMP003: View Employee Profile</UserStory>

<Changes>

- Added `viewProfile` method in MenuHelper to display employee details including ID, name, role, email, phone, team, and payroll.
- Integrated `viewProfile(m_zenvyController)` into all role-specific menus (Employee, Finance Executive, HR Manager, IT Executive, Talent Executive, Team Lead).
- Implemented safe downcasting for `GeneralEmployee` to access designation details.
- Enhanced output formatting with section headers and null checks for team ID and payroll.
- Improved error handling with runtime exception when employee record is missing.

</Changes>

<Review>

Smitha Mohan

</Review>
2026-04-14 13:41:50 +05:30
joelthomastrenser 8447935fe4 Refactor employee fetch with type filter and login check
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Removed old getEmployees() implementation
 - Added templated getEmployees(...) for filtering by employee type
 - Default now skips admin and returns only active employees
 - Blocked login for inactive employees with proper error
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-13 22:43:48 +05:30
joelthomastrenser 07f547dce7 Minor fixes in employee listing and menus
<SRS> SRS02 : Employee Management </SRS>

<Changes>
- Sorted active employees by ID when listing
- Handled empty employee lists in menus
- Stopped deactivation when no employee is selected
- Showed "NULL" when team ID is missing
- Removed unnecessary error throw in payroll menu
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-13 18:28:22 +05:30
Ajmal Jalaludeen cac8dbfc35 Merged PR 935: UserStory EMP006 Search Employee
Related work items: #951
2026-04-13 17:24:07 +05:30
Ajmal Jalaludeen 7ffaae3752 Updated Menu Helper
<UserStory> EMP006 : Search Employee </UserStory>

<Changes>
- Updated searchEmployee method logic in MenuHelper.h helper file.
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-13 17:08:47 +05:30
joelthomastrenser a294dc57c4 Merge branch 'feature-employee-management' into feature-employee-management-emp006 2026-04-13 16:05:56 +05:30
Tinu Johnson 21657b9b89 Merged PR 924: UserStory EMP007 View Employees
Related work items: #952
2026-04-13 13:27:22 +05:30
joelthomastrenser ed1cf4e306 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>
2026-04-13 11:46:55 +05:30
joelthomastrenser 7fc468ac4b Merge branch 'feature-employee-management' into feature-employee-management-emp007 2026-04-13 11:37:24 +05:30
joelthomastrenser 8668a615ea Merged PR 957: Employee system updates
- Cleaned up employee menus and selection flow
- Fixed payroll ID issues and update logic
- Added saving/loading for employees and payroll
- Improved and centralized validation checks
- Added FileManager for file handling and cleanup
2026-04-13 10:44:14 +05:30
Ajmal Jalaludeen 853ed05e8d Corrected date format and removed unwanted spaces across all files. 2026-04-13 10:07:20 +05:30
Tinu Johnson 85f97f30f9 Add missing header 2026-04-13 09:56:41 +05:30
Tinu Johnson 83f1c4183c Add destructor in datastore 2026-04-13 09:40:34 +05:30
Tinu Johnson 75b69f8c11 Convert shared pointer to raw pointer 2026-04-13 09:40:31 +05:30
joelthomastrenser 282ab721b5 Improved employee view formatting and menu text
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Updated "View Employee" to "View Employees" in Admin Menu
 - Added clear screen and header for employee list display
 - Improved column spacing and alignment for better readability
 - Reordered fields for a cleaner layout
 - Added pressEnter prompt after viewing employees
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-11 17:54:20 +05:30
joelthomastrenser 2c9740e776 Merge branch 'feature-employee-management' into feature-employee-management-emp007 2026-04-11 17:41:57 +05:30
joelthomastrenser aa21853a65 Refactored employee selection and cleaned up menu logic
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Removed getSelectedUserId() from FinanceExecutiveMenu
 - Added reusable selectEmployeeId() in MenuHelper
 - Simplified deactivateEmployee() using common selection logic
 - Fixed missing break in HRManagerMenu
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-11 14:59:41 +05:30
joelthomastrenser 66c80fd055 Fixed payroll ID handling and improved payroll update flow
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Fixed Payroll constructor to use given ID during deserialization
 - Cleaned up salary update logic in PayslipManagementService
 - Improved employee selection display in Finance menu
 - Added employee type column in selection list
 - Fixed typo in Employee menu (Ticket)
 - Added confirmation message after payroll update
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-11 12:58:09 +05:30
joelthomastrenser 47b44ccaa0 Added payroll persistance and updated Talent Acquisition role
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Added Payroll  getHeaders, serialize and deserialize functions
 - Stored payrolls in DataStore
 - Loaded and saved payrolls along with employees
 - Linked payroll to employees during creation and load
 - Added employeeId to Payroll
- Renamed TAG role to TALENT_ACQUISITION across the project
 - Added missing TalentExecutive case in Employee deserialization
 - Added constructor to TalentExecutive for FileManager integration
 - Renamed ID counters to m_uid for consistency
 - Updated salary values in ApplicationConfig
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-11 12:13:23 +05:30
joelthomastrenser 1d94f1680c Refactored validation logic and centralized employee validators
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Moved employee validation logic (active type check, email and phone duplication) to Validator utility
 - Updated service to use util::hasActiveEmployeeOfType, util::isEmailDuplicate, and util::isPhoneDuplicate
 - Integrated validator usage in MenuHelper for input validation
 - Cleaned up formatting and minor inconsistencies
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-10 20:29:55 +05:30
joelthomastrenser c50700e70c Added CSV header support and persistence for employees
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Added header handling in FileManager load by skipping first line during deserialization
 - Added support for writing headers using T::getHeaders() in FileManager save
 - Implemented getHeaders() for Employee and GeneralEmployee models
 - Added saveEmployees functionality in EmployeeManagementService
 - Added persistStates method in ZenvyController
 - Added deserialization failure check with exception handling
 - Minor formatting cleanup in FileIO
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-10 19:41:08 +05:30
joelthomastrenser eac6fa72df Added validation checks for employee creation
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Added helper function to check for existing active employee of a given type
 - Enforced business rule to allow only one active employee per non-general type
 - Added duplicate email validation before employee creation
 - Added duplicate phone number validation before employee creation
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-10 16:43:28 +05:30
joelthomastrenser 03be8f81d2 Refactored employee creation menu and centralized helper logic
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Removed duplicate employee creation helper functions from AdminMenu and HRManagerMenu
 - Centralized employee creation flow into MenuHelper.cpp
 - Updated createEmployee to use current employee type for access control
 - Fixed parameter order bug in createEmployee (email, name, phone)
 - Improved menu titles for all roles (removed generic system header)
 - Added util::pressEnter() for better UX on invalid input across menus
 - Added newline before pause in InputHelper::pressEnter
 - Cleaned up minor formatting issues
</Changes>
2026-04-10 13:33:41 +05:30
joelthomastrenser 451ed4fec2 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>
2026-04-10 13:17:50 +05:30
joelthomastrenser d29e38ef75 Added FileManager DLL and cleanup code
<SRS> SRS02 : Employee Management </SRS>

<Changes>
 - Created FileIO for reading and writing files
 - Created FileManager to use FileIO
 - Set up Trenser.FileManager as a DLL
 - Linked DLL with Trenser.Zenvy project
 - Fixed duplicate function issue by marking deactivateEmployee as inline
 - Cleaned up unused methods in controller and service
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-09 20:32:48 +05:30
joelthomastrenser 7e0becaa3e Merged PR 949: Add files and function header documentation 2026-04-08 17:32:07 +05:30
Jissin Sam Mathew 6c05d2b352 Add files and function header documentation across Views 2026-04-08 17:29:21 +05:30
Ajmal Jalaludeen 2757e5ca98 Add file and function header documentation across Controller, DataStore and Utility files 2026-04-08 17:28:07 +05:30
Princy Jerin 21549b4c24 Add file and function header documentation across Model files 2026-04-08 17:26:20 +05:30
Tinu Johnson 9a791eadcd Add file and function header documentation across Model files 2026-04-08 17:24:12 +05:30
joelthomastrenser def0f4022b Add file and function header documentation across Services and Main files 2026-04-08 17:21:41 +05:30
Princy Jerin 2031f510d5 Merged PR 932: UserStory EMP002 Deactivate Employee
Related work items: #946
2026-04-08 11:50:23 +05:30
joelthomastrenser 4d4974efd7 Protect Admin account from deactivation
<UserStory> EMP002 : Deactivate Employee </UserStory>

<Changes>
- Ensure admin account cannot be deactivated
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-08 11:47:00 +05:30
joelthomastrenser a955b64462 Ensure Role based access
<UserStory> EMP002 : Deactivate Employee </UserStory>

<Changes>
- Ensure Role based access
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-08 11:41:31 +05:30
Princy Jerin daf33e1aab Implement Review Fixes
<UserStory> EMP002 : Deactivate Employee </UserStory>

<Changes>
- Updated employee listing to display in a tabular format with headers
- Renamed helper function from listActiveEmployees to listEmployees
- Updated error messages
- Removed blank spaces
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-08 11:41:25 +05:30
Princy Jerin f85614ecc5 Implement Deactive Employee functionality
<UserStory>
EMP002 : Deactivate Employee
</UserStory>

<Changes>
- Added deactivateEmployee logic to set employee status to INACTIVE
- Enabled Deactivate Employee option in AdminMenu
- Implemented listing of active employees for selection
- Connected UI flow for employee deactivation
- Fix minor syntax issues
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-08 11:36:50 +05:30
Tinu Johnson e470dbc791 Updated MenuHelper.h
<UserStory> EMP007 : View Employees </UserStory>

<Changes>
 - Updated logic in viewEmployees() method.
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-08 11:04:09 +05:30
Jissin Mathew a001b7d159 Merged PR 921: UserStory EMP008 Update Salary Details
Related work items: #953
2026-04-08 10:24:42 +05:30
Ajmal Jalaludeen a3e622ff8e Updated Menu Helper and all User Menu
<UserStory> EMP006 : Search Employee </UserStory>

<Changes>
- Updated MenuHelper.h helper file for input validation
- Updated search employee logic in employee management service
- Removed comments in Enums.h and EmployeeManagementService.h
- Included MenuHelper.h in all User Menu files
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-08 10:19:21 +05:30
Jissin Sam Mathew 0290467528 Implement Review Suggestion
<UserStory>EMP008: Update Salary Details</UserStory>

    <Changes>
  - Refactored salary update and employee selection:
  • Removed unnecessary const qualifiers from double parameters
  • Renamed variables
  • Replaced count() with find() for map lookups
  • Excluded ADMIN employees from salary updates and selection lists
  • Applied util::enforceAuthorization for access control
- Improved readability and consistency:
  • Enhanced tabular output using setw() with left alignment
    Implement Update Salary
    </Changes>

    <Review>
    Smitha Mohan
    </Review>
2026-04-08 10:18:23 +05:30
Jissin Sam Mathew 63627075ef Implement Update Salary
<UserStory>EMP08: Update Salary Details</UserStory>

<Changes>
- Added `updateSalary` method in ZenvyController to connect payroll updates with PayslipManagementService
- Implemented `PayslipManagementService::updateSalary` with employee existence and Finance-role authorization checks
- Extended Payroll model with setter methods for salary components
- Improved error handling with clear runtime exceptions for invalid index selection, unauthorized access, and missing employees
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-08 10:17:16 +05:30
Tinu Johnson c27ca5240a Added MenuHelper feature for ViewEmployee
<UserStory> EMP007 : View Employees </UserStory>

<Changes>
 - Added MenuHelper.cpp and MenuHelper.h to project configuration
 - Moved viewEmployees() implementation from individual menu classes into MenuHelper
 - Added inline viewEmployees(shared_ptr<ZenvyController>) helper with formatted output
 - Added enumToString() to MenuHelper for employee role display
 - Updated AdminMenu, EmployeeMenu, FinanceExecutiveMenu, HRManagerMenu,
   ITExecutiveMenu, TalentExecutiveMenu, TeamExecutiveMenu, and TeamLeadMenu
   to use viewEmployees(m_zenvyController) instead of per‑menu implementations
 - Removed old viewEmployees() method from EmployeeMenu
 - Updated menu options to reflect new centralized viewEmployees() function
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-07 20:32:30 +05:30
Tinu Johnson f75bbaaae8 Merged PR 933: UserStory EMP004 Update Personal Details
Related work items: #948
2026-04-07 20:31:25 +05:30
Tinu Johnson b3b9299c70 Added Profile Update Feature for all menu
<UserStory> EMP004 : Update Personal Details </UserStory>

<Changes>
 - Added MenuHelper.cpp and MenuHelper.h and integrated them into project
 - Moved updateProfile() logic from individual menus into MenuHelper
 - Added inline updateProfile(shared_ptr<ZenvyController>) to MenuHelper
 - Updated AdminMenu, EmployeeMenu, HRManagerMenu, FinanceExecutiveMenu,
   ITExecutiveMenu, TalentExecutiveMenu, TeamExecutiveMenu, and TeamLeadMenu
   to use centralized updateProfile()
 - Added getCurrentEmployee() and updateProfile() to ZenvyController
 - Added corresponding implementations in EmployeeManagementService
 - Minor layout and option text improvements across all menus
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-07 20:25:33 +05:30
Ajmal Jalaludeen 47a9065c3b Add Search Employee for All Users
<UserStory> EMP006 : Search Employee </UserStory>

<Changes>
 - Added MenuHelper.cpp and MenuHelper.h helper files to project
- Added searchEmployee method in ZenvyController returning employee type and list
 - Implemented search Employee logic in Employement Management Service
 - Connected searchEmployee to all the User Menu
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-07 20:11:20 +05:30
Tinu Johnson 6256b9ea82 Implement Review fixes
<UserStory> EMP007 : View All Employees  </UserStory>

<Changes>
 - Added check for empty employee map
 - Filtered only ACTIVE employees
 - Added formatted table using <iomanip> in EmplopyeeMenu::viewEmployee()
 - Added check for empty employee list
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-07 19:19:08 +05:30
Tinu Johnson 1785660e94 Add Employee Listing Feature
<UserStory> EMP007 : View All Employees  </UserStory>

<Changes>
 - Implemented getEmployees() in ZenvyController to return list of employees
 - Added working getEmployees() implementation in EmployeeManagementService
 - Fixed iterator usage to correctly extract map values into Employees vector
 - Added viewEmployees() UI flow in EmployeeMenu
 - Integrated employee listing into EmployeeMenu option flow
 - Added enumToString() helper for printing employee roles
 - Improved formatting and filtering of ACTIVE employees in employee listing
 - Performed minor code cleanup and consistency adjustments in controller and menu
</Changes>

<Review>
  Smitha Mohan
</Review>
2026-04-07 17:38:53 +05:30
joelthomastrenser 247e5dc6f6 Merged PR 920: UserStory EMP001 Create Employee
Related work items: #943
2026-04-07 17:36:30 +05:30
joelthomastrenser ef5ac42a92 Implement employee creation
<UserStory>EMP001 Create Employee</UserStory>

<Changes>
- Updated employee creation flow to support different employee types and designations
- Set a default initial password for new employees
- Added basic authorization check utility
- Cleaned up employee model constructors for better consistency
Minor code cleanup and refactoring
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-07 15:07:44 +05:30
joelthomastrenser 07bd979685 Set up employee management codebase
<SRS>SRS02 : Employee Management </SRS>

<Changes>
- Renamed EmployeeManagememtService to EmployeeManagementService
- Added basic employee management service structure
- Connected employee management into controller and datastore
- Updated project config files
- Added auto ID generation across models
- Added payroll-related config constants
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-07 10:51:38 +05:30
joelthomastrenser fcc612f081 Merged PR 910: Refactor authentication: replace tuple with DTO, namespace config
Refactor authentication: replace tuple with DTO, namespace config
2026-04-07 09:02:51 +05:30
joelthomastrenser e7332af1e7 Refactor authentication: replace tuple with DTO, namespace config 2026-04-07 00:55:44 +05:30
joelthomastrenser fb35ee6098 Merged PR 899: SRS01 Authentication
Related work items: #930, #932, #933, #935, #936
2026-04-06 17:50:32 +05:30
Tinu Johnson 18afdc4189 Error fixes and added main method function and objects
<SRS> SRS01 : Authentication </SRS>

 <Changes>
  - Fixed polymorphism errors in Employee base class by adding virtual destructor.
  - Corrected constructor mismatch in GeneralEmployee to properly call Employee constructor with EmployeeType.
  - Created UserInterface object in main() and invoked run() to start role-based menus.
 </Changes>

 <Review>
   Smitha Mohan
 </Review>
2026-04-06 17:39:09 +05:30
Tinu Johnson 719bf5e7b3 Setup basic UI and controller for authentication
<SRS> SRS01 : Authentication </SRS>

<Changes>
- Added basic UI structure with UserInterface and role-based menus (Admin, HR, IT, Finance, Talent, Team, TeamLead, Employee).
- Created menu classes for different roles, each with run() and handleOperation() methods.
</Changes>

<Review>
 Smitha Mohan
</Review>
2026-04-06 16:46:41 +05:30
Princy Jerin f61d4259aa Merged PR 897: UserStory AUTH002 Reset Initial Password
Related work items: #933
2026-04-06 16:02:55 +05:30
Princy Jerin 1c22c14f32 Add reset initial password
<UserStory> AUTH002 : Reset Initial Password </UserStory>

    <Changes>
    - Added logic for resetting initial password
    - Code Cleanup
    </Changes>

    <Review>
    Smitha Mohan
    </Review>
2026-04-06 15:57:23 +05:30
Jissin Mathew fdd90636ed Merged PR 896: UserStory AUTH003 Logout
Related work items: #932, #935, #936
2026-04-06 13:59:44 +05:30
Jissin Sam Mathew 45d00d8964 Add logout functionality in controller and datastore access
<UserStory> AUTH003: Logout User </UserStory>

<Changes>
- Added logout() method in ZenvyController and AuthenticationManagementService
- Implemented logout handling in AuthenticationManagementService
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-06 13:52:50 +05:30
Ajmal Jalaludeen 8a76a5b6a8 Merged PR 895: UserStory AUTH004 Change Password
Related work items: #936
2026-04-06 13:41:37 +05:30
Ajmal Jalaludeen c2fbfa2d03 Add changePassword method in controller and authenticated user accessor
<UserStory> AUTH004 : Change Password </UserStory>

    <Changes>
    - Added changePassword method in ZenvyController to move to AuthenticationManagementService
    - Declared changePassword in ZenvyController.h
    - Introduced getAuthenticatedUser() in DataStore for accessing authenticated employee
    - Updated DataStore.h with getAuthenticatedUser() method
    - Prepared AuthenticationManagementService.cpp for password change implementation
    </Changes>

    <Review>
    Smitha Mohan
    </Review>
2026-04-06 13:29:56 +05:30
joelthomastrenser dc3a30c448 Merged PR 894: UserStory AUTH001 Login
Related work items: #932
2026-04-06 12:19:25 +05:30
joelthomastrenser d76def42e9 Add authentication flow, UI menu routing, and application config
<UserStory>AUTH001 : Login </UserStory>

<Changes>
- Introduced ApplicationConfig for default configuration values
- Implemented authentication flow in AuthenticationManagementService
- Added login and logout handling in ZenvyController
- Updated enums to include INVALID values and TEAM employee type
- Implemented login UI flow with role-based menu routing
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-06 11:49:57 +05:30
joelthomastrenser 02c4f1a954 Add EmployeeType and LoginStatus enums, extend Employee model
<SRS> SRS01 : Authentication </SRS>

<Changes>
- Added EmployeeType and LoginStatus enums
- Extended Employee model to store employee type
- Updated Employee constructors to initialize employee type
- Added getter for employee type in Employee model
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-06 09:39:14 +05:30
Ajmal Jalaludeen 676c5ce132 Setup basic UI and controller for authentication
<SRS> SRS01 : Authentication </SRS>

<Changes>
- Added basic UI structure with UserInterface and role-based menus
- Created menu classes for different roles (Admin, HR, IT, etc.)
- Connected ZenvyController with all required services
- Updated AuthenticationManagementService
- Added FAQ model
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-02 20:11:27 +05:30
joelthomastrenser a925fe63fb Add logging service and datastore setup, refactor inputHelper
<SRS> SRS01 : Authentication </SRS>

<Changes>
- Set up DataStore singleton and added basic employee + log storage
- Added LogService
- Refactor InputHelper
- Updated include paths in project config
</Changes>

<Review>
Smitha Mohan
</Review>
2026-04-02 19:58:59 +05:30
118 changed files with 5651 additions and 245 deletions
+3
View File
@@ -426,3 +426,6 @@ FodyWeavers.xsd
*.msix
*.msm
*.msp
# CSV Files
*.csv
@@ -0,0 +1,27 @@
#include "pch.h"
#include "FileIO.h"
std::vector<std::string> FileIO::readAllLines(const std::string& path)
{
std::ifstream file(path);
if (!file.is_open())
{
std::ofstream newFile(path);
newFile.close();
file.open(path);
} std::vector<std::string> lines;
std::string line;
while (std::getline(file, line))
lines.push_back(line);
return lines;
}
void FileIO::writeAllLines(const std::string& path,
const std::vector<std::string>& lines)
{
std::ofstream file(path, std::ios::trunc);
if (!file.is_open())
throw std::runtime_error("Failed to open file " + path);
for (const auto& line : lines)
file << line << '\n';
}
@@ -0,0 +1,18 @@
#pragma once
#include<memory>
#include<vector>
#include<fstream>
#include<string>
#include<stdexcept>
#ifdef TRENSERFILEMANAGER_EXPORTS
#define TRENSERFILEMANAGER_API __declspec(dllexport)
#else
#define TRENSERFILEMANAGER_API __declspec(dllimport)
#endif
class TRENSERFILEMANAGER_API FileIO {
public:
static std::vector<std::string> readAllLines(const std::string& path);
static void writeAllLines(const std::string& path, const std::vector<std::string>& lines);
};
@@ -0,0 +1,52 @@
#pragma once
#include <stdexcept>
#include "FileIO.h"
template <typename T> using objects = std::map<std::string, T*>;
template <typename T>
class FileManager
{
private:
std::string m_filePath;
public:
FileManager() : m_filePath("") {}
FileManager(const std::string& filePath) : m_filePath(filePath) {}
objects<T> load();
void save(const objects<T>&);
};
template <typename T>
objects<T> FileManager<T>::load()
{
objects<T> records;
auto lines = FileIO::readAllLines(m_filePath);
bool isHeader = true;
for (const auto& record : lines)
{
if (isHeader)
{
isHeader = false;
continue;
}
auto object = T::deserialize(record);
if (!object)
{
throw std::runtime_error("Failed to deserialize record");
}
records[object->getId()] = object;
}
return records;
}
template <typename T>
void FileManager<T>::save(const objects<T>& records)
{
std::vector<std::string> lines;
lines.push_back(T::getHeaders());
for (const auto& recordPair : records)
{
lines.push_back(recordPair.second->serialize());
}
FileIO::writeAllLines(m_filePath, lines);
}
@@ -135,11 +135,14 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="FileIO.h" />
<ClInclude Include="FileManager.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="FileIO.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
@@ -21,6 +21,12 @@
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FileManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FileIO.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
@@ -29,5 +35,8 @@
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FileIO.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -9,5 +9,10 @@
// add headers that you want to pre-compile here
#include "framework.h"
#include<memory>
#include<vector>
#include<fstream>
#include<string>
#include<stdexcept>
#endif //PCH_H
@@ -0,0 +1,15 @@
/*
* File: Trenser.Zenvy.cpp
* Description: Zenvy Main
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "UserInterface.h"
#include "FileManager.h"
int main()
{
UserInterface userInterFace;
userInterFace.run();
return 0;
}
@@ -102,12 +102,17 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(ProjectDir)controllers;$(ProjectDir)services;$(ProjectDir)utilities;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)models;$(ProjectDir)controllers;$(ProjectDir)services;$(ProjectDir)utilities;$(ProjectDir)factories;$(ProjectDir)datastores;$(ProjectDir)views;%(AdditionalIncludeDirectories);..\..\Trenser.FileManager\Trenser.FileManager</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\..\Trenser.FileManager\$(IntDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Trenser.FileManager.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy /y /d "..\..\Trenser.FileManager\$(IntDir)Trenser.FileManager.dll" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -117,11 +122,17 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>;..\..\Trenser.FileManager\Trenser.FileManager</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\..\Trenser.FileManager\$(IntDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Trenser.FileManager.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy /y /d "..\..\Trenser.FileManager\$(IntDir)Trenser.FileManager.dll" "$(OutDir)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="controllers\ZenvyController.cpp" />
@@ -131,6 +142,7 @@
<ClCompile Include="models\Attendance.cpp" />
<ClCompile Include="models\Booking.cpp" />
<ClCompile Include="models\Candidate.cpp" />
<ClCompile Include="models\Faq.cpp" />
<ClCompile Include="models\FinanceExecutive.cpp" />
<ClCompile Include="models\GeneralEmployee.cpp" />
<ClCompile Include="models\ITExecutive.cpp" />
@@ -145,10 +157,11 @@
<ClCompile Include="models\Team.cpp" />
<ClCompile Include="models\TeamExecutive.cpp" />
<ClCompile Include="models\Ticket.cpp" />
<ClCompile Include="services\ApplicationConfig.cpp" />
<ClCompile Include="services\AttendanceManagementService.cpp" />
<ClCompile Include="services\AuthenticationManagementService.cpp" />
<ClCompile Include="services\BookingManagementService.cpp" />
<ClCompile Include="services\EmployeeManagememtService.cpp" />
<ClCompile Include="services\EmployeeManagementService.cpp" />
<ClCompile Include="services\LeaveManagementService.cpp" />
<ClCompile Include="services\LogService.cpp" />
<ClCompile Include="services\NotificationManagementService.cpp" />
@@ -160,11 +173,23 @@
<ClCompile Include="models\Employee.cpp" />
<ClCompile Include="models\HRManager.cpp" />
<ClCompile Include="Trenser.Zenvy.cpp" />
<ClCompile Include="utilities\AuthorizationHelper.cpp" />
<ClCompile Include="utilities\Enums.cpp" />
<ClCompile Include="utilities\InputHelper.cpp" />
<ClCompile Include="utilities\OutputHelper.cpp" />
<ClCompile Include="utilities\StringHelper.cpp" />
<ClCompile Include="utilities\Timestamp.cpp" />
<ClCompile Include="utilities\Validator.cpp" />
<ClCompile Include="views\AdminMenu.cpp" />
<ClCompile Include="views\EmployeeMenu.cpp" />
<ClCompile Include="views\FinanceExecutiveMenu.cpp" />
<ClCompile Include="views\HRManagerMenu.cpp" />
<ClCompile Include="views\ITExecutiveMenu.cpp" />
<ClCompile Include="views\MenuHelper.cpp" />
<ClCompile Include="views\TalentExecutiveMenu.cpp" />
<ClCompile Include="views\TeamExecutiveMenu.cpp" />
<ClCompile Include="views\TeamLeadMenu.cpp" />
<ClCompile Include="views\UserInterface.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="controllers\ZenvyController.h" />
@@ -174,6 +199,7 @@
<ClInclude Include="models\Attendance.h" />
<ClInclude Include="models\Booking.h" />
<ClInclude Include="models\Candidate.h" />
<ClInclude Include="models\Faq.h" />
<ClInclude Include="models\FinanceExecutive.h" />
<ClInclude Include="models\GeneralEmployee.h" />
<ClInclude Include="models\ITExecutive.h" />
@@ -188,10 +214,11 @@
<ClInclude Include="models\Team.h" />
<ClInclude Include="models\TeamExecutive.h" />
<ClInclude Include="models\Ticket.h" />
<ClInclude Include="services\ApplicationConfig.h" />
<ClInclude Include="services\AttendanceManagementService.h" />
<ClInclude Include="services\AuthenticationManagementService.h" />
<ClInclude Include="services\BookingManagementService.h" />
<ClInclude Include="services\EmployeeManagememtService.h" />
<ClInclude Include="services\EmployeeManagementService.h" />
<ClInclude Include="services\LeaveManagementService.h" />
<ClInclude Include="services\LogService.h" />
<ClInclude Include="services\NotificationManagementService.h" />
@@ -199,11 +226,23 @@
<ClInclude Include="services\TalentAcquisitionManagementService.h" />
<ClInclude Include="services\TeamManagementService.h" />
<ClInclude Include="services\TicketManagementService.h" />
<ClInclude Include="utilities\AuthorizationHelper.h" />
<ClInclude Include="utilities\Enums.h" />
<ClInclude Include="utilities\InputHelper.h" />
<ClInclude Include="utilities\OutputHelper.h" />
<ClInclude Include="utilities\StringHelper.h" />
<ClInclude Include="utilities\Timestamp.h" />
<ClInclude Include="utilities\Validator.h" />
<ClInclude Include="views\AdminMenu.h" />
<ClInclude Include="views\EmployeeMenu.h" />
<ClInclude Include="views\FinanceExecutiveMenu.h" />
<ClInclude Include="views\HRManagerMenu.h" />
<ClInclude Include="views\ITExecutiveMenu.h" />
<ClInclude Include="views\MenuHelper.h" />
<ClInclude Include="views\TalentExecutiveMenu.h" />
<ClInclude Include="views\TeamExecutiveMenu.h" />
<ClInclude Include="views\TeamLeadMenu.h" />
<ClInclude Include="views\UserInterface.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="models\Admin.h" />
@@ -5,10 +5,6 @@
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
@@ -31,17 +27,18 @@
<Filter Include="DataStores">
<UniqueIdentifier>{eb93b9d1-08eb-48aa-be2a-e17085ce27bd}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Views">
<UniqueIdentifier>{84db0710-2b0f-48bc-a72f-bd10c29954fc}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Trenser.Zenvy.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="services\AuthenticationManagementService.cpp">
<Filter>Services</Filter>
</ClCompile>
<ClCompile Include="services\EmployeeManagememtService.cpp">
<Filter>Services</Filter>
</ClCompile>
<ClCompile Include="services\AttendanceManagementService.cpp">
<Filter>Services</Filter>
</ClCompile>
@@ -156,14 +153,59 @@
<ClCompile Include="models\Log.cpp">
<Filter>Models</Filter>
</ClCompile>
<ClCompile Include="Trenser.Zenvy.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="views\AdminMenu.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="views\EmployeeMenu.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="views\FinanceExecutiveMenu.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="views\HRManagerMenu.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="views\ITExecutiveMenu.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="views\TalentExecutiveMenu.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="views\TeamExecutiveMenu.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="views\TeamLeadMenu.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="views\UserInterface.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="models\Faq.cpp">
<Filter>Models</Filter>
</ClCompile>
<ClCompile Include="services\ApplicationConfig.cpp">
<Filter>Services</Filter>
</ClCompile>
<ClCompile Include="services\EmployeeManagementService.cpp">
<Filter>Services</Filter>
</ClCompile>
<ClCompile Include="views\MenuHelper.cpp">
<Filter>Views</Filter>
</ClCompile>
<ClCompile Include="utilities\AuthorizationHelper.cpp">
<Filter>Services</Filter>
</ClCompile>
<ClCompile Include="utilities\StringHelper.cpp">
<Filter>Utilities</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="services\AuthenticationManagementService.h">
<Filter>Services</Filter>
</ClInclude>
<ClInclude Include="services\EmployeeManagememtService.h">
<Filter>Services</Filter>
</ClInclude>
<ClInclude Include="services\TicketManagementService.h">
<Filter>Services</Filter>
</ClInclude>
@@ -269,6 +311,51 @@
<ClInclude Include="models\Log.h">
<Filter>Models</Filter>
</ClInclude>
<ClInclude Include="views\AdminMenu.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="views\EmployeeMenu.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="views\FinanceExecutiveMenu.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="views\HRManagerMenu.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="views\ITExecutiveMenu.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="views\TalentExecutiveMenu.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="views\TeamExecutiveMenu.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="views\TeamLeadMenu.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="views\UserInterface.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="models\Faq.h">
<Filter>Models</Filter>
</ClInclude>
<ClInclude Include="services\ApplicationConfig.h">
<Filter>Services</Filter>
</ClInclude>
<ClInclude Include="services\EmployeeManagementService.h">
<Filter>Services</Filter>
</ClInclude>
<ClInclude Include="views\MenuHelper.h">
<Filter>Views</Filter>
</ClInclude>
<ClInclude Include="utilities\AuthorizationHelper.h">
<Filter>Services</Filter>
</ClInclude>
<ClInclude Include="utilities\StringHelper.h">
<Filter>Utilities</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClInclude Include="models\Employee.h">
@@ -1 +1,245 @@
/*
* File: ZenvyController.cpp
* Description : Controls data flow between UI and Service Layers.
* Author: Trenser
* Created : 01-Apr-2026
*/
#include "ZenvyController.h"
/*
* Function: login
* Description: authenticates the employee based on email and password
* Parameters:
* email - email of the employee
* password - password of the employee
* Returns:
* Tuple - login status, employee type, employee designation
* login status - success or failed
* employee type - type of the employee logged in
* employee designation - designation if employee type is GENERAL.
*/
AuthenticationDTO ZenvyController::login(const std::string& email, const std::string& password)
{
return m_authenticationManagementService->login(email, password);
}
/*
* Function: logout
* Description: logs out the currently authenticated employee
* Parameters:
* None
* Returns:
* void - no return value
*/
void ZenvyController::logout()
{
m_authenticationManagementService->logout();
}
/*
* Function: changePassword
* Description: updates the password of the currently authenticated employee
* Parameters:
* password - the new password to be set for the employee
* Returns:
* void - no return value
*/
void ZenvyController::changePassword(const std::string& password)
{
m_authenticationManagementService->changePassword(password);
}
/*
* Function: createEmployee
* Description: creates a new employee with the given details
* Parameters:
* employeeType - type of employee to be created
* employeeDesignation - designation of the employee
* email - email address of the employee
* name - name of the employee
* phone - phone number of the employee
* Returns:
* void - no return value
*/
void ZenvyController::createEmployee(Enums::EmployeeType employeeType, Enums::EmployeeDesignation employeeDesignation, const std::string& email, const std::string& name, const std::string& phone) const
{
m_employeeManagementService->createEmployee(employeeType, employeeDesignation, email, name, phone);
}
/*
* Function: deactivateEmployee
* Description: deactivates an employee based on employee ID
* Parameters:
* id - unique employee ID
* Returns:
* bool - true if deactivated successfully, false otherwise
*/
bool ZenvyController::deactivateEmployee(const std::string& id) const
{
return m_employeeManagementService->deactivateEmployee(id);
}
/*
* Function: updateProfile
* Description: updates the profile of the currently authenticated employee
* Parameters:
* name - updated name of the employee
* phone - updated phone number
* Returns:
* void - no return value
*/
void ZenvyController::updateProfile(const std::string& name, const std::string& phone)
{
m_employeeManagementService->updateProfile(name, phone);
}
/*
* Function: searchEmployee
* Description: searches employees based on name
* Parameters:
* name - name or partial name of the employee
* Returns:
* Pair of employee type and list of matching employees
*/
std::pair<Enums::EmployeeType, std::vector<const Employee*>> ZenvyController::searchEmployee(const std::string& name)
{
return m_employeeManagementService->searchEmployee(name);
}
/*
* Function: getCurrentEmployee
* Description: retrieves the currently authenticated employee
* Parameters:
* None
* Returns:
* Pointer to the authenticated employee
*/
const Employee* ZenvyController::getCurrentEmployee() const
{
return m_employeeManagementService->getCurrentEmployee();
}
/*
* Function: updateDesignation
* Description: updates the designation of an employee
* Parameters:
* id - unique employee ID
* designation - new designation to be assigned
* Returns:
* bool - true if update is successful, false otherwise
*/
bool ZenvyController::updateDesignation(const std::string& id, Enums::EmployeeDesignation designation)
{
return m_employeeManagementService->updateDesignation(id, designation);
}
/*
* Function: getShorlistedCandidates
* Description: retrieves the list of shortlisted candidates
* Parameters:
* None
* Returns:
* Vector of shortlisted candidate pointers
*/
std::vector<Candidate*> ZenvyController::getShorlistedCandidates() const
{
return m_employeeManagementService->getShorlistedCandidates();
}
/*
* Function: updateSalary
* Description: updates salary details of an employee
* Parameters:
* employeeId - unique employee ID
* basicSalary - basic salary amount
* houseRentAllowance - HRA amount
* foodAllowance - food allowance amount
* employeePFContribution - employee PF contribution
* employerPFContribution - employer PF contribution
* Returns:
* void - no return value
*/
void ZenvyController::updateSalary(const std::string& employeeId, double basicSalary, double houseRentAllowance, double foodAllowance, double employeePFContribution, double employerPFContribution)
{
m_payslipManagementService->updateSalary(employeeId, basicSalary, houseRentAllowance, foodAllowance, employeePFContribution, employerPFContribution);
}
/*
* Function: generatePayslips
* Description: generates payslips for all eligible employees
* Parameters:
* None
* Returns:
* void - no return value
*/
void ZenvyController::generatePayslips()
{
m_payslipManagementService->generatePayslips();
}
/*
* Function: loadStates
* Description: loads persisted application data into memory
* Parameters:
* None
* Returns:
* void - no return value
*/
void ZenvyController::loadStates()
{
m_employeeManagementService->loadEmployees();
m_payslipManagementService->loadPayrolls();
m_payslipManagementService->loadPayslips();
}
/*
* Function: persistStates
* Description: saves current application data to storage
* Parameters:
* None
* Returns:
* void - no return value
*/
void ZenvyController::persistStates()
{
m_employeeManagementService->saveEmployees();
m_payslipManagementService->savePayrolls();
m_payslipManagementService->savePayslips();
}
/*
* Function: getPayslipForMonth
* Description: retrieves payroll and payslip details for a specific month
* Parameters:
* employeeId - unique employee ID
* year - year of the payslip
* month - month of the payslip
* Returns:
* Pair of payroll and payslip pointers
*/
std::pair<Payroll*, Payslip*> ZenvyController::getPayslipForMonth(const std::string& employeeId, int year, int month)
{
return m_payslipManagementService->getPayslipForMonth(employeeId, year, month);
}
/*
* Function: ~ZenvyController
* Description: cleans up dynamically allocated service objects
* Parameters:
* None
* Returns:
* void - no return value
*/
ZenvyController::~ZenvyController()
{
delete m_authenticationManagementService;
delete m_attendanceManagementService;
delete m_bookingManagementService;
delete m_employeeManagementService;
delete m_leaveManagementService;
delete m_notificationManagementService;
delete m_payslipManagementService;
delete m_talentAcquisitionManagementService;
delete m_teamManagementService;
delete m_ticketManagementService;
}
@@ -1,5 +1,77 @@
/*
* File: ZenvyController.h
* Description : Controls data flow between UI and Service Layers.
* Author: Trenser
* Created : 01-Apr-2026
*/
#pragma once
#include <utility>
#include "AuthenticationManagementService.h"
#include "AttendanceManagementService.h"
#include "BookingManagementService.h"
#include "EmployeeManagementService.h"
#include "LeaveManagementService.h"
#include "NotificationManagementService.h"
#include "PayslipManagementService.h"
#include "TalentAcquisitionManagementService.h"
#include "TeamManagementService.h"
#include "TicketManagementService.h"
#include "Enums.h"
class ZenvyController
{
};
private:
AuthenticationManagementService* m_authenticationManagementService;
AttendanceManagementService* m_attendanceManagementService;
BookingManagementService* m_bookingManagementService;
EmployeeManagementService* m_employeeManagementService;
LeaveManagementService* m_leaveManagementService;
NotificationManagementService* m_notificationManagementService;
PayslipManagementService* m_payslipManagementService;
TalentAcquisitionManagementService* m_talentAcquisitionManagementService;
TeamManagementService* m_teamManagementService;
TicketManagementService* m_ticketManagementService;
public:
ZenvyController() :
m_authenticationManagementService(new AuthenticationManagementService()),
m_attendanceManagementService(new AttendanceManagementService()),
m_bookingManagementService(new BookingManagementService()),
m_employeeManagementService(new EmployeeManagementService()),
m_leaveManagementService(new LeaveManagementService()),
m_notificationManagementService(new NotificationManagementService()),
m_payslipManagementService(new PayslipManagementService()),
m_talentAcquisitionManagementService(new TalentAcquisitionManagementService()),
m_teamManagementService(new TeamManagementService()),
m_ticketManagementService(new TicketManagementService()) {};
~ZenvyController();
//Authentication
AuthenticationDTO login(const std::string& email, const std::string& password);
void logout();
void changePassword(const std::string&);
//Employee Management
void createEmployee(Enums::EmployeeType, Enums::EmployeeDesignation, const std::string&, const std::string&, const std::string&) const;
bool deactivateEmployee(const std::string&) const;
const Employee* getCurrentEmployee() const;
void updateProfile(const std::string&, const std::string&);
std::pair<Enums::EmployeeType, std::vector<const Employee*>> searchEmployee(const std::string&);
bool updateDesignation(const std::string&, Enums::EmployeeDesignation);
std::vector<Candidate*> getShorlistedCandidates() const;
template <typename ...Types>
Employees getEmployees(Types ...types) const
{
return m_employeeManagementService->getEmployees(types...);
}
//Payslip management
void updateSalary(const std::string&, double, double, double, double, double);
void generatePayslips();
std::pair<Payroll*, Payslip*>getPayslipForMonth(const std::string&, int, int);
//File Management
void loadStates();
void persistStates();
};
@@ -1 +1,152 @@
/*
* File: DataStore.cpp
* Description: Central Storage for all the System Data.
* Author: Trenser
* Created: 01-Apr-2026
*/
#include "DataStore.h"
#include "EmployeeManagementService.h"
/*
* Function: getInstance
* Description: provides a singleton instance of the DataStore.
* Parameters:
* None
* Returns:
* DataStore& - reference to the single DataStore object.
*/
DataStore& DataStore::getInstance()
{
static DataStore dataStore;
return dataStore;
}
/*
* Function: getLogs
* Description: retrieves the log map containing system logs.
* Parameters:
* None
* Returns:
* logMap& - reference to the log map.
*/
logMap& DataStore::getLogs()
{
return m_logs;
}
/*
* Function: getAuthenticatedEmployee
* Description: retrieves the currently authenticated employee.
* Parameters:
* None
* Returns:
* Employee*& - reference to the authenticated employee pointer.
*/
Employee*& DataStore::getAuthenticatedEmployee()
{
return m_authenticatedEmployee;
}
/*
* Function: setAuthenticatedEmployee
* Description: sets the currently authenticated employee.
* Parameters:
* authenticatedEmployee - pointer to the employee to be set as authenticated.
* Returns:
* void - no return value.
*/
void DataStore::setAuthenticatedEmployee(Employee* authenticatedEmployee)
{
m_authenticatedEmployee = authenticatedEmployee;
}
/*
* Function: getEmployees
* Description: retrieves the map containing all employees.
* Parameters:
* None
* Returns:
* employeeMap& - reference to the employee map.
*/
employeeMap& DataStore::getEmployees()
{
return m_employees;
}
/*
* Function: getPayrolls
* Description: retrieves the map containing all payroll records.
* Parameters:
* None
* Returns:
* payrollMap& - reference to the payroll map.
*/
payrollMap& DataStore::getPayrolls()
{
return m_payrolls;
}
/*
* Function: getPayslips
* Description: retrieves the map containing all payslip records.
* Parameters:
* None
* Returns:
* payslipMap& - reference to the payslip map.
*/
payslipMap& DataStore::getPayslips()
{
return m_payslips;
}
/*
* Function: getCandidates
* Description: retrieves the map containing all shortlisted candidates.
* Parameters:
* None
* Returns:
* candidateMap& - reference to the candidate map.
*/
candidateMap& DataStore::getCandidates()
{
return m_candidates;
}
/*
* Function: ~DataStore
* Description: releases all dynamically allocated objects stored in the DataStore.
* Parameters:
* None
* Returns:
* void - no return value.
*/
DataStore::~DataStore()
{
for (auto& pair : m_employees)
{
delete pair.second;
}
m_employees.clear();
for (auto& pair : m_payrolls)
{
delete pair.second;
}
m_payrolls.clear();
for (auto& pair : m_payslips)
{
delete pair.second;
}
m_payslips.clear();
for (auto& pair : m_logs)
{
delete pair.second;
}
m_logs.clear();
for (auto& pair : m_candidates)
{
delete pair.second;
}
m_candidates.clear();
m_authenticatedEmployee = nullptr;
}
@@ -1,5 +1,60 @@
/*
* File: DataStore.h
* Description: Central Storage for all the System Data.
* Author: Trenser
* Created: 01-Apr-2026
*/
#pragma once
#include <map>
#include "Employee.h"
#include "Log.h"
#include "Timestamp.h"
#include "Admin.h"
#include "HRManager.h"
#include "GeneralEmployee.h"
#include "ITExecutive.h"
#include "FinanceExecutive.h"
#include "TeamExecutive.h"
#include "TalentExecutive.h"
#include "Team.h"
#include "Room.h"
#include "Ticket.h"
#include "JobListing.h"
#include "Notification.h"
#include "Announcement.h"
#include "Faq.h"
#include "Payroll.h"
#include "Payslip.h"
using employeeMap = std::map<std::string, Employee*>;
using payrollMap = std::map<std::string, Payroll*>;
using payslipMap = std::map<std::string, Payslip*>;
using logMap = std::map<util::Timestamp, Log*>;
using candidateMap = std::map<std::string, Candidate*>;
class DataStore
{
private:
Employee* m_authenticatedEmployee;
employeeMap m_employees;
payrollMap m_payrolls;
payslipMap m_payslips;
logMap m_logs;
candidateMap m_candidates;
DataStore() : m_authenticatedEmployee(nullptr) {};
public:
static DataStore& getInstance();
DataStore(const DataStore&) = delete;
DataStore& operator=(const DataStore&) = delete;
DataStore(DataStore&&) = delete;
DataStore& operator=(DataStore&&) = delete;
employeeMap& getEmployees();
payrollMap& getPayrolls();
payslipMap& getPayslips();
logMap& getLogs();
candidateMap& getCandidates();
Employee*& getAuthenticatedEmployee();
void setAuthenticatedEmployee(Employee*);
~DataStore();
};
@@ -1,13 +1,29 @@
/*
* File: Factory.h
* Description: Provides a generic factory utility to create objects.
* Author: Trenser
* Created: 01-Apr-2026
*/
#pragma once
#include <memory>
#include <utility>
class Factory
{
public:
template<typename T, typename... Args>
static std::shared_ptr<T> getObject(Args&&... args)
{
return std::make_shared<T>(std::forward<Args>(args)...);
}
/*
* Function: getObject
* Description: Creates and returns a dynamically allocated object of type T.
* Parameters:
* T - the type of object to be created
* Args - constructor arguments forwarded to T's constructor
* Returns:
* T* - pointer to the newly created object
*/
template<typename T, typename... Args>
static T* getObject(Args&&... args)
{
return new T(std::forward<Args>(args)...);
}
};
@@ -1 +1,7 @@
/*
* File: Admin.cpp
* Description: Admin model class
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Admin.h"
@@ -1,6 +1,38 @@
/*
* File: Admin.h
* Description: Admin model class
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
class Admin : public Employee
{
public:
Admin() = default;
Admin(
const std::string& name,
const std::string& phone,
const std::string& email,
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::ADMIN, payroll) {};
Admin(const std::string& id,
const std::string& name,
const std::string& phone,
const std::string& password,
const std::string& email,
const std::string& teamId,
Enums::TeamStatus teamStatus,
Enums::AccountStatus accountStatus)
: Employee(id,
name,
phone,
password,
email,
teamId,
teamStatus,
Enums::EmployeeType::ADMIN,
accountStatus) {}
~Admin() = default;
};
@@ -1,5 +1,13 @@
/*
* File: Announcement.cpp
* Description: The Announcement class defines a simple object for managing announcement details.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Announcement.h"
int Announcement::m_uid = 0;
const std::string& Announcement::getAnnouncementId() const
{
return m_id;
@@ -1,3 +1,9 @@
/*
* File: Announcement.h
* Description: The Announcement class defines a simple object for managing announcement details.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include <string>
#include "Timestamp.h"
@@ -5,14 +11,14 @@
class Announcement
{
private:
static int m_uid;
std::string m_id;
util::Timestamp m_timestamp;
std::string m_message;
public:
Announcement() : m_id(""), m_timestamp(), m_message("") {}
Announcement(const std::string& id,
const std::string& message)
: m_id(id), m_message(message) {}
Announcement() : m_id("AN" + std::to_string(++m_uid)), m_timestamp(), m_message("") {}
Announcement(const std::string& message)
: m_id("AN" + std::to_string(++m_uid)), m_message(message) {}
const std::string& getAnnouncementId() const;
const util::Timestamp& getAnnouncementTimestamp() const;
const std::string& getAnnouncementMessage() const;
@@ -1,5 +1,13 @@
/*
* File: Attendance.cpp
* Description: The Attendance class represents an attendance record by storing an ID, login and logout timestamps.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Attendance.h"
int Attendance::m_uid = 0;
const std::string& Attendance::getAttendanceId() const
{
return m_id;
@@ -1,3 +1,9 @@
/*
* File: Attendance.h
* Description: The Attendance class represents an attendance record by storing an ID, login and logout timestamps.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include <string>
#include "Timestamp.h"
@@ -5,15 +11,15 @@
class Attendance
{
private:
static int m_uid;
std::string m_id;
util::Timestamp m_loginTime;
util::Timestamp m_logoutTime;
public:
Attendance() : m_id(""), m_loginTime(), m_logoutTime() {}
Attendance(const std::string& id,
const util::Timestamp& loginTime,
Attendance() : m_id("AD" + std::to_string(++m_uid)), m_loginTime(), m_logoutTime() {}
Attendance(const util::Timestamp& loginTime,
const util::Timestamp& logoutTime)
: m_id(id), m_loginTime(loginTime), m_logoutTime(logoutTime) {}
: m_id("AD" + std::to_string(++m_uid)), m_loginTime(loginTime), m_logoutTime(logoutTime) {}
const std::string& getAttendanceId() const;
const util::Timestamp& getLoginTime() const;
const util::Timestamp& getLogoutTime() const;
+10 -2
View File
@@ -1,5 +1,13 @@
/*
* File: Booking.cpp
* Description: The Booking class represents a timebased booking with employee and team details and supports duration calculation.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Booking.h"
int Booking::m_uid = 0;
const std::string& Booking::getBookingId() const
{
return m_id;
@@ -20,7 +28,7 @@ const std::string& Booking::getEmployeeId() const
return m_employeeId;
}
std::shared_ptr<Team> Booking::getTeam() const
Team* Booking::getTeam() const
{
return m_team;
}
@@ -45,7 +53,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;
}
+14 -9
View File
@@ -1,35 +1,40 @@
/*
* File: Booking.h
* Description: The Booking class represents a time?based booking with employee and team details and supports duration calculation.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include <string>
#include <memory>
#include "Team.h"
#include "Timestamp.h"
class Booking
{
private:
static int m_uid;
std::string m_id;
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(const std::string& id,
const util::Timestamp& startTime,
Booking() : m_id("BK" + std::to_string(++m_uid)), m_startTime(), m_endTime(), m_employeeId(""), m_team(nullptr) {}
Booking(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("BK" + std::to_string(++m_uid)), 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;
};
@@ -1,5 +1,13 @@
/*
* File: Candidate.cpp
* Description: The Candidate class stores and manages a candidates information.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "Candidate.h"
int Candidate::m_uid = 0;
const std::string& Candidate::getCandidateId() const
{
return m_id;
@@ -10,7 +18,7 @@ const std::string& Candidate::getCandidateName() const
return m_name;
}
long int Candidate::getCandidatePhone() const
const std::string& Candidate::getCandidatePhone() const
{
return m_phone;
}
@@ -35,7 +43,7 @@ void Candidate::setCandidateName(const std::string& name)
m_name = name;
}
void Candidate::setCandidatePhone(long int phone)
void Candidate::setCandidatePhone(const std::string& phone)
{
m_phone = phone;
}
+14 -8
View File
@@ -1,3 +1,9 @@
/*
* File: Candidate.h
* Description: The Candidate class stores and manages a candidates information.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -5,27 +11,27 @@
class Candidate
{
private:
static int m_uid;
std::string m_id;
std::string m_name;
long int m_phone;
std::string m_phone;
std::string m_qualification;
Enums::CandidateStatus m_status;
public:
Candidate() : m_id(""), m_name(""), m_phone(0), m_qualification(""), m_status(Enums::CandidateStatus::PENDING) {}
Candidate(const std::string& id,
const std::string& name,
long int phone,
Candidate() : m_id("CD" + std::to_string(++m_uid)), m_name(""), m_phone(""), m_qualification(""), m_status(Enums::CandidateStatus::PENDING) {}
Candidate(const std::string& name,
const std::string& phone,
const std::string& qualification,
Enums::CandidateStatus status)
: m_id(id), m_name(name), m_phone(phone), m_qualification(qualification), m_status(status) {}
: m_id("CD" + std::to_string(++m_uid)), m_name(name), m_phone(phone), m_qualification(qualification), m_status(status) {}
const std::string& getCandidateId() const;
const std::string& getCandidateName() const;
long int getCandidatePhone() const;
const std::string& getCandidatePhone() const;
const std::string& getCandidateQualification() const;
Enums::CandidateStatus getCandidateStatus() const;
void setCandidateId(const std::string& id);
void setCandidateName(const std::string& name);
void setCandidatePhone(long int phone);
void setCandidatePhone(const std::string& phone);
void setCandidateQualification(const std::string& qualification);
void setCandidateStatus(Enums::CandidateStatus status);
};
+209 -7
View File
@@ -1,6 +1,51 @@
/*
* File: Employee.cpp
* Description: The Employee class manages employee information and associated work records such as payroll, attendance, leaves, and payslips.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include <sstream>
#include "Employee.h"
#include "Factory.h"
#include "StringHelper.h"
#include "Admin.h"
#include "HRManager.h"
#include "ITExecutive.h"
#include "TalentExecutive.h"
#include "TeamExecutive.h"
#include "FinanceExecutive.h"
#include "GeneralEmployee.h"
const std::string& Employee::getEmployeeId() const
int Employee::m_uid = 0;
Employee::Employee(const std::string& id,
const std::string& name,
const std::string& phone,
const std::string& password,
const std::string& email,
const std::string& teamId,
Enums::TeamStatus teamStatus,
Enums::EmployeeType employeeType,
Enums::AccountStatus accountStatus)
: m_id(id),
m_password(password),
m_name(name),
m_phone(phone),
m_email(email),
m_accountStatus(accountStatus),
m_teamStatus(teamStatus),
m_teamId(teamId),
m_employeeType(employeeType),
m_payroll()
{
int idNumber = util::extractNumber(m_id);
if (idNumber > m_uid)
{
m_uid = idNumber;
}
}
const std::string& Employee::getId() const
{
return m_id;
}
@@ -40,7 +85,7 @@ const std::string& Employee::getEmployeeTeamId() const
return m_teamId;
}
std::shared_ptr<Payroll> Employee::getPayroll() const
Payroll* Employee::getPayroll() const
{
return m_payroll;
}
@@ -60,6 +105,16 @@ const leaveMap& Employee::getEmployeeLeaves() const
return m_leaves;
}
Enums::EmployeeType Employee::getEmployeeType() const
{
return m_employeeType;
}
std::string Employee::getHeaders()
{
return "EmployeeId,Email,Name,Phone,Password,TeamID,TeamStatus,AccountStatus,EmployeeType";
}
void Employee::setEmployeeId(const std::string& id)
{
m_id = id;
@@ -95,20 +150,36 @@ 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)
/*
* Function: addPayslip
* Description : Adds a payslip to the employee's payslip records
* Parameters :
payslip - Pointer to the Payslip object to be added
* Returns :
void
*/
void Employee::addPayslip(Payslip* payslip)
{
if (payslip)
{
m_payslips[payslip->getPayslipId()] = payslip;
m_payslips[payslip->getId()] = payslip;
}
}
void Employee::addAttendance(std::shared_ptr<Attendance> attendance)
/*
* Function: addAttendance
* Description: Adds an attendance record to the employee's attendance history
* Parameters:
* attendance - Pointer to the Attendance object containing login information
* Returns:
* void
*/
void Employee::addAttendance(Attendance* attendance)
{
if (attendance)
{
@@ -116,10 +187,141 @@ void Employee::addAttendance(std::shared_ptr<Attendance> attendance)
}
}
void Employee::addLeave(std::shared_ptr<Leave> leave)
/*
* Function: addLeave
* Description: Adds a leave record to the employee's leave history
* Parameters:
* leave - Pointer to the Leave object to be added
* Returns:
* void
*/
void Employee::addLeave(Leave* leave)
{
if (leave)
{
m_leaves[leave->getLeaveId()] = leave;
}
}
/*
* Function: serialize
* Description: Serializes the employee object's core details into a comma-separated string
* Parameters:
None
* Returns:
A string containing serialized employee data in CSV format
*/
std::string Employee::serialize() const
{
std::ostringstream serializedEmployee;
serializedEmployee << m_id << ','
<< m_email << ','
<< m_name << ','
<< m_phone << ','
<< m_password << ','
<< m_teamId << ','
<< Enums::getTeamStatusString(m_teamStatus) << ','
<< Enums::getAccountStatusString(m_accountStatus) << ','
<< Enums::getEmployeeTypeString(m_employeeType);
return serializedEmployee.str();
}
/*
* Function: deserialize
* Description: Creates and returns an Employee object from a serialized comma-separated record string
* Parameters:
record - A string containing serialized employee data in CSV format
* Returns:
Pointer to a newly created Employee object based on the employee type
*/
Employee* Employee::deserialize(const std::string& record)
{
std::string id, name, phone, password, email;
std::string teamId, teamStatusString, accountStatusString, employeeTypeString;
std::istringstream serializedEmployee(record);
getline(serializedEmployee, id, ',');
getline(serializedEmployee, email, ',');
getline(serializedEmployee, name, ',');
getline(serializedEmployee, phone, ',');
getline(serializedEmployee, password, ',');
getline(serializedEmployee, teamId, ',');
getline(serializedEmployee, teamStatusString, ',');
getline(serializedEmployee, accountStatusString, ',');
getline(serializedEmployee, employeeTypeString, ',');
Enums::TeamStatus teamStatus = Enums::getTeamStatus(teamStatusString);
Enums::AccountStatus accountStatus = Enums::getAccountStatus(accountStatusString);
Enums::EmployeeType employeeType = Enums::getEmployeeType(employeeTypeString);
switch (employeeType)
{
case Enums::EmployeeType::IT:
return Factory::getObject<ITExecutive>(
id,
name,
phone,
password,
email,
teamId,
teamStatus,
accountStatus
);
case Enums::EmployeeType::FINANCE:
return Factory::getObject<FinanceExecutive>(
id,
name,
phone,
password,
email,
teamId,
teamStatus,
accountStatus
);
case Enums::EmployeeType::HR:
return Factory::getObject<HRManager>(
id,
name,
phone,
password,
email,
teamId,
teamStatus,
accountStatus
);
case Enums::EmployeeType::TEAM:
return Factory::getObject<TeamExecutive>(
id,
name,
phone,
password,
email,
teamId,
teamStatus,
accountStatus
);
case Enums::EmployeeType::TALENT_ACQUISITION:
return Factory::getObject<TalentExecutive>(
id,
name,
phone,
password,
email,
teamId,
teamStatus,
accountStatus
);
case Enums::EmployeeType::ADMIN:
return Factory::getObject<Admin>(
id,
name,
phone,
password,
email,
teamId,
teamStatus,
accountStatus
);
case Enums::EmployeeType::GENERAL:
throw std::runtime_error("Cannot deserialize GeneralEmployee!");
default:
return nullptr;
}
}
+57 -19
View File
@@ -1,19 +1,26 @@
/*
* File: Employee.h
* Description: The Employee class manages employee information and associated work records such as payroll, attendance, leaves, and payslips.
* Author: Trenser
* Created: 31-Mar-2026
*/
#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>>;
#include "ApplicationConfig.h"
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
{
private:
protected:
static int m_uid;
std::string m_id;
std::string m_password;
std::string m_name;
@@ -22,21 +29,48 @@ 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;
Enums::EmployeeType m_employeeType;
public:
Employee() : m_id(""), m_password(""), m_name(""), m_phone(""), m_email(""), m_accountStatus(Enums::AccountStatus::ACTIVE), m_teamStatus(Enums::TeamStatus::NOT_IN_TEAM), m_teamId("") {}
Employee(const std::string& id,
const std::string& password,
const std::string& name,
Employee()
: m_id("EMP" + std::to_string(++m_uid)),
m_password(Config::Authentication::DEFAULT_PASSWORD),
m_name(""),
m_phone(""),
m_email(""),
m_accountStatus(Enums::AccountStatus::ACTIVE),
m_teamStatus(Enums::TeamStatus::NOT_IN_TEAM),
m_teamId(""),
m_payroll(nullptr),
m_employeeType(Enums::EmployeeType::GENERAL) {}
Employee(const std::string& name,
const std::string& phone,
const std::string& email,
Enums::EmployeeType employeeType,
Payroll* payroll)
: m_id("EMP" + std::to_string(++m_uid)),
m_password(Config::Authentication::DEFAULT_PASSWORD),
m_name(name),
m_phone(phone),
m_email(email),
m_accountStatus(Enums::AccountStatus::ACTIVE),
m_teamStatus(Enums::TeamStatus::NOT_IN_TEAM),
m_teamId(""),
m_employeeType(employeeType),
m_payroll(payroll) {}
Employee(const std::string& id,
const std::string& name,
const std::string& phone,
const std::string& password,
const std::string& email,
const std::string& teamId,
std::shared_ptr<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_payroll(payroll) {}
const std::string& getEmployeeId() const;
Enums::TeamStatus teamStatus,
Enums::EmployeeType employeeType,
Enums::AccountStatus accountStatus);
const std::string& getId() const;
const std::string& getEmployeePassword() const;
const std::string& getEmployeeName() const;
const std::string& getEmployeePhone() const;
@@ -44,7 +78,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;
@@ -55,9 +89,13 @@ 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);
~Employee() = default;
void setEmployeePayroll(Payroll* payroll);
void addPayslip(Payslip* payslip);
void addAttendance(Attendance* attendance);
void addLeave(Leave* leave);
Enums::EmployeeType getEmployeeType() const;
virtual std::string serialize() const;
static Employee* deserialize(const std::string&);
static std::string getHeaders();
virtual ~Employee() = default;
};
@@ -0,0 +1,7 @@
/*
* File: Faq.h
* Description: Faq model class.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include "Faq.h"
+11
View File
@@ -0,0 +1,11 @@
/*
* File: Faq.h
* Description: Faq model class.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
class Faq
{
};
@@ -1 +1,7 @@
/*
* File: FinanceExecutive.h
* Description: FinanceExecutive model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "FinanceExecutive.h"
@@ -1,7 +1,38 @@
/*
* File: FinanceExecutive.h
* Description: FinanceExecutive model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
class FinanceExecutive : public Employee
{
public:
FinanceExecutive() = default;
FinanceExecutive(
const std::string& name,
const std::string& phone,
const std::string& email,
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::FINANCE, payroll) {};
FinanceExecutive(const std::string& id,
const std::string& name,
const std::string& phone,
const std::string& password,
const std::string& email,
const std::string& teamId,
Enums::TeamStatus teamStatus,
Enums::AccountStatus accountStatus)
: Employee(id,
name,
phone,
password,
email,
teamId,
teamStatus,
Enums::EmployeeType::FINANCE,
accountStatus) {}
~FinanceExecutive() = default;
};
@@ -1,11 +1,88 @@
/*
* File: GeneralEmployee.h
* Description: The GeneralEmployee class represents a general employee with a specific designation.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include <sstream>
#include "GeneralEmployee.h"
#include "Factory.h"
Enums::EmployeeDesignation GeneralEmployee::getDesignation() const
{
return m_designation;
}
std::string GeneralEmployee::getHeaders()
{
return "EmployeeId,Email,Name,Phone,Password,TeamID,TeamStatus,AccountStatus,EmployeeType,EmployeeDesignation";
}
void GeneralEmployee::setDesignation(Enums::EmployeeDesignation designation)
{
m_designation = designation;
}
/*
* Function: serialize
* Description: Serializes the general employee's details, including designation, into a comma-separated string
* Parameters:
None
* Returns:
A string containing serialized general employee data in CSV format
*/
std::string GeneralEmployee::serialize() const
{
std::ostringstream serializedEmployee;
serializedEmployee << m_id << ','
<< m_email << ','
<< m_name << ','
<< m_phone << ','
<< m_password << ','
<< m_teamId << ','
<< Enums::getTeamStatusString(m_teamStatus) << ','
<< Enums::getAccountStatusString(m_accountStatus) << ','
<< Enums::getEmployeeTypeString(m_employeeType) << ','
<< Enums::getEmployeeDesignationString(m_designation);
return serializedEmployee.str();
}
/*
* Function: deserialize
* Description: Creates and returns a GeneralEmployee object from a serialized comma-separated record string
* Parameters:
record - A string containing serialized general employee data in CSV format
* Returns:
Pointer to a newly created GeneralEmployee object
*/
GeneralEmployee* GeneralEmployee::deserialize(const std::string& record)
{
std::string id, name, phone, password, email;
std::string teamId, teamStatusString, accountStatusString, employeeTypeString, employeeDesignationString;
std::istringstream serializedEmployee(record);
getline(serializedEmployee, id, ',');
getline(serializedEmployee, email, ',');
getline(serializedEmployee, name, ',');
getline(serializedEmployee, phone, ',');
getline(serializedEmployee, password, ',');
getline(serializedEmployee, teamId, ',');
getline(serializedEmployee, teamStatusString, ',');
getline(serializedEmployee, accountStatusString, ',');
getline(serializedEmployee, employeeTypeString, ',');
getline(serializedEmployee, employeeDesignationString, ',');
Enums::TeamStatus teamStatus = Enums::getTeamStatus(teamStatusString);
Enums::AccountStatus accountStatus = Enums::getAccountStatus(accountStatusString);
Enums::EmployeeType employeeType = Enums::getEmployeeType(employeeTypeString);
Enums::EmployeeDesignation employeeDesignation = Enums::getEmployeeDesignation(employeeDesignationString);
return Factory::getObject<GeneralEmployee>(
id,
name,
phone,
password,
email,
teamId,
teamStatus,
employeeDesignation,
accountStatus
);
}
@@ -1,3 +1,9 @@
/*
* File: GeneralEmployee.h
* Description: The GeneralEmployee class represents a general employee with a specific designation.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
#include "Enums.h"
@@ -7,17 +13,42 @@ class GeneralEmployee : public Employee
private:
Enums::EmployeeDesignation m_designation;
public:
GeneralEmployee() : m_designation(Enums::EmployeeDesignation::JUNIOR) {}
GeneralEmployee(const std::string& id,
const std::string& password,
const std::string& name,
GeneralEmployee()
: m_designation(Enums::EmployeeDesignation::JUNIOR) {}
GeneralEmployee(const std::string& name,
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, payroll), m_designation(designation) {}
: Employee(name,
phone,
email,
Enums::EmployeeType::GENERAL,
payroll),
m_designation(designation) {}
GeneralEmployee(const std::string& id,
const std::string& name,
const std::string& phone,
const std::string& password,
const std::string& email,
const std::string& teamId,
Enums::TeamStatus teamStatus,
Enums::EmployeeDesignation employeeDesignation,
Enums::AccountStatus accountStatus)
: Employee(id,
name,
phone,
password,
email,
teamId,
teamStatus,
Enums::EmployeeType::GENERAL,
accountStatus),
m_designation(employeeDesignation) {}
Enums::EmployeeDesignation getDesignation() const;
void setDesignation(Enums::EmployeeDesignation designation);
std::string serialize() const override;
static GeneralEmployee* deserialize(const std::string&);
static std::string getHeaders();
~GeneralEmployee() = default;
};
@@ -1 +1,7 @@
/*
* File: HRManager.cpp
* Description: HRManager model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "HRManager.h"
+32 -1
View File
@@ -1,7 +1,38 @@
/*
* File: HRManager.h
* Description: HRManager model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
class HRManager : public Employee
{
public:
HRManager() = default;
HRManager(
const std::string& name,
const std::string& phone,
const std::string& email,
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::HR, payroll) {};
HRManager(const std::string& id,
const std::string& name,
const std::string& phone,
const std::string& password,
const std::string& email,
const std::string& teamId,
Enums::TeamStatus teamStatus,
Enums::AccountStatus accountStatus)
: Employee(id,
name,
phone,
password,
email,
teamId,
teamStatus,
Enums::EmployeeType::HR,
accountStatus) {}
~HRManager() = default;
};
@@ -1 +1,7 @@
/*
* File: ITExecutive.cpp
* Description: ITExecutive model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#include "ITExecutive.h"
@@ -1,7 +1,38 @@
/*
* File: ITExecutive.h
* Description: ITExecutive model class.
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
class ITExecutive : public Employee
{
public:
ITExecutive() = default;
ITExecutive(
const std::string& name,
const std::string& phone,
const std::string& email,
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::IT, payroll) {};
ITExecutive(const std::string& id,
const std::string& name,
const std::string& phone,
const std::string& password,
const std::string& email,
const std::string& teamId,
Enums::TeamStatus teamStatus,
Enums::AccountStatus accountStatus)
: Employee(id,
name,
phone,
password,
email,
teamId,
teamStatus,
Enums::EmployeeType::IT,
accountStatus) {}
~ITExecutive() = default;
};
@@ -1,5 +1,13 @@
/*
File: JobListing.cpp
* Description : Represents a job opening along with its details and applied candidates.
* Author : Trenser
* Created : 01-Apr-2026
*/
#include "JobListing.h"
int JobListing::m_uid = 0;
const std::string& JobListing::getJobId() const
{
return m_id;
@@ -1,14 +1,20 @@
/*
File: JobListing.h
* Description : Represents a job opening along with its details and applied candidates.
* Author : Trenser
* Created : 01-Apr-2026
*/
#pragma once
#include <string>
#include <map>
#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
{
private:
static int m_uid;
std::string m_id;
std::string m_name;
std::string m_description;
@@ -16,14 +22,13 @@ private:
int m_numberOfVacancies;
candidateMap m_candidates;
public:
JobListing() : m_id(""), m_name(""), m_description(""), m_status(Enums::JobListingStatus::CLOSED), m_numberOfVacancies(0) {}
JobListing(const std::string& id,
const std::string& name,
JobListing() : m_id("JL" + std::to_string(++m_uid)), m_name(""), m_description(""), m_status(Enums::JobListingStatus::CLOSED), m_numberOfVacancies(0) {}
JobListing(const std::string& name,
const std::string& description,
Enums::JobListingStatus status,
int numberOfVacancies,
const candidateMap& candidates)
: m_id(id), m_name(name), m_description(description), m_status(status), m_numberOfVacancies(numberOfVacancies), m_candidates(candidates) {}
: m_id("JL" + std::to_string(++m_uid)), m_name(name), m_description(description), m_status(status), m_numberOfVacancies(numberOfVacancies), m_candidates(candidates) {}
const std::string& getJobId() const;
const std::string& getJobName() const;
const std::string& getJobDescription() const;
+8 -36
View File
@@ -1,5 +1,13 @@
/*
File: Leave.cpp
* Description : Stores information related to an employees leave application.
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Leave.h"
int Leave::m_uid = 0;
const std::string& Leave::getLeaveId() const
{
return m_id;
@@ -20,21 +28,6 @@ const std::string& Leave::getLeaveReason() const
return m_reason;
}
int Leave::getNumberOfGeneralLeave()
{
return m_numberOfGeneralLeave;
}
int Leave::getNumberOfRestrictedLeave()
{
return m_numberOfRestrictedLeave;
}
int Leave::getNumberOfMedicalLeave()
{
return m_numberOfMedicalLeave;
}
Enums::LeaveType Leave::getLeaveType() const
{
return m_leaveType;
@@ -60,28 +53,7 @@ void Leave::setLeaveReason(const std::string& reason)
m_reason = reason;
}
void Leave::setNumberOfGeneralLeave(int value)
{
m_numberOfGeneralLeave = value;
}
void Leave::setNumberOfRestrictedLeave(int value)
{
m_numberOfRestrictedLeave = value;
}
void Leave::setNumberOfMedicalLeave(int value)
{
m_numberOfMedicalLeave = value;
}
void Leave::setLeaveType(Enums::LeaveType type)
{
m_leaveType = type;
}
int Leave::m_numberOfGeneralLeave = 12;
int Leave::m_numberOfRestrictedLeave = 2;
int Leave::m_numberOfMedicalLeave = 6;
+10 -13
View File
@@ -1,3 +1,9 @@
/*
File: Leave.h
* Description : Stores information related to an employees leave application.
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -6,36 +12,27 @@
class Leave
{
private:
static int m_uid;
std::string m_id;
std::string m_employeeId;
util::Timestamp m_timestamp;
std::string m_reason;
static int m_numberOfGeneralLeave;
static int m_numberOfRestrictedLeave;
static int m_numberOfMedicalLeave;
Enums::LeaveType m_leaveType;
public:
Leave() : m_id(""), m_employeeId(""), m_timestamp(), m_reason(""), m_leaveType(Enums::LeaveType::GENERAL) {}
Leave(const std::string& id,
const std::string& employeeId,
Leave() : m_id("LV" + std::to_string(++m_uid)), m_employeeId(""), m_timestamp(), m_reason(""), m_leaveType(Enums::LeaveType::GENERAL) {}
Leave(const std::string& employeeId,
const util::Timestamp& timestamp,
const std::string& reason,
Enums::LeaveType leaveType)
: m_id(id), m_employeeId(employeeId), m_timestamp(timestamp), m_reason(reason), m_leaveType(leaveType) {}
: m_id("LV" + std::to_string(++m_uid)), m_employeeId(employeeId), m_timestamp(timestamp), m_reason(reason), m_leaveType(leaveType) {}
const std::string& getLeaveId() const;
const std::string& getEmployeeId() const;
const util::Timestamp& getTimestamp() const;
const std::string& getLeaveReason() const;
static int getNumberOfGeneralLeave();
static int getNumberOfRestrictedLeave();
static int getNumberOfMedicalLeave();
Enums::LeaveType getLeaveType() const;
void setLeaveId(const std::string& id);
void setEmployeeId(const std::string& employeeId);
void setTimestamp(const util::Timestamp& timestamp);
void setLeaveReason(const std::string& reason);
void setNumberOfGeneralLeave(int value);
void setNumberOfRestrictedLeave(int value);
void setNumberOfMedicalLeave(int value);
void setLeaveType(Enums::LeaveType type);
};
@@ -1,3 +1,9 @@
/*
File: Log.cpp
* Description : Represents a log entry containing a timestamp and an associated message.
* Author : Trenser
* Created : 01-Apr-2026
*/
#include "Log.h"
const util::Timestamp& Log::getTimestamp() const
+8 -2
View File
@@ -1,3 +1,9 @@
/*
File: Log.h
* Description : Represents a log entry containing a timestamp and an associated message.
* Author : Trenser
* Created : 01-Apr-2026
*/
#pragma once
#include <string>
#include "Timestamp.h"
@@ -9,8 +15,8 @@ private:
std::string m_message;
public:
Log() : m_timestamp(), m_message("") {}
Log(const util::Timestamp& timestamp, const std::string& message)
: m_timestamp(timestamp), m_message(message) {}
Log(const std::string& message)
: m_timestamp(), m_message(message) {}
const util::Timestamp& getTimestamp() const;
const std::string& getMessage() const;
void setTimestamp(const util::Timestamp& timestamp);
@@ -1,5 +1,13 @@
/*
File: Notification.cpp
* Description : Represents an employee notification with message and status details.
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Notification.h"
int Notification::m_uid = 0;
const std::string& Notification::getNotificationId() const
{
return m_id;
@@ -1,3 +1,9 @@
/*
File: Notification.h
* Description : Represents an employee notification with message and status details.
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -6,18 +12,18 @@
class Notification
{
private:
static int m_uid;
std::string m_id;
std::string m_employeeId;
std::string m_message;
util::Timestamp m_timestamp;
Enums::NotificationStatus m_notificationStatus;
public:
Notification() : m_id(""), m_employeeId(""), m_message(""), m_timestamp(), m_notificationStatus(Enums::NotificationStatus::UNREAD) {}
Notification(const std::string& id,
const std::string& employeeId,
Notification() : m_id("NF" + std::to_string(++m_uid)), m_employeeId(""), m_message(""), m_timestamp(), m_notificationStatus(Enums::NotificationStatus::UNREAD) {}
Notification(const std::string& employeeId,
const std::string& message,
Enums::NotificationStatus notificationStatus)
: m_id(id), m_employeeId(employeeId), m_message(message), m_notificationStatus(notificationStatus) {}
: m_id("NF" + std::to_string(++m_uid)), m_employeeId(employeeId), m_message(message), m_notificationStatus(notificationStatus) {}
const std::string& getNotificationId() const;
const std::string& getEmployeeId() const;
const std::string& getNotificationMessage() const;
+115 -3
View File
@@ -1,10 +1,53 @@
/*
File: Payroll.cpp
* Description : Stores payroll and salary breakdown details for an employee.
* Author : Trenser
* Created : 31-Mar-2026
*/
#include <sstream>
#include "Payroll.h"
#include "StringHelper.h"
#include "Factory.h"
const std::string& Payroll::getPayrollId() const
int Payroll::m_uid = 0;
Payroll::Payroll(const std::string& id,
const std::string& employeeId,
double basicSalary,
double houseRentAllowance,
double foodAllowance,
double employeePFContribution,
double employerPFContribution)
: m_id(id),
m_employeeId(employeeId),
m_basicSalary(basicSalary),
m_houseRentAllowance(houseRentAllowance),
m_foodAllowance(foodAllowance),
m_employeePFContribution(employeePFContribution),
m_employerPFContribution(employerPFContribution)
{
int idNumber = util::extractNumber(m_id);
if (idNumber > m_uid)
{
m_uid = idNumber;
}
}
const std::string& Payroll::getId() const
{
return m_id;
}
const std::string& Payroll::getEmployeeId() const
{
return m_employeeId;
}
void Payroll::setEmployeeId(const std::string& employeeId)
{
m_employeeId = employeeId;
}
double Payroll::getBasicSalary() const
{
return m_basicSalary;
@@ -30,9 +73,14 @@ double Payroll::getEmployerPFContribution() const
return m_employerPFContribution;
}
void Payroll::setPayrollID(const std::string& id)
std::string Payroll::getHeaders()
{
m_id = id;
return "PayrollId,EmployeeId,BasicSalary,HouseRentAllowance,FoodAllowance,EmployeePFContribution,EmployerPFContribution";
}
void Payroll::setBasicSalary(double basicSalary)
{
m_basicSalary = basicSalary;
}
void Payroll::setHouseRentAllowance(double value)
@@ -54,3 +102,67 @@ void Payroll::setEmployerPFContribution(double value)
{
m_employerPFContribution = value;
}
/*
Function: serialize
Description: Converts the payroll object into a comma-separated string.
Parameters:
None
Returns:
A serialized string representation of the payroll.
*/
std::string Payroll::serialize() const
{
std::ostringstream serializedPayroll;
serializedPayroll << m_id << ','
<< m_employeeId << ','
<< m_basicSalary << ','
<< m_houseRentAllowance << ','
<< m_foodAllowance << ','
<< m_employeePFContribution << ','
<< m_employerPFContribution;
return serializedPayroll.str();
}
/*
Function: deserialize
Description: Creates a Payroll object from a serialized comma-separated string.
Parameters:
record - Serialized payroll data.
Returns:
Pointer to a Payroll object.
*/
Payroll* Payroll::deserialize(const std::string& record)
{
std::string id, employeeId;
std::string basicSalaryString, houseRentAllowanceString, foodAllowanceString, employeePFString, employerPFString;
std::istringstream serializedPayroll(record);
std::getline(serializedPayroll, id, ',');
std::getline(serializedPayroll, employeeId, ',');
std::getline(serializedPayroll, basicSalaryString, ',');
std::getline(serializedPayroll, houseRentAllowanceString, ',');
std::getline(serializedPayroll, foodAllowanceString, ',');
std::getline(serializedPayroll, employeePFString, ',');
std::getline(serializedPayroll, employerPFString, ',');
try
{
double basicSalary = std::stod(basicSalaryString);
double houseRentAllowance = std::stod(houseRentAllowanceString);
double foodAllowance = std::stod(foodAllowanceString);
double employeePFContribution = std::stod(employeePFString);
double employerPFContribution = std::stod(employerPFString);
return Factory::getObject<Payroll>(
id,
employeeId,
basicSalary,
houseRentAllowance,
foodAllowance,
employeePFContribution,
employerPFContribution
);
}
catch (...)
{
throw std::runtime_error("Failed to deserialize Payroll object");
}
}
+42 -10
View File
@@ -1,33 +1,65 @@
/*
File: Payroll.h
* Description : Stores payroll and salary breakdown details for an employee.
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include "Timestamp.h"
class Payroll
{
private:
static int m_uid;
std::string m_id;
std::string m_employeeId;
double m_basicSalary;
double m_houseRentAllowance;
double m_foodAllowance;
double m_employeePFContribution;
double m_employerPFContribution;
util::Timestamp m_timestamp;
public:
Payroll() : m_id(""), m_basicSalary(0.0), m_houseRentAllowance(0.0), m_foodAllowance(0.0), m_employeePFContribution(0.0), m_employerPFContribution(0.0) {}
Payroll(const std::string& id,
double basicSalary,
Payroll()
: m_id("PR" + std::to_string(++m_uid)),
m_basicSalary(0.0),
m_houseRentAllowance(0.0),
m_foodAllowance(0.0),
m_employeePFContribution(0.0),
m_employerPFContribution(0.0) {}
Payroll(double basicSalary,
double houseRentAllowance,
double foodAllowance,
double employeePFContribution,
double employerPFContribution)
: m_id(id), m_basicSalary(basicSalary), m_houseRentAllowance(houseRentAllowance), m_foodAllowance(foodAllowance), m_employeePFContribution(employeePFContribution), m_employerPFContribution(employerPFContribution) {}
const std::string& getPayrollId() const;
: m_id("PR" + std::to_string(++m_uid)),
m_basicSalary(basicSalary),
m_houseRentAllowance(houseRentAllowance),
m_foodAllowance(foodAllowance),
m_employeePFContribution(employeePFContribution),
m_employerPFContribution(employerPFContribution) {}
Payroll(const std::string& id,
const std::string& employeeId,
double basicSalary,
double houseRentAllowance,
double foodAllowance,
double employeePFContribution,
double employerPFContribution);
const std::string& getId() const;
const std::string& getEmployeeId() const;
void setEmployeeId(const std::string&);
double getBasicSalary() const;
double getHouseRentAllowance() const;
double getFoodAllowance() const;
double getEmployeePFContribution() const;
double getEmployerPFContribution() const;
void setPayrollID(const std::string& id);
void setHouseRentAllowance(double value);
void setFoodAllowance(double value);
void setEmployeePFContribution(double value);
void setEmployerPFContribution(double value);
static std::string getHeaders();
void setBasicSalary(double);
void setHouseRentAllowance(double);
void setFoodAllowance(double);
void setEmployeePFContribution(double);
void setEmployerPFContribution(double);
std::string serialize() const;
static Payroll* deserialize(const std::string&);
};
+96 -1
View File
@@ -1,6 +1,33 @@
/*
File: Payslip.cpp
* Description : Models a payslip entity that stores salary information.
* Author : Trenser
* Created : 31-Mar-2026
*/
#include <sstream>
#include "Payslip.h"
#include "StringHelper.h"
#include "Factory.h"
const std::string& Payslip::getPayslipId() const
int Payslip::m_uid = 0;
Payslip::Payslip(const std::string& id,
const std::string& employeeId,
double salary,
util::Timestamp timestamp)
: m_id(id),
m_employeeId(employeeId),
m_salary(salary),
m_timestamp(timestamp)
{
int idNumber = util::extractNumber(m_id);
if (idNumber > m_uid)
{
m_uid = idNumber;
}
}
const std::string& Payslip::getId() const
{
return m_id;
}
@@ -19,3 +46,71 @@ void Payslip::setSalary(double salary)
{
m_salary = salary;
}
const util::Timestamp& Payslip::getTimestamp() const
{
return m_timestamp;
}
const std::string& Payslip::getEmployeeId() const
{
return m_employeeId;
}
std::string Payslip::getHeaders()
{
return "PayslipId,EmployeeId,Salary,Timestamp";
}
/*
Function: serialize
Description: Converts the payslip object into a comma-separated string.
Parameters:
None
Returns:
A serialized string representation of the payslip.
*/
std::string Payslip::serialize() const
{
std::ostringstream serializedPayslip;
serializedPayslip << m_id << ','
<< m_employeeId << ','
<< m_salary << ','
<< m_timestamp.toString();
return serializedPayslip.str();
}
/*
Function: deserialize
Description: Creates a Payslip object from a serialized comma-separated string.
Parameters:
record - Serialized payslip data.
Returns:
Pointer to a Payslip object.
*/
Payslip* Payslip::deserialize(const std::string& record)
{
std::string id, employeeId, timestampString;
std::string salaryString;
std::istringstream serializedPayslip(record);
std::getline(serializedPayslip, id, ',');
std::getline(serializedPayslip, employeeId, ',');
std::getline(serializedPayslip, salaryString, ',');
std::getline(serializedPayslip, timestampString, ',');
try
{
double salary = std::stod(salaryString);
util::Timestamp timestamp = util::Timestamp::fromString(timestampString);
return Factory::getObject<Payslip>(
id,
employeeId,
salary,
timestamp
);
}
catch (...)
{
throw std::runtime_error("Failed to deserialize Payslip object");
}
}
+22 -3
View File
@@ -1,16 +1,35 @@
/*
File: Payslip.h
* Description : Models a payslip entity that stores salary information.
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include "Timestamp.h"
class Payslip
{
private:
static int m_uid;
std::string m_id;
std::string m_employeeId;
double m_salary;
util::Timestamp m_timestamp;
public:
Payslip() : m_id(""), m_salary(0.0) {}
Payslip(const std::string& id, double salary) : m_id(id), m_salary(salary) {}
const std::string& getPayslipId() const;
Payslip() : m_id("PS" + std::to_string(++m_uid)), m_employeeId(""), m_salary(0.0) {}
Payslip(const double salary, const std::string& employeeId) : m_id("PS" + std::to_string(++m_uid)), m_employeeId(employeeId), m_salary(salary) {}
Payslip(const std::string& id,
const std::string& employeeId,
double salary,
util::Timestamp timestamp);
const std::string& getId() const;
double getSalary() const;
static std::string getHeaders();
void setPayslipId(const std::string& id);
void setSalary(double salary);
const util::Timestamp& getTimestamp() const;
const std::string& getEmployeeId() const;
std::string serialize() const;
static Payslip* deserialize(const std::string&);
};
+17 -1
View File
@@ -1,5 +1,13 @@
/*
File: Room.cpp
* Description : Models a room entity that maintains room details and manages its bookings.
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Room.h"
int Room::m_uid = 0;
const std::string& Room::getRoomId() const
{
return m_id;
@@ -25,7 +33,15 @@ void Room::setRoomName(const std::string& name)
m_name = name;
}
void Room::addBooking(std::shared_ptr<Booking> booking)
/*
Function: addBooking
Description: Adds a valid booking to the rooms booking list using the booking ID as the key.
Parameters:
booking - A pointer to a Booking object to be added to the room.
Returns:
void
*/
void Room::addBooking(Booking* booking)
{
if (booking)
{
+11 -5
View File
@@ -1,23 +1,29 @@
/*
File: Room.h
* Description : Models a room entity that maintains room details and manages its bookings.
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#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
{
private:
static int m_uid;
std::string m_id;
std::string m_name;
bookingMap m_bookings;
public:
Room() : m_id(""), m_name("") {}
Room(const std::string& id, const std::string& name) : m_id(id), m_name(name) {}
Room() : m_id("RM" + std::to_string(++m_uid)), m_name("") {}
Room(const std::string& name) : m_id("RM" + std::to_string(++m_uid)), m_name(name) {}
const std::string& getRoomId() const;
const std::string& getRoomName() const;
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);
};
@@ -1 +1,7 @@
/*
File: TalentExecutive.cpp
* Description : Represents information related to a talent executive in the system.
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "TalentExecutive.h"
@@ -1,7 +1,39 @@
/*
File: TalentExecutive.h
* Description : Represents information related to a talent executive in the system.
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include "Employee.h"
class TalentExecutive : public Employee
{
public:
TalentExecutive() = default;
TalentExecutive(
const std::string& name,
const std::string& phone,
const std::string& email,
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::TALENT_ACQUISITION, payroll) {};
TalentExecutive(const std::string& id,
const std::string& name,
const std::string& phone,
const std::string& password,
const std::string& email,
const std::string& teamId,
Enums::TeamStatus teamStatus,
Enums::AccountStatus accountStatus)
: Employee(id,
name,
phone,
password,
email,
teamId,
teamStatus,
Enums::EmployeeType::TALENT_ACQUISITION,
accountStatus) {
}
~TalentExecutive() = default;
};
+10 -2
View File
@@ -1,5 +1,13 @@
/*
File: Team.cpp
* Description : Models a team entity that maintains team identity, leadership, employee list, and size limitations.
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Team.h"
int Team::m_uid = 0;
const std::string& Team::getTeamId() const
{
return m_id;
@@ -10,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;
}
@@ -35,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;
}
+15 -9
View File
@@ -1,34 +1,40 @@
/*
File: Team.h
* Description : Models a team entity that maintains team identity, leadership, employee list, and size limitations.
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#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:
static int m_uid;
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,
Team() : m_id("TM" + std::to_string(++m_uid)), m_name(""), m_lead(nullptr), m_maximumNumberOfEmployees(0) {}
Team(
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) {
: m_id("TM" + std::to_string(++m_uid)), 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);
};
@@ -1 +1,7 @@
/*
File: TeamExecutive.cpp
* Description : Represents information related to a team executive within the system.
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "TeamExecutive.h"
@@ -1,7 +1,38 @@
/*
File: TeamExecutive.h
* Description : Represents information related to a team executive within the system.
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include "Employee.h"
class TeamExecutive : public Employee
{
public:
TeamExecutive() = default;
TeamExecutive(
const std::string& name,
const std::string& phone,
const std::string& email,
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::TEAM, payroll) {};
TeamExecutive(const std::string& id,
const std::string& name,
const std::string& phone,
const std::string& password,
const std::string& email,
const std::string& teamId,
Enums::TeamStatus teamStatus,
Enums::AccountStatus accountStatus)
: Employee(id,
name,
phone,
password,
email,
teamId,
teamStatus,
Enums::EmployeeType::TEAM,
accountStatus) {}
~TeamExecutive() = default;
};
@@ -1,5 +1,13 @@
/*
File: Ticket.cpp
* Description : Represents a support ticket with its associated details and status.
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Ticket.h"
int Ticket::m_uid = 0;
const std::string& Ticket::getTicketId() const
{
return m_id;
+10 -3
View File
@@ -1,3 +1,9 @@
/*
File: Ticket.h
* Description : Represents a support ticket with its associated details and status.
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -5,19 +11,20 @@
class Ticket
{
private:
static int m_uid;
std::string m_id;
Enums::TicketType m_type;
std::string m_description;
Enums::TicketStatus m_status;
std::string m_employeeId;
public:
Ticket() : m_id(""), m_type(Enums::TicketType::UNKNOWN), m_description(""), m_status(Enums::TicketStatus::OPEN), m_employeeId("") {}
Ticket(const std::string& id,
Ticket() : m_id("TKT" + std::to_string(++m_uid)), m_type(Enums::TicketType::UNKNOWN), m_description(""), m_status(Enums::TicketStatus::OPEN), m_employeeId("") {}
Ticket(
Enums::TicketType type,
const std::string& description,
const std::string& employeeId,
Enums::TicketStatus status)
: m_id(id), m_type(type), m_description(description), m_status(status), m_employeeId(employeeId) {}
: m_id("TKT" + std::to_string(++m_uid)), m_type(type), m_description(description), m_status(status), m_employeeId(employeeId) {}
const std::string& getTicketId() const;
Enums::TicketType getTicketType() const;
const std::string& getDescription() const;
@@ -0,0 +1,7 @@
/*
* File: ApplicationConfig.cpp
* Description: Global Application Config
* Author: Trenser
* Created: 06-Apr-2026
*/
#include "ApplicationConfig.h"
@@ -0,0 +1,47 @@
/*
* File: ApplicationConfig.h
* Description: Global Application Config
* Author: Trenser
* Created: 06-Apr-2026
*/
#pragma once
namespace Config
{
namespace Authentication
{
constexpr const char* DEFAULT_PASSWORD = "password";
}
namespace Payroll
{
constexpr double SENIOR_BASIC_SALARY = 80000.0;
constexpr double SENIOR_HOUSE_RENT_ALLOWANCE = 32000.0;
constexpr double SENIOR_FOOD_ALLOWANCE = 3000.0;
constexpr double SENIOR_EMPLOYEE_PF_CONTRIBUTION = 9600.0;
constexpr double SENIOR_EMPLOYER_PF_CONTRIBUTION = 9600.0;
constexpr double JUNIOR_BASIC_SALARY = 25000.0;
constexpr double JUNIOR_HOUSE_RENT_ALLOWANCE = 10000.0;
constexpr double JUNIOR_FOOD_ALLOWANCE = 1500.0;
constexpr double JUNIOR_EMPLOYEE_PF_CONTRIBUTION = 3000.0;
constexpr double JUNIOR_EMPLOYER_PF_CONTRIBUTION = 3000.0;
constexpr double HR_MANAGER_BASIC_SALARY = 60000.0;
constexpr double HR_MANAGER_HOUSE_RENT_ALLOWANCE = 24000.0;
constexpr double HR_MANAGER_FOOD_ALLOWANCE = 2500.0;
constexpr double HR_MANAGER_EMPLOYEE_PF_CONTRIBUTION = 7200.0;
constexpr double HR_MANAGER_EMPLOYER_PF_CONTRIBUTION = 7200.0;
constexpr double EXECUTIVE_BASIC_SALARY = 45000.0;
constexpr double EXECUTIVE_HOUSE_RENT_ALLOWANCE = 18000.0;
constexpr double EXECUTIVE_FOOD_ALLOWANCE = 2000.0;
constexpr double EXECUTIVE_EMPLOYEE_PF_CONTRIBUTION = 5400.0;
constexpr double EXECUTIVE_EMPLOYER_PF_CONTRIBUTION = 5400.0;
}
namespace File
{
constexpr const char* EMPLOYEES_FILE = "files/Employee.csv";
constexpr const char* GENERAL_EMPLOYEES_FILE = "files/GeneralEmployee.csv";
constexpr const char* PAYROLL_FILE = "files/Payroll.csv";
constexpr const char* PAYSLIP_FILE = "files/Payslip.csv";
}
}
@@ -1 +1,7 @@
/*
* File: AttendanceManagementService.cpp
* Description: Handles Attendance related operations
* Author: Trenser
* Created: 30-Apr-2026
*/
#include "AttendanceManagementService.h"
@@ -1,3 +1,9 @@
/*
* File: AttendanceManagementService.h
* Description: Handles Attendance related operations
* Author: Trenser
* Created: 30-Apr-2026
*/
#pragma once
class AttendanceManagementService
{
@@ -1 +1,113 @@
/*
* File: AuthenticationManagementService.cpp
* Description: Handles authentication related operations
* Author: Trenser
* Created: 30-Mar-2026
*/
#include <stdexcept>
#include "AuthenticationManagementService.h"
#include "ApplicationConfig.h"
/*
* Function: login
* Description: Authenticates a user using email and password, determines login status,
* employee type, and designation, and sets the authenticated employee
* in the data store.
* Parameters:
* email - employee email address
* password - employee password
* Returns:
* AuthenticationDTO containing login status, employee type, and employee designation
*/
AuthenticationDTO AuthenticationManagementService::login(const std::string& email, const std::string& password)
{
employeeMap& employees = m_dataStore.getEmployees();
Enums::LoginStatus loginStatus = Enums::LoginStatus::USER_NOT_FOUND;
Enums::EmployeeType employeeType = Enums::EmployeeType::INVALID;
Enums::EmployeeDesignation employeeDesignation = Enums::EmployeeDesignation::INVALID;
for (const auto& employee : employees)
{
if (employee.second->getEmployeeEmail() == email)
{
if (employee.second->getEmployeePassword() == password)
{
if (employee.second->getEmployeeAccountStatus() == Enums::AccountStatus::INACTIVE)
{
throw std::runtime_error("Your account has been disabled! Please contact your Administrator.");
}
if (password == Config::Authentication::DEFAULT_PASSWORD)
{
loginStatus = Enums::LoginStatus::FIRST_LOGIN;
}
else
{
loginStatus = Enums::LoginStatus::SUCCESS;
}
employeeType = employee.second->getEmployeeType();
if (employeeType == Enums::EmployeeType::GENERAL)
{
GeneralEmployee* generalEmployee = dynamic_cast<GeneralEmployee*>(employee.second);
if (generalEmployee)
{
employeeDesignation = generalEmployee->getDesignation();
}
else
{
throw std::runtime_error("Invalid Employee Type");
}
}
m_dataStore.setAuthenticatedEmployee(employee.second);
}
else
{
loginStatus = Enums::LoginStatus::INVALID_PASSWORD;
}
break;
}
}
return std::make_tuple(loginStatus, employeeType, employeeDesignation);
}
/*
* Function: changePassword
* Description: Updates the password of the currently authenticated user.
* Parameters:
* password - new password to be set
* Returns:
* None
* Throws:
* runtime_error if no authenticated user is found
*/
void AuthenticationManagementService::changePassword(const std::string& password)
{
Employee* authenticatedUser = m_dataStore.getAuthenticatedEmployee();
if (authenticatedUser)
{
authenticatedUser->setEmployeePassword(password);
}
else
{
throw std::runtime_error("User not found");
}
}
/*
* Function: logout
* Description: Logs out the currently authenticated user by clearing authentication data.
* Parameters:
* None
* Returns:
* None
* Throws:
* runtime_error if no user is currently logged in
*/
void AuthenticationManagementService::logout() {
if (m_dataStore.getAuthenticatedEmployee())
{
m_dataStore.getAuthenticatedEmployee() = nullptr;
}
else
{
throw std::runtime_error("No user currently logged In...");
}
}
@@ -1,5 +1,27 @@
/*
* File: AuthenticationManagementService.h
* Description: Handles authentication related operations
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
#include <string>
#include <map>
#include <tuple>
#include <utility>
#include <stdexcept>
#include "DataStore.h"
#include "Enums.h"
using AuthenticationDTO = std::tuple<Enums::LoginStatus, Enums::EmployeeType, Enums::EmployeeDesignation>;
class AuthenticationManagementService
{
private:
DataStore& m_dataStore;
public:
AuthenticationManagementService() : m_dataStore(DataStore::getInstance()) {};
AuthenticationDTO login(const std::string& username, const std::string& password);
void logout();
void changePassword(const std::string&);
};
@@ -1 +1,7 @@
/*
* File: BookingManagementService.cpp
* Description: Handle operations related to booking meetings
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "BookingManagementService.h"
@@ -1,3 +1,9 @@
/*
* File: BookingManagementService.h
* Description: Handle operations related to booking meetings
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class BookingManagementService
{
@@ -1 +0,0 @@
#include "EmployeeManagememtService.h"
@@ -1,5 +0,0 @@
#pragma once
class EmployeeManagememtService
{
};
@@ -0,0 +1,341 @@
/*
* File: EmployeeManagementService.h
* Description: Provides services for managing employees, including creation, deactivation,
* designation updates, profile modifications, searching, and retrieval of
* shortlisted candidates.
* Author: Trenser
* Created: 07-Apr-2026
*/
#include <map>
#include <algorithm>
#include <stdexcept>
#include "EmployeeManagementService.h"
#include "Factory.h"
#include "Validator.h"
#include "AuthorizationHelper.h"
#include "Enums.h"
#include "HRManager.h"
#include "ITExecutive.h"
#include "TalentExecutive.h"
#include "TeamExecutive.h"
#include "FinanceExecutive.h"
#include "GeneralEmployee.h"
#include "FileManager.h"
#include "ApplicationConfig.h"
/*
* Function: createEmployee
* Description: Creates a new employee of the specified type and designation, validates
* email and phone, enforces authorization, and associates payroll.
* Parameters:
* employeeType - type of employee (HR, IT, Finance, Team, Talent Acquisition, General)
* employeeDesignation - designation for general employees (Junior, Senior)
* email - employee email address
* name - employee name
* phone - employee phone number
* Returns:
* None
*/
void EmployeeManagementService::createEmployee(Enums::EmployeeType employeeType, Enums::EmployeeDesignation employeeDesignation, const std::string& email, const std::string& name, const std::string& phone)
{
auto& employees = m_dataStore.getEmployees();
Employee* authenticatedEmployee = m_dataStore.getAuthenticatedEmployee();
if (!authenticatedEmployee)
{
throw std::runtime_error("No authenticated user");
}
Enums::EmployeeType authenticatedEmployeeType = authenticatedEmployee->getEmployeeType();
Employee* employee = nullptr;
Payroll* payroll = nullptr;
if (employeeType != Enums::EmployeeType::GENERAL && util::hasActiveEmployeeOfType(employeeType, employees))
{
throw std::runtime_error("Cannot create more than one employee of type " + Enums::getEmployeeTypeString(employeeType));
}
if (!util::isEmailValid(email))
{
throw std::runtime_error("Invalid Email");
}
if (!util::isPhoneNumberValid(phone))
{
throw std::runtime_error("Invalid Phone");
}
if (util::isEmailDuplicate(email, employees))
{
throw std::runtime_error("Duplicate Email");
}
if (util::isPhoneDuplicate(phone, employees))
{
throw std::runtime_error("Duplicate Phone Number!");
}
switch (employeeType)
{
case Enums::EmployeeType::HR:
util::enforceAuthorization(authenticatedEmployeeType, Enums::EmployeeType::ADMIN);
payroll = Factory::getObject<Payroll>(Config::Payroll::HR_MANAGER_BASIC_SALARY,
Config::Payroll::HR_MANAGER_HOUSE_RENT_ALLOWANCE,
Config::Payroll::HR_MANAGER_FOOD_ALLOWANCE,
Config::Payroll::HR_MANAGER_EMPLOYEE_PF_CONTRIBUTION,
Config::Payroll::HR_MANAGER_EMPLOYER_PF_CONTRIBUTION);
employee = Factory::getObject<HRManager>(name, phone, email, payroll);
break;
case Enums::EmployeeType::IT:
case Enums::EmployeeType::FINANCE:
case Enums::EmployeeType::TEAM:
case Enums::EmployeeType::TALENT_ACQUISITION:
util::enforceAuthorization(authenticatedEmployeeType, Enums::EmployeeType::ADMIN, Enums::EmployeeType::HR);
payroll = Factory::getObject<Payroll>(Config::Payroll::EXECUTIVE_BASIC_SALARY,
Config::Payroll::EXECUTIVE_HOUSE_RENT_ALLOWANCE,
Config::Payroll::EXECUTIVE_FOOD_ALLOWANCE,
Config::Payroll::EXECUTIVE_EMPLOYEE_PF_CONTRIBUTION,
Config::Payroll::EXECUTIVE_EMPLOYER_PF_CONTRIBUTION);
switch (employeeType)
{
case Enums::EmployeeType::IT:
employee = Factory::getObject<ITExecutive>(name, phone, email, payroll);
break;
case Enums::EmployeeType::FINANCE:
employee = Factory::getObject<FinanceExecutive>(name, phone, email, payroll);
break;
case Enums::EmployeeType::TEAM:
employee = Factory::getObject<TeamExecutive>(name, phone, email, payroll);
break;
case Enums::EmployeeType::TALENT_ACQUISITION:
employee = Factory::getObject <TalentExecutive> (name, phone, email, payroll);
break;
}
break;
case Enums::EmployeeType::GENERAL:
util::enforceAuthorization(authenticatedEmployeeType, Enums::EmployeeType::ADMIN, Enums::EmployeeType::HR);
switch (employeeDesignation)
{
case Enums::EmployeeDesignation::JUNIOR:
payroll = Factory::getObject<Payroll>(Config::Payroll::JUNIOR_BASIC_SALARY,
Config::Payroll::JUNIOR_HOUSE_RENT_ALLOWANCE,
Config::Payroll::JUNIOR_FOOD_ALLOWANCE,
Config::Payroll::JUNIOR_EMPLOYEE_PF_CONTRIBUTION,
Config::Payroll::JUNIOR_EMPLOYER_PF_CONTRIBUTION);
break;
case Enums::EmployeeDesignation::SENIOR:
payroll = Factory::getObject<Payroll>(Config::Payroll::SENIOR_BASIC_SALARY,
Config::Payroll::SENIOR_HOUSE_RENT_ALLOWANCE,
Config::Payroll::SENIOR_FOOD_ALLOWANCE,
Config::Payroll::SENIOR_EMPLOYEE_PF_CONTRIBUTION,
Config::Payroll::SENIOR_EMPLOYER_PF_CONTRIBUTION);
break;
default:
throw std::runtime_error("Invalid General Employee Designation");
}
employee = Factory::getObject<GeneralEmployee>(name, phone, email, payroll, employeeDesignation);
break;
default:
throw std::runtime_error("Invalid Employee Type");
}
payroll->setEmployeeId(employee->getId());
m_dataStore.getPayrolls().emplace(std::make_pair(payroll->getId(), payroll));
m_dataStore.getEmployees().emplace(std::make_pair(employee->getId(), employee));
}
/*
* Function: deactivateEmployee
* Description: Deactivates an employee account by setting its status to INACTIVE.
* Prevents deactivation of Admin accounts.
* Parameters:
* id - unique identifier of the employee
* Returns:
* bool - true if deactivation succeeded, false otherwise
*/
bool EmployeeManagementService::deactivateEmployee(const std::string& id)
{
auto& authenticatedEmployee = m_dataStore.getAuthenticatedEmployee();
util::enforceAuthorization(authenticatedEmployee->getEmployeeType(), Enums::EmployeeType::ADMIN, Enums::EmployeeType::HR);
auto& employee = m_dataStore.getEmployees();
auto iterator = employee.find(id);
if (iterator == employee.end())
{
return false;
}
if (iterator->second->getEmployeeType() == Enums::EmployeeType::ADMIN)
{
throw std::runtime_error("Cannot deactivate Admin Account");
}
iterator->second->setEmployeeAccountStatus(Enums::AccountStatus::INACTIVE);
return true;
}
/*
* Function: updateDesignation
* Description: Updates the designation of a general employee.
* Parameters:
* id - unique identifier of the employee
* designation - new designation to assign
* Returns:
* bool - true if update succeeded, false otherwise
*/
bool EmployeeManagementService::updateDesignation(const std::string& id, Enums::EmployeeDesignation designation)
{
auto& authenticatedEmployee = m_dataStore.getAuthenticatedEmployee();
util::enforceAuthorization(authenticatedEmployee->getEmployeeType(), Enums::EmployeeType::ADMIN, Enums::EmployeeType::HR);
std::map<std::string, Employee*> employees = m_dataStore.getEmployees();
auto employeeIterator = employees.find(id);
if (employeeIterator == employees.end())
{
return false;
}
auto generalEmployee = dynamic_cast<GeneralEmployee*>((*employeeIterator).second);
if (generalEmployee)
{
generalEmployee->setDesignation(designation);
}
return true;
}
/*
* Function: getCurrentEmployee
* Description: Retrieves the currently authenticated employee from the DataStore.
* Parameters:
* None
* Returns:
* const Employee* - pointer to the current employee
*/
const Employee* EmployeeManagementService::getCurrentEmployee()
{
return m_dataStore.getAuthenticatedEmployee();
}
/*
* Function: updateProfile
* Description: Updates the name and phone number of the currently authenticated employee.
* Parameters:
* name - new employee name
* phone - new employee phone number
* Returns:
* None
*/
void EmployeeManagementService::updateProfile(const std::string& name,const std::string& phone)
{
Employee* employee = m_dataStore.getAuthenticatedEmployee();
employee->setEmployeeName(name);
employee->setEmployeePhone(phone);
}
/*
* Function: searchEmployee
* Description: Searches employees by name and returns matches along
* with the type of the current authenticated employee.
* Parameters:
* name - search string for employee name
* Returns:
* pair<Enums::EmployeeType, vector<const Employee*>> - current user type and matching employees
*/
std::pair<Enums::EmployeeType, std::vector<const Employee*>> EmployeeManagementService::searchEmployee(const std::string& name)
{
Employee* currentUser = m_dataStore.getAuthenticatedEmployee();
Enums::EmployeeType employeeType = currentUser->getEmployeeType();
employeeMap& employees = m_dataStore.getEmployees();
std::vector<const Employee*> employeeList;
if (employees.empty())
{
return std::make_pair(employeeType, employeeList);
}
for (const auto& employeePair : employees) {
const auto& employee = employeePair.second;
if (!employee)
{
continue;
}
std::string employeeName = employee->getEmployeeName();
std::transform(employeeName.begin(), employeeName.end(), employeeName.begin(), ::tolower);
std::string searchName = name;
std::transform(searchName.begin(), searchName.end(), searchName.begin(), ::tolower);
if (employeeName.find(searchName) != std::string::npos)
{
employeeList.push_back(employee);
}
}
return { employeeType, employeeList };
}
/*
* Function: getShorlistedCandidates
* Description: Retrieves candidates with status SHORTLISTED from the DataStore.
* Parameters:
* None
* Returns:
* vector<Candidate*> - list of shortlisted candidates
*/
std::vector<Candidate*> EmployeeManagementService::getShorlistedCandidates()
{
candidateMap candidates = m_dataStore.getCandidates();
std::vector<Candidate*> shortlistedCandidates;
for (auto& candidate : candidates)
{
if (candidate.second->getCandidateStatus() == Enums::CandidateStatus::SHORTLISTED)
{
shortlistedCandidates.push_back(candidate.second);
}
}
return shortlistedCandidates;
}
/*
* Function: loadEmployees
* Description: Loads employees and general employees from FileManager into the DataStore.
* Parameters:
* None
* Returns:
* None
*/
void EmployeeManagementService::loadEmployees()
{
FileManager<Employee> employeeFileManager(Config::File::EMPLOYEES_FILE);
FileManager<GeneralEmployee> generalEmployeeFileManager(Config::File::GENERAL_EMPLOYEES_FILE);
bool isAdminFound = false;
auto& employees = m_dataStore.getEmployees();
auto employeesMap = employeeFileManager.load();
auto generalEmployeesMap = generalEmployeeFileManager.load();
employees.insert(employeesMap.begin(), employeesMap.end());
employees.insert(generalEmployeesMap.begin(), generalEmployeesMap.end());
for (auto& employeePair : employees)
{
if (employeePair.second->getEmployeeType() == Enums::EmployeeType::ADMIN)
{
isAdminFound = true;
break;
}
}
if (!isAdminFound)
{
auto admin = Factory::getObject<Admin>("Admin", "", "admin@trenser.com", nullptr);
employees.emplace(std::make_pair(admin->getId(), admin));
}
}
/*
* Function: saveEmployees
* Description: Saves employees and general employees from the DataStore into FileManager.
* Parameters:
* None
* Returns:
* None
*/
void EmployeeManagementService::saveEmployees()
{
FileManager<Employee> employeeFileManager(Config::File::EMPLOYEES_FILE);
FileManager<GeneralEmployee> generalEmployeeFileManager(Config::File::GENERAL_EMPLOYEES_FILE);
const auto& allEmployees = m_dataStore.getEmployees();
employeeMap employees;
std::map<std::string, GeneralEmployee*> generalEmployees;
for (auto& employeePair : allEmployees)
{
if (employeePair.second->getEmployeeType() == Enums::EmployeeType::GENERAL)
{
generalEmployees.emplace(employeePair.first, static_cast<GeneralEmployee*>(employeePair.second));
}
else
{
employees.emplace(employeePair);
}
}
employeeFileManager.save(employees);
generalEmployeeFileManager.save(generalEmployees);
}
@@ -0,0 +1,81 @@
/*
* File: EmployeeManagementService.h
* Description: Provides services for managing employees, including creation, deactivation,
* designation updates, profile modifications, searching, and retrieval of
* shortlisted candidates.
* Author: Trenser
* Created: 07-Apr-2026
*/
#pragma once
#include <vector>
#include <tuple>
#include <algorithm>
#include <utility>
#include "DataStore.h"
#include "Enums.h"
#include "StringHelper.h"
using Employees = std::vector<const Employee*>;
class EmployeeManagementService
{
private:
DataStore& m_dataStore;
public:
EmployeeManagementService() : m_dataStore(DataStore::getInstance()) {};
void createEmployee(Enums::EmployeeType, Enums::EmployeeDesignation, const std::string&, const std::string&, const std::string&);
bool deactivateEmployee(const std::string&);
bool updateDesignation(const std::string&, Enums::EmployeeDesignation);
void updateProfile(const std::string&, const std::string&);
std::pair<Enums::EmployeeType, std::vector<const Employee*>> searchEmployee(const std::string&);
const Employee* getCurrentEmployee();
std::vector<Candidate*> getShorlistedCandidates();
void loadEmployees();
void saveEmployees();
/*
* Function: getEmployees (template)
* Description: Retrieves active employees filtered by specified types. Excludes admin employees
* if no filter is provided.
* Parameters:
* types... - variadic list of employee types
* Returns:
* Employees - vector of pointers to filtered employees
*/
template<typename... Types>
Employees getEmployees(Types... types)
{
Employees filteredEmployees;
const auto& employees = m_dataStore.getEmployees();
std::vector<Enums::EmployeeType> filterTypes = { types... };
for (const auto& employeePair : employees)
{
const auto& employee = employeePair.second;
if (employee->getEmployeeAccountStatus() != Enums::AccountStatus::ACTIVE)
continue;
auto employeeType = employee->getEmployeeType();
if (filterTypes.empty())
{
if (employeeType == Enums::EmployeeType::ADMIN)
continue;
}
else
{
if (std::find(filterTypes.begin(), filterTypes.end(), employeeType) == filterTypes.end())
continue;
}
filteredEmployees.push_back(employee);
}
std::sort(
filteredEmployees.begin(),
filteredEmployees.end(),
[](const Employee* employeeOne,
const Employee* employeeTwo)
{
return util::extractNumber(employeeOne->getId()) <
util::extractNumber(employeeTwo->getId());
}
);
return filteredEmployees;
}
};
@@ -1 +1,7 @@
/*
* File: LeaveManagementService.cpp
* Description: Handle operations related to leaves
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "LeaveManagementService.h"
@@ -1,3 +1,9 @@
/*
* File: LeaveManagementService.h
* Description: Handle operations related to leaves
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class LeaveManagementService
{
@@ -1 +1,27 @@
/*
* File: Log.cpp
* Description: Handle operations related to logging
* Author: Trenser
* Created: 01-Apr-2026
*/
#include "LogService.h"
#include "Log.h"
#include "Factory.h"
#include "DataStore.h"
/*
* Function: log
* Description: Creates a new log entry with the given message, assigns a timestamp,
* and stores it in the DataStore.
* Parameters:
* message - string containing the log message to be recorded
* Returns:
* void - no return value
*/
void LogService::log(const std::string& message)
{
DataStore& dataStore = DataStore::getInstance();
logMap& logs = dataStore.getLogs();
Log* log = Factory::getObject<Log>(message);
logs.emplace(std::make_pair(log->getTimestamp(), log));
}
@@ -1,5 +1,14 @@
/*
* File: Log.h
* Description: Handle operations related to logging
* Author: Trenser
* Created: 01-Apr-2026
*/
#pragma once
#include "Log.h"
class LogService
{
public:
static void log(const std::string&);
};
@@ -1 +1,7 @@
/*
* File: NotificationManagementService.cpp
* Description: Handle operations related to notifications
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "NotificationManagementService.h"
@@ -1,5 +1,10 @@
/*
* File: NotificationManagementService.h
* Description: Handle operations related to notifications
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class NotificationManagementService
{
};
@@ -1 +1,209 @@
/*
* File: PayslipManagementService.cpp
* Description: Handle operations related to employee payslips
* Author: Trenser
* Created: 30-Mar-2026
*/
#include <stdexcept>
#include <algorithm>
#include "PayslipManagementService.h"
#include "ApplicationConfig.h"
#include "AuthorizationHelper.h"
#include "Enums.h"
#include "FileManager.h"
#include "Factory.h"
/*
* Function: updateSalary
* Description: Updates the payroll details of a given employee, including salary components
* and PF contributions.
* Parameters:
* employeeId - unique identifier of the employee
* basicSalary - basic salary of the employee
* houseRentAllowance - HRA component
* foodAllowance - food allowance component
* employeePFContribution - employee PF contribution
* employerPFContribution - employer PF contribution
* Returns:
* void - throws runtime_error if employee not found or unauthorized
*/
void PayslipManagementService::updateSalary(const std::string& employeeId, double basicSalary, double houseRentAllowance, double foodAllowance, double employeePFContribution, double employerPFContribution)
{
util::enforceAuthorization(m_dataStore.getAuthenticatedEmployee()->getEmployeeType(), Enums::EmployeeType::FINANCE);
auto employee = m_dataStore.getEmployees().find(employeeId);
if (employee != m_dataStore.getEmployees().end() && employee->second->getEmployeeType() != Enums::EmployeeType::ADMIN)
{
auto payroll = employee->second->getPayroll();
payroll->setBasicSalary(basicSalary);
payroll->setHouseRentAllowance(houseRentAllowance);
payroll->setFoodAllowance(foodAllowance);
payroll->setEmployeePFContribution(employeePFContribution);
payroll->setEmployerPFContribution(employerPFContribution);
}
else
{
throw std::runtime_error("Employee not found, unable to update the salary");
}
}
/*
* Function: generatePayslips
* Description: Generates payslips for all employees for the current month and year.
* Parameters:
* None
* Returns:
* void - creates and stores payslips in DataStore
*/
void PayslipManagementService::generatePayslips()
{
util::enforceAuthorization(m_dataStore.getAuthenticatedEmployee()->getEmployeeType(), Enums::EmployeeType::FINANCE);
auto& employees = m_dataStore.getEmployees();
auto& payslips = m_dataStore.getPayslips();
util::Timestamp currentTimestamp;
int currentMonth = currentTimestamp.getMonth();
int currentYear = currentTimestamp.getYear();
for (const auto& employeePair : employees)
{
auto& employee = employeePair.second;
if (employee->getEmployeeType() == Enums::EmployeeType::ADMIN)
{
continue;
}
auto& employeePayslips = employee->getEmployeePayslips();
auto payslipForTheMonth = std::find_if(employeePayslips.begin(), employeePayslips.end(),
[currentMonth, currentYear](const auto& payslipPair)
{
auto& payslip = payslipPair.second;
auto& timestamp = payslip->getTimestamp();
return (timestamp.getMonth() == currentMonth && timestamp.getYear() == currentYear);
}
);
if (payslipForTheMonth == employeePayslips.end())
{
auto payroll = employee->getPayroll();
double salary;
salary = payroll->getBasicSalary() + payroll->getFoodAllowance() + payroll->getHouseRentAllowance() - payroll->getEmployeePFContribution() - payroll->getEmployerPFContribution();
Payslip* payslip = Factory::getObject<Payslip>(salary, employee->getId());
employee->addPayslip(payslip);
payslips.emplace(payslip->getId(), payslip);
}
}
}
/*
* Function: loadPayrolls
* Description: Loads payroll objects from persistent storage and associates them
* with existing employees.
* Parameters:
* None
* Returns:
* void - updates DataStore with loaded payrolls
*/
void PayslipManagementService::loadPayrolls()
{
FileManager<Payroll> payrollFileManager(Config::File::PAYROLL_FILE);
auto& payrolls = m_dataStore.getPayrolls();
auto& employees = m_dataStore.getEmployees();
auto payrollObjects = payrollFileManager.load();
for (const auto& payrollPair : payrollObjects)
{
auto employeeIterator = employees.find(payrollPair.second->getEmployeeId());
if (employeeIterator == employees.end())
{
throw std::runtime_error("Payroll Object not associated with an existing employee");
}
employeeIterator->second->setEmployeePayroll(payrollPair.second);
}
payrolls.insert(payrollObjects.begin(), payrollObjects.end());
}
/*
* Function: savePayrolls
* Description: Saves all payroll objects from DataStore into persistent storage.
* Parameters:
* None
* Returns:
* None
*/
void PayslipManagementService::savePayrolls()
{
FileManager<Payroll> payrollFileManager(Config::File::PAYROLL_FILE);
auto& payrolls = m_dataStore.getPayrolls();
payrollFileManager.save(payrolls);
}
/*
* Function: getPayslipForMonth
* Description: Retrieves the payroll and payslip of a given employee for a specific
* month and year.
* Parameters:
* employeeId - unique identifier of the employee
* year - year of the payslip
* month - month of the payslip
* Returns:
* pair<Payroll*, Payslip*> - payroll and payslip for the given month.
*/
std::pair<Payroll*, Payslip*> PayslipManagementService::getPayslipForMonth(const std::string& employeeId, int year, int month)
{
auto& employees = m_dataStore.getEmployees();
auto employeeIterator = employees.find(employeeId);
if (employeeIterator == employees.end())
{
throw std::runtime_error("Employee not found!");
}
auto payroll = employeeIterator->second->getPayroll();
auto& payslips = employeeIterator->second->getEmployeePayslips();
for (const auto& payslipPair : payslips)
{
const auto& payslip = payslipPair.second;
{
if (payslip->getTimestamp().getYear() == year && payslip->getTimestamp().getMonth() == month)
{
return { payroll, payslip };
}
}
}
return { nullptr, nullptr };
}
/*
* Function: loadPayslips
* Description: Loads payslip objects from FileManager and associates them
* with existing employees.
* Parameters:
* None
* Returns:
* void - updates DataStore with loaded payslips
*/
void PayslipManagementService::loadPayslips()
{
FileManager<Payslip> payslipFileManager(Config::File::PAYSLIP_FILE);
auto& payslips = m_dataStore.getPayslips();
auto& employees = m_dataStore.getEmployees();
auto payslipObjects = payslipFileManager.load();
for (const auto& payslipPair : payslipObjects)
{
auto employeeIterator = employees.find(payslipPair.second->getEmployeeId());
if (employeeIterator == employees.end())
{
throw std::runtime_error("Payslip Object not associated with an existing employee");
}
employeeIterator->second->addPayslip(payslipPair.second);
}
payslips.insert(payslipObjects.begin(), payslipObjects.end());
}
/*
* Function: savePayslips
* Description: Saves all payslip objects from DataStore into FileManager.
* Parameters:
* None
* Returns:
* void
*/
void PayslipManagementService::savePayslips()
{
FileManager<Payslip> payslipFileManager(Config::File::PAYSLIP_FILE);
auto& payslips = m_dataStore.getPayslips();
payslipFileManager.save(payslips);
}
@@ -1,5 +1,27 @@
/*
* File: PayslipManagementService.h
* Description: Handle operations related to employee payslips
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
#include <string>
#include<stdexcept>
#include"DataStore.h"
using payslipMap = std::map<std::string, Payslip*>;
class PayslipManagementService
{
private:
DataStore& m_dataStore;
public:
PayslipManagementService() : m_dataStore(DataStore::getInstance()) {};
void updateSalary(const std::string&, double, double, double, double, double);
void generatePayslips();
std::pair<Payroll*, Payslip*>getPayslipForMonth(const std::string&, int, int);
void loadPayrolls();
void savePayrolls();
void loadPayslips();
void savePayslips();
};
@@ -1 +1,7 @@
/*
* File: TalentAcquisitionManagementService.cpp
* Description: Handle operations related to Talent Acquisition
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "TalentAcquisitionManagementService.h"
@@ -1,5 +1,10 @@
/*
* File: TalentAcquisitionManagementService.h
* Description: Handle operations related to Talent Acquisition
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class TalentAcquisitionManagementService
{
};
@@ -1 +1,7 @@
/*
* File: TeamManagementService.cpp
* Description: Handle operations related to Team Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "TeamManagementService.h"
@@ -1,3 +1,9 @@
/*
* File: TeamManagementService.h
* Description: Handle operations related to Team Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class TeamManagementService
{
@@ -1 +1,7 @@
/*
* File: TicketManagementService.h
* Description: Handle operations related to Ticket Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "TicketManagementService.h"
@@ -1,3 +1,9 @@
/*
* File: TicketManagementService.h
* Description: Handle operations related to Ticket Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once
class TicketManagementService
{
@@ -0,0 +1 @@
#include "AuthorizationHelper.h"
@@ -0,0 +1,67 @@
/*
* File: AuthorizationHelper.h
* Description : Provides utility functions to check and enforce authorization
* based on allowed employee types.
* Author : Trenser
* Created : 07-Apr-2026
*/
#pragma once
#include <stdexcept>
#include "Enums.h"
namespace util
{
/*
* Function: isAuthorized
* Description: Checks if the current employee type matches the specified allowed type.
* Parameters:
* current - the employee type of the current user
* first - the allowed employee type to compare against
* Returns:
* bool - true if current matches the allowed type, false otherwise
*/
inline bool isAuthorized(Enums::EmployeeType current, Enums::EmployeeType first)
{
return current == first;
}
/*
* Function: isAuthorized
* Description: Checks if the current employee type matches any of the specified allowed types.
* Parameters:
* current - the employee type of the current user
* first - the first allowed employee type
* rest - additional allowed employee types
* Returns:
* bool - true if current matches any of the allowed types, false otherwise
*/
template <typename... Rest>
inline bool isAuthorized(Enums::EmployeeType current, Enums::EmployeeType first,
Rest... rest)
{
if (current == first)
{
return true;
}
return isAuthorized(current, rest...);
}
/*
* Function: enforceAuthorization
* Description: Enforces authorization by checking if the current employee type
* is among the allowed types.
* Parameters:
* current - the employee type of the current user
* alloweds - one or more allowed employee types
* Returns:
* void - throws runtime_error if current is not authorized
*/
template <typename... Allowed>
inline void enforceAuthorization(Enums::EmployeeType current, Allowed... allowed)
{
if (!isAuthorized(current, allowed...))
{
throw std::runtime_error("You are unauthorized to perform this operation!");
}
}
}
+360 -2
View File
@@ -1,4 +1,12 @@
/*
* File: Enums.h
* Description: Defines strongly typed enumerations for statuses, types, and designations used across the HRMS system.
* Author: Smitha
* Created: 01-04-2026
*/
#pragma once
#include <string>
namespace Enums {
@@ -18,7 +26,8 @@ namespace Enums {
{
PENDING,
SHORTLISTED,
REJECTED
REJECTED,
HIRED
};
enum class NotificationStatus
@@ -66,7 +75,356 @@ namespace Enums {
{
JUNIOR,
SENIOR,
TEAM_LEAD
TEAM_LEAD,
INVALID
};
enum class EmployeeType
{
GENERAL,
IT,
FINANCE,
TALENT_ACQUISITION,
HR,
TEAM,
ADMIN,
INVALID
};
enum class LoginStatus
{
SUCCESS,
FIRST_LOGIN,
USER_NOT_FOUND,
INVALID_PASSWORD
};
enum class Month
{
JANUARY,
FEBRUARY,
MARCH,
APRIL,
MAY,
JUNE,
JULY,
AUGUST,
SEPTEMBER,
OCTOBER,
NOVEMBER,
DECEMBER,
INVALID
};
/*
* Function: getAccountStatusString
* Description: Converts AccountStatus enum value to string.
* Parameters:
* status - account status enum
* Returns:
* std::string - string representation of status
*/
inline std::string getAccountStatusString(AccountStatus status)
{
switch (status)
{
case AccountStatus::ACTIVE:
return "ACTIVE";
case AccountStatus::INACTIVE:
return "INACTIVE";
default:
return "UNKNOWN";
}
}
/*
* Function: getEmployeeTypeString
* Description: Converts EmployeeType enum value to string.
* Parameters:
* type - employee type enum
* Returns:
* std::string - string representation of employee type
*/
inline std::string getEmployeeTypeString(EmployeeType type)
{
switch (type)
{
case EmployeeType::GENERAL:
return "GENERAL";
case EmployeeType::IT:
return "IT";
case EmployeeType::FINANCE:
return "FINANCE";
case EmployeeType::TALENT_ACQUISITION:
return "TALENT_ACQUISITION";
case EmployeeType::HR:
return "HR";
case EmployeeType::TEAM:
return "TEAM";
case EmployeeType::ADMIN:
return "ADMIN";
case EmployeeType::INVALID:
return "INVALID";
default:
return "UNKNOWN";
}
}
/*
* Function: getTeamStatusString
* Description: Converts TeamStatus enum value to string.
* Parameters:
* status - team status enum
* Returns:
* std::string - string representation of team status
*/
inline std::string getTeamStatusString(TeamStatus status)
{
switch (status)
{
case TeamStatus::IN_TEAM:
return "IN_TEAM";
case TeamStatus::NOT_IN_TEAM:
return "NOT_IN_TEAM";
default:
return "UNKNOWN";
}
}
/*
* Function: getEmployeeDesignationString
* Description: Converts EmployeeDesignation enum value to string.
* Parameters:
* designation - employee designation enum
* Returns:
* std::string - string representation of designation
*/
inline std::string getEmployeeDesignationString(EmployeeDesignation designation)
{
switch (designation)
{
case EmployeeDesignation::JUNIOR:
return "JUNIOR";
case EmployeeDesignation::SENIOR:
return "SENIOR";
case EmployeeDesignation::TEAM_LEAD:
return "TEAM_LEAD";
case EmployeeDesignation::INVALID:
return "INVALID";
default:
return "UNKNOWN";
}
}
/*
* Function: getCandidateStatusString
* Description: Converts CandidateStatus enum value to string.
* Parameters:
* status - candidate status enum
* Returns:
* std::string - string representation of candidate status
*/
inline std::string getCandidateStatusString(CandidateStatus status)
{
switch (status)
{
case CandidateStatus::PENDING: return "Pending";
case CandidateStatus::SHORTLISTED: return "Shortlisted";
case CandidateStatus::REJECTED: return "Rejected";
default: return "Unknown";
}
}
/*
* Function: getMonthString
* Description: Converts Month enum value to month name.
* Parameters:
* month - month enum
* Returns:
* std::string - month name
*/
inline std::string getMonthString(Month month)
{
switch (month)
{
case Month::JANUARY:
return "January";
case Month::FEBRUARY:
return "February";
case Month::MARCH:
return "March";
case Month::APRIL:
return "April";
case Month::MAY:
return "May";
case Month::JUNE:
return "June";
case Month::JULY:
return "July";
case Month::AUGUST:
return "August";
case Month::SEPTEMBER:
return "September";
case Month::OCTOBER:
return "October";
case Month::NOVEMBER:
return "November";
case Month::DECEMBER:
return "December";
case Month::INVALID:
return "Invalid Month";
default:
return "Unknown";
}
}
/*
* Function: getAccountStatus
* Description: Converts string to AccountStatus enum.
* Parameters:
* input - string representation of account status
* Returns:
* AccountStatus - enum value
*/
inline AccountStatus getAccountStatus(const std::string& input)
{
if (input == "ACTIVE")
{
return AccountStatus::ACTIVE;
}
if (input == "INACTIVE")
{
return AccountStatus::INACTIVE;
}
return AccountStatus::INACTIVE;
}
/*
* Function: getEmployeeType
* Description: Converts string to EmployeeType enum.
* Parameters:
* input - string representation of employee type
* Returns:
* EmployeeType - enum value
*/
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;
}
/*
* Function: getTeamStatus
* Description: Converts string to TeamStatus enum.
* Parameters:
* str - string representation of team status
* Returns:
* TeamStatus - enum value
*/
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;
}
/*
* Function: getEmployeeDesignation
* Description: Converts string to EmployeeDesignation enum.
* Parameters:
* input - string representation of designation
* Returns:
* EmployeeDesignation - enum value
*/
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;
}
/*
* Function: getMonth
* Description: Converts integer to Month enum.
* Parameters:
* inputMonth - month number (112)
* Returns:
* Month - enum value
*/
inline Month getMonth(const int inputMonth)
{
switch (inputMonth)
{
case 1:
return Month::JANUARY;
case 2:
return Month::FEBRUARY;
case 3:
return Month::MARCH;
case 4:
return Month::APRIL;
case 5:
return Month::MAY;
case 6:
return Month::JUNE;
case 7:
return Month::JULY;
case 8:
return Month::AUGUST;
case 9:
return Month::SEPTEMBER;
case 10:
return Month::OCTOBER;
case 11:
return Month::NOVEMBER;
case 12:
return Month::DECEMBER;
default:
return Month::INVALID;
}
}
}
@@ -1,11 +1 @@
#include "inputHelper.h"
void util::readString(std::string& value)
{
getline(std::cin >> std::ws, value);
}
void util::pressEnter()
{
system("pause");
}
@@ -1,3 +1,9 @@
/*
* File: InputHelper.h
* Description: Handles input validation and error handling
* Author: Smitha
* Created: 08-Apr-2026
*/
#pragma once
#include <iostream>
#include <limits>
@@ -6,18 +12,47 @@
namespace util
{
template <typename T>
void readValue(T& value)
{
std::cin >> value;
if (std::cin.fail())
{
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
throw std::runtime_error("Invalid Console Input");
}
}
/*
* Function: read
* Description: Reads input from console into a variable of type T.
* Parameters:
* value - reference to a variable of type T where the input will be stored
* Returns:
* void - throws runtime_error if input is invalid
*/
template <typename T>
inline void read(T& value)
{
if (!(std::cin >> value))
{
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
throw std::runtime_error("Invalid console input");
}
}
void readString(std::string&);
void pressEnter();
/*
* Function: read
* Description: Reads a line of text input from console into a string.
* Parameters:
* value - reference to a string where the input will be stored
* Returns:
* void - no return value
*/
inline void read(std::string& value)
{
std::getline(std::cin >> std::ws, value);
}
/*
* Function: pressEnter
* Description: Pauses execution until the user presses Enter.
* Parameters: None
* Returns: void - no return value
*/
inline void pressEnter()
{
std::cout << std::endl;
system("pause");
}
}
@@ -1,5 +1,18 @@
/*
* File: OutputHelper.cpp
* Description: Provides functions to help with console output.
* Author: Trenser
* Created: 01-04-2026
*/
#include "outputHelper.h"
/*
* Function: clear
* Description: Clears the console screen output.
* Parameters: None
* Returns:
* void - no return value
*/
void util::clear()
{
std::cout << "\x1B[2J\x1B[H" << std::flush;
@@ -1,3 +1,9 @@
/*
* File: OutputHelper.h
* Description: Provides functions to help with console output.
* Author: Trenser
* Created: 01-04-2026
*/
#pragma once
#include <iostream>
@@ -0,0 +1,29 @@
/*
* File: StringHelper.cpp
* Description: Provides functions to help with string manipulation.
* Author: Trenser
* Created: 10-04-2026
*/
#include "StringHelper.h"
#include <cctype>
/*
* Function: extractNumber
* Description: Extracts and returns the numeric value formed by digits in the input string.
* Parameters:
* input - string containing numeric and non-numeric characters
* Returns:
* int - number extracted from the input string
*/
int util::extractNumber(const std::string& input)
{
int result = 0;
for (char character : input)
{
if (std::isdigit(static_cast<unsigned char>(character)))
{
result = result * 10 + (character - '0');
}
}
return result;
}
@@ -0,0 +1,13 @@
/*
* File: StringHelper.h
* Description: Provides functions to help with string manipulation.
* Author: Trenser
* Created: 10-04-2026
*/
#pragma once
#include <string>
namespace util
{
int extractNumber(const std::string&);
}
@@ -1,18 +1,52 @@
/*
* File: Timestamp.cpp
* Description: Provides a utility class for representing and manipulating time values.
* Supports conversion between string and time formats, duration calculations
* (hours, minutes, seconds), date extraction, and comparison operators.
* Author: Trenser
* Created: 01-Apr-2026
*/
#include <sstream>
#include <iomanip>
#include <stdexcept>
#include "Timestamp.h"
/*
* Function: Timestamp
* Description: Default constructor that initializes the timestamp to the current system time.
* Parameters:
* None
* Returns:
* Timestamp object
*/
util::Timestamp::Timestamp()
{
m_time = std::time(nullptr);
}
/*
* Function: Timestamp (overloaded)
* Description: Constructor that initializes the timestamp with a given time value.
* Parameters:
* timeValue - time_t value representing a specific time
* Returns:
* Timestamp object
*/
util::Timestamp::Timestamp(std::time_t timeValue)
{
m_time = timeValue;
}
/*
* Function: fromString
* Description: Creates a Timestamp object from a formatted string.
* Parameters:
* timeString - string in the format "YYYY-MM-DD HH:MM:SS"
* Returns:
* Timestamp object representing the parsed time
* Throws:
* runtime_error if the string format is invalid
*/
util::Timestamp util::Timestamp::fromString(const std::string& timeString)
{
std::tm timeStruct = {};
@@ -26,6 +60,14 @@ util::Timestamp util::Timestamp::fromString(const std::string& timeString)
return Timestamp(parsedTimestamp);
}
/*
* Function: toString
* Description: Converts the Timestamp object into a formatted string.
* Parameters:
* None
* Returns:
* string - formatted as "YYYY-MM-DD HH:MM:SS"
*/
std::string util::Timestamp::toString() const
{
std::tm timeStruct = {};
@@ -35,11 +77,28 @@ std::string util::Timestamp::toString() const
return outputStream.str();
}
/*
* Function: getDurationInSeconds
* Description: Calculates the duration between two timestamps in seconds.
* Parameters:
* startTimestamp - starting time
* endTimestamp - ending time
* Returns:
* double - duration in seconds
*/
double util::Timestamp::getDurationInSeconds(const Timestamp& startTimestamp, const Timestamp& endTimestamp)
{
return std::difftime(endTimestamp.m_time, startTimestamp.m_time);
}
/*
* Function: getDateAsInt
* Description: Returns the date portion of the timestamp as an integer in YYYYMMDD format.
* Parameters:
* None
* Returns:
* int - date as YYYYMMDD
*/
int util::Timestamp::getDateAsInt() const
{
std::tm timeStruct{};
@@ -50,36 +109,139 @@ int util::Timestamp::getDateAsInt() const
return year * 10000 + month * 100 + day;
}
/*
* Function: getMonth
* Description: Extracts the month value from the timestamp.
* Parameters:
* None
* Returns:
* int - month value (1 to 12)
*/
int util::Timestamp::getMonth() const
{
std::tm timeStruct{};
localtime_s(&timeStruct, &m_time);
return timeStruct.tm_mon + 1;
}
/*
* Function: getYear
* Description: Extracts the year value from the timestamp.
* Parameters:
* None
* Returns:
* int - year value
*/
int util::Timestamp::getYear() const
{
std::tm timeStruct{};
localtime_s(&timeStruct, &m_time);
return timeStruct.tm_year + 1900;
}
/*
* Function: getDay
* Description: Extracts the day value from the timestamp.
* Parameters:
* None
* Returns:
* int - day of the month
*/
int util::Timestamp::getDay() const
{
std::tm timeStruct{};
localtime_s(&timeStruct, &m_time);
return timeStruct.tm_mday;
}
/*
* Function: getDurationInMinutes
* Description: Calculates the duration between two timestamps in minutes.
* Parameters:
* startTimestamp - starting time
* endTimestamp - ending time
* Returns:
* double - duration in minutes
*/
double util::Timestamp::getDurationInMinutes(const Timestamp& startTimestamp, const Timestamp& endTimestamp)
{
return getDurationInSeconds(startTimestamp, endTimestamp) / 60.0;
}
/*
* Function: getDurationInHours
* Description: Calculates the duration between two timestamps in hours.
* Parameters:
* startTimestamp - starting time
* endTimestamp - ending time
* Returns:
* double - duration in hours
*/
double util::Timestamp::getDurationInHours(const Timestamp& startTimestamp, const Timestamp& endTimestamp)
{
return getDurationInSeconds(startTimestamp, endTimestamp) / 3600.0;
}
/*
* Function: operator<
* Description: Compares two timestamps to check if one is earlier than the other.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if current timestamp is earlier
*/
bool util::Timestamp::operator<(const Timestamp& other) const
{
return m_time < other.m_time;
}
/*
* Function: operator>
* Description: Compares two timestamps to check if one is later than the other.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if current timestamp is later
*/
bool util::Timestamp::operator>(const Timestamp& other) const
{
return m_time > other.m_time;
}
/*
* Function: operator<=
* Description: Compares two timestamps to check if one is earlier or equal.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if current timestamp is earlier or equal
*/
bool util::Timestamp::operator<=(const Timestamp& other) const
{
return m_time <= other.m_time;
}
/*
* Function: operator>=
* Description: Compares two timestamps to check if one is later or equal.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if current timestamp is later or equal
*/
bool util::Timestamp::operator>=(const Timestamp& other) const
{
return m_time >= other.m_time;
}
/*
* Function: operator==
* Description: Compares two timestamps for equality.
* Parameters:
* other - Timestamp to compare against
* Returns:
* bool - true if both timestamps are equal
*/
bool util::Timestamp::operator==(const Timestamp& other) const
{
return m_time == other.m_time;
@@ -1,3 +1,11 @@
/*
* File: Timestamp.h
* Description: Provides a utility class for representing and manipulating time values.
* Supports conversion between string and time formats, duration calculations
* (hours, minutes, seconds), date extraction, and comparison operators.
* Author: Trenser
* Created: 01-Apr-2026
*/
#pragma once
#include <ctime>
#include <string>
@@ -17,6 +25,9 @@ namespace util
static double getDurationInMinutes(const Timestamp&, const Timestamp&);
static double getDurationInSeconds(const Timestamp&, const Timestamp&);
int getDateAsInt() const;
int getMonth() const;
int getYear() const;
int getDay() const;
bool operator>(const Timestamp&) const;
bool operator<(const Timestamp&) const;
bool operator>=(const Timestamp&) const;
@@ -1,5 +1,24 @@
#include "Validator.h"
/*
* File: Validator.cpp
* Description: Validates inputs like phone number, email, password
* Author: Trenser
* Created: 01-Apr-2026
*/
#include <string>
#include <cctype>
#include "Validator.h"
#include "Employee.h"
#include "ApplicationConfig.h"
/*
* Function: isPhoneNumberValid
* Description: Validates whether the given string is a valid phone number.
* Parameters:
* phoneNumber - string containing the phone number to validate
* Returns:
* bool - true if the phone number is valid (10 digits, all numeric), false otherwise
*/
bool util::isPhoneNumberValid(const std::string& phoneNumber) {
if (phoneNumber.size() != 10)
{
@@ -13,9 +32,20 @@ bool util::isPhoneNumberValid(const std::string& phoneNumber) {
);
}
/*
* Function: isEmailValid
* Description: Validates whether the given string is a properly formatted email address.
* Parameters:
* email - string containing the email address to validate
* Returns:
* bool - true if the email contains exactly one '@' character and is not at the start or end, false otherwise
*/
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;
@@ -26,3 +56,142 @@ bool util::isEmailValid(const std::string& email) {
}
return true;
}
/*
* Function: isPasswordValid
* Description: Validates whether the given string meets password requirements.
* Parameters:
* password - string containing the password to validate
* Returns:
* bool - true if the password is valid, false otherwise
* Notes:
* - Must not equal the default password
* - Must be at least 8 characters long
* - Must contain at least one uppercase letter, one lowercase letter, one digit, and one special character
* - Must not contain whitespace
*/
bool util::isPasswordValid(const std::string& password)
{
if (password == Config::Authentication::DEFAULT_PASSWORD)
{
return false;
}
if (password.length() < 8)
return false;
bool hasUpper = false;
bool hasLower = false;
bool hasDigit = false;
bool hasSpecial = false;
for (char character : password)
{
if (std::isspace(static_cast<unsigned char>(character)))
{
return false;
}
if (std::isupper(static_cast<unsigned char>(character)))
{
hasUpper = true;
}
else if (std::islower(static_cast<unsigned char>(character)))
{
hasLower = true;
}
else if (std::isdigit(static_cast<unsigned char>(character)))
{
hasDigit = true;
}
else
{
hasSpecial = true;
}
}
return hasUpper && hasLower && hasDigit && hasSpecial;
}
/*
* Function: hasActiveEmployeeOfType
* Description: Checks whether there is any active employee of the given employee type.
* Parameters:
* employeeType - the type of employee to check against
* employees - map of employee ID to Employee* objects
* Returns:
* bool - true if an active employee of the given type exists, otherwise false
*/
bool util::hasActiveEmployeeOfType(Enums::EmployeeType employeeType, const std::map<std::string, Employee*>& employees)
{
for (const auto& employeePair : employees)
{
const auto& employee = employeePair.second;
if (employee->getEmployeeType() == employeeType && employee->getEmployeeAccountStatus() == Enums::AccountStatus::ACTIVE)
{
return true;
}
}
return false;
}
/*
* Function: isEmailDuplicate
* Description: Checks if an email already exists among the given employees.
* Parameters:
* email - the email address to check
* employees - map of employee ID to Employee* objects
* Returns:
* bool - true if a duplicate email is found, otherwise false
*/
bool util::isEmailDuplicate(const std::string& email, const std::map<std::string, Employee*>& employees)
{
for (const auto& employeePair : employees)
{
const auto& employee = employeePair.second;
if (employee->getEmployeeEmail() == email)
{
return true;
}
}
return false;
}
/*
* Function: isPhoneDuplicate
* Description: Checks if a phone number already exists among the given employees.
* Parameters:
* phone - the phone number to check
* employees - map of employee ID to Employee* objects
* Returns:
* bool - true if a duplicate phone number is found, otherwise false
*/
bool util::isPhoneDuplicate(const std::string& phone, const std::map<std::string, Employee*>& employees)
{
for (const auto& employeePair : employees)
{
const auto& employee = employeePair.second;
if (employee->getEmployeePhone() == phone)
{
return true;
}
}
return false;
}
/*
* Function: isPhoneDuplicate (overloaded)
* Description: Checks if a phone number already exists in a vector of employees.
* Parameters:
* phone - the phone number to check
* employees - vector of Employee* pointers
* Returns:
* bool - true if a duplicate phone number is found, otherwise false
*/
bool util::isPhoneDuplicate(const std::string& phone, const std::vector<const Employee*>& employees)
{
for (const auto& employee : employees)
{
if (employee->getEmployeePhone() == phone)
{
return true;
}
}
return false;
}
@@ -1,10 +1,27 @@
/*
* File: Validator.h
* Description: Validates inputs like phone number, email, password
* Author: Trenser
* Created: 01-Apr-2026
*/
#pragma once
#include<string>
#include<map>
#include<memory>
#include<vector>
#include<algorithm>
#include<cctype>
#include "Enums.h"
class Employee;
namespace util
{
bool isPhoneNumberValid(const std::string&);
bool isEmailValid(const std::string&);
bool isPasswordValid(const std::string&);
bool hasActiveEmployeeOfType(Enums::EmployeeType, const std::map<std::string, Employee*>&);
bool isEmailDuplicate(const std::string&, const std::map<std::string, Employee*>&);
bool isPhoneDuplicate(const std::string&, const std::map<std::string, Employee*>&);
bool isPhoneDuplicate(const std::string&, const std::vector<const Employee*>&);
}
@@ -0,0 +1,87 @@
/*
* File: AdminMenu.cpp
* Description: Handles user-related operations such as creation, authentication, and validation.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "AdminMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
#include "MenuHelper.h"
/*
* Function: AdminMenu::run
* Description: Starts and manages the administrator menu loop. Continuously displays
* options to the administrator until logout is selected or an exception occurs.
* Parameters:
* None
* Returns:
* None
*/
void AdminMenu::run()
{
bool isMenuActive = true;
while (isMenuActive)
{
try
{
int choice;
util::clear();
std::cout << "Admin Menu\n1. Create User\n2. View Employees\n3. Deactivate Employee\n4. Search Employee\n5. Update Profile\n6. Update Designation \n7. Add Shortlisted Candidate As Employee\n8. Logout\nEnter your Choice: ";
util::read(choice);
if (!handleOperation(choice))
{
isMenuActive = false;
}
}
catch (const std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
util::pressEnter();
}
}
}
/*
* Function: AdminMenu::handleOperation
* Description: Processes the administrators menu choice and executes the corresponding action.
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the administrator chooses to logout
*/
bool AdminMenu::handleOperation(int choice)
{
switch (choice)
{
case 1:
createEmployee(m_zenvyController);
break;
case 2:
viewEmployees(m_zenvyController);
break;
case 3:
deactivateEmployee(m_zenvyController);
break;
case 4:
searchEmployee(m_zenvyController);
break;
case 5:
updateProfile(m_zenvyController);
break;
case 6:
updateDesignation(m_zenvyController);
break;
case 7:
addShortlistedCandidateAsEmployee(m_zenvyController);
break;
case 8:
return false;
default:
std::cout << "Enter a valid choice!" << std::endl;
util::pressEnter();
}
return true;
}
@@ -0,0 +1,18 @@
/*
* File: AdminMenu.h
* Description: Declaration of the AdminMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include"ZenvyController.h"
class AdminMenu
{
private:
ZenvyController* m_zenvyController;
public:
AdminMenu() :m_zenvyController(new ZenvyController()) {};
void run();
bool handleOperation(int);
};

Some files were not shown because too many files have changed in this diff Show More