CEL_Payroll/Payroll.BO/Requisition/EmployeeRequisition.cs

584 lines
13 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using Ease.CoreV35.Caching;
using Ease.CoreV35.Model;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace Payroll.BO
{
#region Class EmployeeRequisition
[Serializable]
public class EmployeeRequisition : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(EmployeeRequisition));
#endregion
#region Constructor
public EmployeeRequisition()
{
DepartmentID = null;
RequisitionDate = DateTime.Now;
Position = string.Empty;
GradeID = null;
MaxEmployee = 0;
BasicPay = string.Empty;
JobDescription = string.Empty;
Justification = string.Empty;
Academic = string.Empty;
Technical = string.Empty;
Age = string.Empty;
Experience = string.Empty;
Gender = EnumGender.Male;
Areas = string.Empty;
OtherRequirements = string.Empty;
Status = EnumEmpReqStatus.RM;
IsCompleted = false;
IsHeadCount = true;
_requisitionUsers = null;
}
#endregion
#region Properties
#region Property DepartmentID : ID
private ID _departmentID;
public ID DepartmentID
{
get
{
return _departmentID;
}
set
{
_departmentID = value;
}
}
#endregion
#region Property RequisitionDate : DateTime
private DateTime _requisitionDate;
public DateTime RequisitionDate
{
get
{
return _requisitionDate;
}
set
{
_requisitionDate = value;
}
}
#endregion
#region Property Position : string
private string _position;
public string Position
{
get
{
return _position;
}
set
{
_position = value;
}
}
#endregion
#region Property GradeID : ID
private ID _gradeID;
public ID GradeID
{
get
{
return _gradeID;
}
set
{
_gradeID = value;
}
}
#endregion
#region Property MaxEmployee : Decimal
private Decimal _maxEmployee;
public Decimal MaxEmployee
{
get
{
return _maxEmployee;
}
set
{
_maxEmployee = value;
}
}
#endregion
#region Property BasicPay : string
private string _basicPay;
public string BasicPay
{
get { return _basicPay; }
set { _basicPay = value; }
}
#endregion
#region Property JobDescription : string
private string _jobDescription;
public string JobDescription
{
get { return _jobDescription; }
set { _jobDescription = value; }
}
#endregion
#region Property Justification : string
private string _justification;
public string Justification
{
get { return _justification; }
set { _justification = value; }
}
#endregion
#region Property Academic : string
private string _academic;
public string Academic
{
get { return _academic; }
set { _academic = value; }
}
#endregion
#region Property Technical : string
private string _technical;
public string Technical
{
get { return _technical; }
set { _technical = value; }
}
#endregion
#region Property Age : string
private string _age;
public string Age
{
get { return _age; }
set { _age = value; }
}
#endregion
#region Property Experience : string
private string _experience;
public string Experience
{
get { return _experience; }
set { _experience = value; }
}
#endregion
#region Property Gender : EnumGender
private EnumGender _gender;
public EnumGender Gender
{
get { return _gender; }
set { _gender = value; }
}
#endregion
#region Property Areas : string
private string _areas;
public string Areas
{
get { return _areas; }
set { _areas = value; }
}
#endregion
#region Property OtherRequirements : string
private string _otherRequirements;
public string OtherRequirements
{
get { return _otherRequirements; }
set { _otherRequirements = value; }
}
#endregion
#region Property Status : EnumEmpReqStatus
private EnumEmpReqStatus _status;
public EnumEmpReqStatus Status
{
get { return _status; }
set { _status = value; }
}
#endregion
#region Property IsCompleted : bool
private bool _isCompleted;
public bool IsCompleted
{
get { return _isCompleted; }
set { _isCompleted = value; }
}
#endregion
#region Property IsHeadCount : bool
private bool _isHeadCount;
public bool IsHeadCount
{
get { return _isHeadCount; }
set { _isHeadCount = value; }
}
#endregion
#region Property RequisitionUsers : ObjectsTemplate<RequisitionUser>
private ObjectsTemplate<RequisitionUser> _requisitionUsers;
public ObjectsTemplate<RequisitionUser> RequisitionUsers
{
get
{
if (_requisitionUsers == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
{
_requisitionUsers = Service.GetRequisitionUserByEmpRequisitionID(this.ID.Integer);
}
return _requisitionUsers;
}
set
{
_requisitionUsers = value;
}
}
#endregion
#endregion
#region Functions
public static EmployeeRequisition Get(int empReqID)
{
EmployeeRequisition oEmployeeRequisition;
#region Cache Header
oEmployeeRequisition = (EmployeeRequisition)_cache["Get", empReqID];
if (oEmployeeRequisition != null)
return oEmployeeRequisition;
#endregion
oEmployeeRequisition = Service.Get(empReqID);
#region Cache Footer
_cache.Add(oEmployeeRequisition, "Get", empReqID);
#endregion
return oEmployeeRequisition;
}
public void RequisitionDeclinedByHR()
{
Service.RequisitionDeclinedByHR(this);
}
public static ObjectsTemplate<EmployeeRequisition> Get()
{
ObjectsTemplate<EmployeeRequisition> oEmployeeRequisitions = null;
#region Cache Header
oEmployeeRequisitions = (ObjectsTemplate<EmployeeRequisition>)_cache["Get"];
if (oEmployeeRequisitions != null)
return oEmployeeRequisitions;
#endregion
oEmployeeRequisitions = Service.Get();
#region Cache Footer
_cache.Add(oEmployeeRequisitions, "Get");
#endregion
return oEmployeeRequisitions;
}
public static ObjectsTemplate<EmployeeRequisition> GetByDepartment(int departmentID)
{
ObjectsTemplate<EmployeeRequisition> oEmployeeRequisitions = null;
#region Cache Header
oEmployeeRequisitions = (ObjectsTemplate<EmployeeRequisition>)_cache["GetByDepartment", departmentID];
if (oEmployeeRequisitions != null)
return oEmployeeRequisitions;
#endregion
oEmployeeRequisitions = Service.GetByDepartment(departmentID);
#region Cache Footer
_cache.Add(oEmployeeRequisitions, "GetByDepartment", departmentID);
#endregion
return oEmployeeRequisitions;
}
public static DataTable GetEmployeeRequisitionsByDepartmentID(ID departmentID,EnumEmpReqStatus reqStatus)
{
DataTable oDesignationDt = null;
oDesignationDt = Service.GetEmployeeRequisitionsByDepartmentID(departmentID,reqStatus);
return oDesignationDt;
}
public static DataTable GetEmployeeRequisitionsForCEO()
{
DataTable oDesignationDt = null;
oDesignationDt = Service.GetEmployeeRequisitionsForCEO();
return oDesignationDt;
}
public void RequisitionDeclinedByCEO()
{
Service.RequisitionDeclinedByCEO(this);
}
public ID Save()
{
this.SetAuditTrailProperties();
return Service.Save(this);
}
public void ChangeStatus(int empID, EnumEmpReqStatus enumEmpReqStatus)
{
Service.ChangeStatus(this, empID, enumEmpReqStatus);
}
public void Delete()
{
Service.Delete(this.ID.Integer);
}
public static DataTable GetEmployeeRequisitionsForHR()
{
DataTable oDesignationDt = null;
oDesignationDt = Service.GetEmployeeRequisitionsForHR();
return oDesignationDt;
}
#endregion
#region Service Factory
internal static IEmployeeRequisitionService Service
{
get
{
return Services.Factory.CreateService<IEmployeeRequisitionService>(typeof(IEmployeeRequisitionService));
}
}
#endregion
}
#endregion
#region Child Classes
[Serializable]
public class RequisitionUser : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(RequisitionUser));
#endregion
#region Constructor
public RequisitionUser()
{
EmpRequisitionID = null;
EmployeeID = null;
Status = EnumEmpReqStatus.RM;
ChangeDate = DateTime.Now;
ChangeString = string.Empty;
Remarks = string.Empty;
}
#endregion
#region Properties
#region Property EmpRequisitionID :ID
private ID _empRequisitionID;
public ID EmpRequisitionID
{
get
{
return _empRequisitionID;
}
set
{
_empRequisitionID = value;
}
}
#endregion
#region Property EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get
{
return _employeeID;
}
set
{
_employeeID = value;
}
}
#endregion
#region Property Status : EnumEmpReqStatus
private EnumEmpReqStatus _status;
public EnumEmpReqStatus Status
{
get { return _status; }
set { _status = value; }
}
#endregion
#region Property ChangeDate : dateTime
private DateTime _changeDate;
public DateTime ChangeDate
{
get
{
return _changeDate;
}
set
{
_changeDate = value;
}
}
#endregion
#region Property ChangeString : string
private string _changeString;
public string ChangeString
{
get
{
return _changeString;
}
set
{
_changeString = value;
}
}
#endregion
#region Property Remarks : string
private string _remarks;
public string Remarks
{
get
{
return _remarks;
}
set
{
_remarks = value;
}
}
#endregion
#endregion
}
#endregion
#region IEmployeeRequisitionService Service
public interface IEmployeeRequisitionService
{
EmployeeRequisition Get(int empReqID);
ObjectsTemplate<EmployeeRequisition> Get();
ObjectsTemplate<EmployeeRequisition> GetByDepartment(int departmentID);
ID Save(EmployeeRequisition oEmployeeRequisition);
void Delete(int ID);
ObjectsTemplate<RequisitionUser> GetRequisitionUserByEmpRequisitionID(int reqID);
void ChangeStatus(EmployeeRequisition employeeRequisition, int empID, EnumEmpReqStatus enumEmpReqStatus);
DataTable GetEmployeeRequisitionsByDepartmentID(ID departmentID, EnumEmpReqStatus reqStatus);
DataTable GetEmployeeRequisitionsForCEO();
DataTable GetEmployeeRequisitionsForHR();
void RequisitionDeclinedByCEO(EmployeeRequisition employeeRequisition);
void RequisitionDeclinedByHR(EmployeeRequisition employeeRequisition);
}
#endregion
}