HRM-10/HRM.BO/Employee/EmpHistoricalData.cs
Mohaimen Hasan 838b8d4480 first commit
2026-11-03 13:06:00 +06:00

304 lines
8.8 KiB
C#

using System;
using System.Collections.Generic;
namespace HRM.BO
{
#region EmpHistoricalData
/// <summary>
/// One uploaded historical career row, exactly as it came from the
/// "Historical Career Data Upload" Excel sheet. This is a holding table of
/// past career data; it is NOT the live career history (EmpLifeCycle) and
/// nothing in payroll reads it, so rows can be deleted one by one.
///
/// The lookup columns (Designation, Division, Grade, ...) are kept as the
/// uploaded text instead of resolved IDs so that no row is ever rejected or
/// silently changed because a name does not match a master record.
/// EmployeeID is resolved from EmployeeNo on a best-effort basis only.
/// </summary>
public class EmpHistoricalData : BasicBaseObject
{
#region Constructor
public EmpHistoricalData()
{
_employeeID = null;
_employeeNo = "";
_name = "";
_effectDate = null;
_eventType = "";
_designation = "";
_employeeType = "";
_division = "";
_department = "";
_section = "";
_subSection = "";
_grade = "";
_costCenter = "";
_location = "";
_subLocation = "";
_pfMember = "";
_basicSalary = null;
_grossSalary = null;
_payrollTypeID = null;
}
#endregion
#region Properties
#region EmployeeID : ID
private int? _employeeID;
public int? EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#region EmployeeNo : string
private string _employeeNo;
public string EmployeeNo
{
get { return _employeeNo; }
set { _employeeNo = value; }
}
#endregion
#region Name : string
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
#endregion
#region EffectDate : DateTime
private DateTime? _effectDate;
public DateTime? EffectDate
{
get { return _effectDate; }
set { _effectDate = value; }
}
#endregion
#region EventType : string
private string _eventType;
public string EventType
{
get { return _eventType; }
set { _eventType = value; }
}
#endregion
#region Designation : string
private string _designation;
public string Designation
{
get { return _designation; }
set { _designation = value; }
}
#endregion
#region EmployeeType : string
private string _employeeType;
public string EmployeeType
{
get { return _employeeType; }
set { _employeeType = value; }
}
#endregion
#region Division : string
private string _division;
public string Division
{
get { return _division; }
set { _division = value; }
}
#endregion
#region Department : string
private string _department;
public string Department
{
get { return _department; }
set { _department = value; }
}
#endregion
#region Section : string
private string _section;
public string Section
{
get { return _section; }
set { _section = value; }
}
#endregion
#region SubSection : string
private string _subSection;
public string SubSection
{
get { return _subSection; }
set { _subSection = value; }
}
#endregion
#region Grade : string
private string _grade;
public string Grade
{
get { return _grade; }
set { _grade = value; }
}
#endregion
#region CostCenter : string
private string _costCenter;
public string CostCenter
{
get { return _costCenter; }
set { _costCenter = value; }
}
#endregion
#region Location : string
private string _location;
public string Location
{
get { return _location; }
set { _location = value; }
}
#endregion
#region SubLocation : string
private string _subLocation;
public string SubLocation
{
get { return _subLocation; }
set { _subLocation = value; }
}
#endregion
#region PFMember : string
private string _pfMember;
public string PFMember
{
get { return _pfMember; }
set { _pfMember = value; }
}
#endregion
#region BasicSalary : double
private double? _basicSalary;
public double? BasicSalary
{
get { return _basicSalary; }
set { _basicSalary = value; }
}
#endregion
#region GrossSalary : double
private double? _grossSalary;
public double? GrossSalary
{
get { return _grossSalary; }
set { _grossSalary = value; }
}
#endregion
#region PayrollTypeID : ID
private int? _payrollTypeID;
public int? PayrollTypeID
{
get { return _payrollTypeID; }
set { _payrollTypeID = value; }
}
#endregion
#endregion
}
#endregion
#region EmpHistoricalData column setup (read from the Logic configuration)
/// <summary>
/// One configured department or location tier: its position, the caption the
/// sheet must use, and whether the screen marks it mandatory. Read from the
/// Logic configuration (department/tiernames, location/tiernames), the same
/// source getBasicInfoColumns uses for the System Opening Data upload.
/// </summary>
public class EmpHistoricalDataTier
{
/// <summary>1-based tier position, which also picks the EmpHistoricalData slot.</summary>
public int Tier { get; set; }
/// <summary>Configured caption, e.g. "Division" or "sub-Section".</summary>
public string Name { get; set; }
public bool IsMandatory { get; set; }
}
/// <summary>
/// The department/location tiers the sheet must carry. EmpHistoricalData keeps a
/// fixed slot per tier (Division/Department/Section/SubSection and
/// Location/SubLocation), so a configuration with more tiers than there are
/// slots is reported through TierOverflowMessage rather than silently truncated.
/// </summary>
public class EmpHistoricalDataColumnSetup
{
/// <summary>Department slots on EmpHistoricalData: Division, Department, Section, SubSection.</summary>
public const int MaxDepartmentTier = 4;
/// <summary>Location slots on EmpHistoricalData: Location, SubLocation.</summary>
public const int MaxLocationTier = 2;
public EmpHistoricalDataColumnSetup()
{
DepartmentTiers = new List<EmpHistoricalDataTier>();
LocationTiers = new List<EmpHistoricalDataTier>();
TierOverflowMessage = string.Empty;
}
public List<EmpHistoricalDataTier> DepartmentTiers { get; set; }
public List<EmpHistoricalDataTier> LocationTiers { get; set; }
/// <summary>When false the sheet carries a Code column per tier as well as a Name column.</summary>
public bool IsDepartmentCodeAutoGenerated { get; set; }
public bool IsLocationCodeAutoGenerated { get; set; }
/// <summary>
/// Empty when every configured tier has a slot. Otherwise it names the tiers
/// that cannot be carried, so the screen can say so instead of dropping them.
/// </summary>
public string TierOverflowMessage { get; set; }
}
#endregion
#region IEmpHistoricalData Service
public interface IEmpHistoricalDataService
{
EmpHistoricalDataColumnSetup GetColumnSetup();
List<EmpHistoricalData> Get(int payrollTypeID);
EmpHistoricalData Get(int id, int payrollTypeID);
/// <summary>
/// Saves every row and hands back the tier combinations that do not match an
/// existing Department or Location. The rows are still saved - the list is
/// information, because a historical department or location may legitimately
/// no longer exist in the master data.
/// </summary>
List<UploadErrorOrSuccess> Save(List<EmpHistoricalData> items, int payrollTypeID, int userID);
void Delete(int id, int payrollTypeID);
}
#endregion
}