using System.Text; using Ease.CoreV35; using Ease.CoreV35.Model; using Ease.CoreV35.Caching; using System.Data.Linq.Mapping; using System; namespace Payroll.BO { #region IREmployee [Serializable] public class IREmployee : UpdateAuditTrail, IworkflowInterface { #region Cache Store private static Cache _cache = new Cache(typeof(IREmployee)); #endregion #region Constructor public IREmployee() { _nPositionId = null; _nEmployeeID = null; _dAppliedDate = DateTime.MinValue; _sDescription = string.Empty; _bIsSelected = false; } #endregion #region Properties #region PositionID : ID private ID _nPositionId; public ID PositionID { get { return _nPositionId; } set { base.OnPropertyChange("PositionID", _nPositionId, value); _nPositionId = value; } } #endregion #region WfStatus : enumwfStatus private enumwfStatus _eWfStatus; public enumwfStatus WfStatus { get { return _eWfStatus; } set { _eWfStatus = value; } } #endregion #region EmployeeID : ID private ID _nEmployeeID; public ID EmployeeID { get { return _nEmployeeID; } set { base.OnPropertyChange("EmployeeID", _nEmployeeID, value); _nEmployeeID = value; } } #endregion #region Employee private Employee _employee; public Employee Employee { get { if (_employee == null && _nEmployeeID != null) { //_employee = new Employee(); _employee = Employee.Get(_nEmployeeID); } return _employee; } set { _employee = value; } } #endregion #region AppliedDate : DateTime private DateTime _dAppliedDate; public DateTime AppliedDate { get { return _dAppliedDate; } set { base.OnPropertyChange("AppliedDate", _dAppliedDate, value); _dAppliedDate = value; } } #endregion #region Description : string private string _sDescription; public string Description { get { return _sDescription; } set { base.OnPropertyChange("Description", _sDescription, value); _sDescription = value; } } #endregion #region IsSelected : bool private bool _bIsSelected; public bool IsSelected { get { return _bIsSelected; } set { base.OnPropertyChange("IsSelected", _bIsSelected, value); _bIsSelected = value; } } #endregion #region IworkflowInterface Members /// /// this property is used for work flow, which return leave description /// public string ObjectDescription { get { string str = ""; str = " " + this.Employee.Name + ", " + this.Employee.DescriptionText + " has applied for the position " + this.PositionID; return str; } } /// /// this property is used for work flow, it's a constant value /// public ID SetupID { get { return ID.FromInteger(4); } } /// /// this property is used for work flow, which return leave entry id /// public ID ObjectID { get { return this.ID; } } #endregion #endregion #region Service Factory IInternalRecruitmentService : IInternalRecruitmentService internal static IInternalRecruitmentService Service { get { return Services.Factory.CreateService(typeof(IInternalRecruitmentService)); } } #endregion public ID SaveIrEmployee() { this.SetAuditTrailProperties(); return InternalRecruitment.Service.SaveIrEmployee(this); } public static IREmployee Get(int positionID, int empid) { IREmployee oIREmployee = null; #region Cache Header oIREmployee = (IREmployee)_cache["Get", positionID, empid]; if (oIREmployee != null) return oIREmployee; #endregion oIREmployee = InternalRecruitment.Service.Get(positionID, empid); #region Cache Footer _cache.Add(oIREmployee, "Get", positionID, empid); #endregion return oIREmployee; } public int GetStatusbyWf(enumwfStatus wfstatus) { return (int)this.WfStatus; } public IREmployee Get(ID irempid) { IREmployee oIREmployee = null; #region Cache Header oIREmployee = (IREmployee)_cache["Get", irempid]; if (oIREmployee != null) return oIREmployee; #endregion oIREmployee = InternalRecruitment.Service.GetIrempID(irempid); #region Cache Footer _cache.Add(oIREmployee, "Get", irempid); #endregion return oIREmployee; } } #endregion }