CEL_Payroll/Payroll.BO/Attendence/UPDAttendance.cs

413 lines
10 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.Caching;
using Ease.CoreV35.Model;
namespace Payroll.BO
{
[Serializable]
public class UPDAttendance : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(UPDAttendance));
#endregion
#region Constructor
public UPDAttendance()
{
_EmployeeID = null;
_EmployeeNo = "";
_AttnDate = DateTime.Today;
_InTime = DateTime.Now;
_OutTime = null;
_UpdStatus = EnumUPDStatus.Regular;
_ChangeStatus = EnumUPDStatus.Regular;
_EmpRemarks = "";
_LMRemarks = "";
_EmpRemarksDate = null;
_LMRemarksDate = null;
_EmpOutsideDutyID = null;
_Comment = "";
_LMID = null;
_HRID = null;
_HRRemarks = "";
}
#endregion
#region EmployeeID : ID
private ID _EmployeeID;
public ID EmployeeID
{
get { return _EmployeeID; }
set
{
base.OnPropertyChange<ID>("EmployeeID", _EmployeeID, value);
_EmployeeID = value;
}
}
#endregion
#region EmpRemarks : string
private string _EmpRemarks;
public string EmpRemarks
{
get { return _EmpRemarks; }
set
{
base.OnPropertyChange<string>("EmpRemarks", _EmpRemarks, value);
_EmpRemarks = value;
}
}
#endregion
#region LMRemarks : string
private string _LMRemarks;
public string LMRemarks
{
get { return _LMRemarks; }
set
{
base.OnPropertyChange<string>("LMRemarks", _LMRemarks, value);
_LMRemarks = value;
}
}
#endregion
#region EmployeeNo : string
private string _EmployeeNo;
public string EmployeeNo
{
get { return _EmployeeNo; }
set
{
base.OnPropertyChange<string>("EmployeeNo", _EmployeeNo, value);
_EmployeeNo = value;
}
}
#endregion
#region _AttnDate : DateTime
private DateTime _AttnDate;
public DateTime AttnDate
{
get { return _AttnDate; }
set
{
base.OnPropertyChange<DateTime>("AttnDate", _AttnDate, value);
_AttnDate = value;
}
}
#endregion
#region InTime : DateTime
private DateTime? _InTime;
public DateTime? InTime
{
get { return _InTime; }
set
{
base.OnPropertyChange<DateTime>("InTime", _InTime, value);
_InTime = value;
}
}
#endregion
#region EmpOutsideDutyID : ID
private ID _EmpOutsideDutyID;
public ID EmpOutsideDutyID
{
get { return _EmpOutsideDutyID; }
set
{
base.OnPropertyChange<ID>("EmpOutsideDutyID", _EmpOutsideDutyID, value);
_EmpOutsideDutyID = value;
}
}
#endregion
#region Comment : string
private string _Comment;
public string Comment
{
get { return _Comment; }
set
{
base.OnPropertyChange<string>("Comment", _Comment, value);
_Comment = value;
}
}
#endregion
#region LMID : ID
private ID _LMID;
public ID LMID
{
get { return _LMID; }
set
{
base.OnPropertyChange<ID>("LMID", _LMID, value);
_LMID = value;
}
}
#endregion
#region _HRID : ID
private ID _HRID;
public ID HRID
{
get { return _HRID; }
set
{
base.OnPropertyChange<ID>("HRID", _HRID, value);
_HRID = value;
}
}
#endregion
#region outTime : DateTime
private DateTime? _OutTime;
public DateTime? OutTime
{
get { return _OutTime; }
set
{
base.OnPropertyChange<DateTime>("OutTime", _OutTime, value);
_OutTime = value;
}
}
#endregion
#region UpdStatus : EnumUPDStatus
private EnumUPDStatus _UpdStatus;
public EnumUPDStatus UpdStatus
{
get { return _UpdStatus; }
set
{
base.OnPropertyChange<short>("UpdStatus", (short)_UpdStatus, (short)value);
_UpdStatus = value;
}
}
#endregion
#region ChangeStatus : EnumUPDStatus
private EnumUPDStatus _ChangeStatus;
public EnumUPDStatus ChangeStatus
{
get { return _ChangeStatus; }
set
{
base.OnPropertyChange<short>("ChangeStatus", (short)_ChangeStatus, (short)value);
_ChangeStatus = value;
}
}
#endregion
#region _HRRemarks : string
private string _HRRemarks;
public string HRRemarks
{
get { return _HRRemarks; }
set
{
base.OnPropertyChange<string>("HRRemarks", _HRRemarks, value);
_HRRemarks = value;
}
}
#endregion
#region EmpRemarksDate : DateTime
private DateTime? _EmpRemarksDate;
public DateTime? EmpRemarksDate
{
get { return _EmpRemarksDate; }
set
{
base.OnPropertyChange<DateTime>("EmpRemarksDate", _EmpRemarksDate, value);
_EmpRemarksDate = value;
}
}
#endregion
#region LMRemarksDate : DateTime
private DateTime? _LMRemarksDate;
public DateTime? LMRemarksDate
{
get { return _LMRemarksDate; }
set
{
base.OnPropertyChange<DateTime>("LMRemarksDate", _LMRemarksDate, value);
_LMRemarksDate = value;
}
}
#endregion
#region Service Factory IUPDAttendanceService : IUPDAttendanceService
internal static IUPDAttendanceService Service
{
get { return Services.Factory.CreateService<IUPDAttendanceService>(typeof(IUPDAttendanceService)); }
}
#endregion
public static UPDAttendance Get(ID nID)
{
UPDAttendance oUPDAttendance = null;
#region Cache Header
oUPDAttendance = (UPDAttendance)_cache["Get", nID];
if (oUPDAttendance != null)
return oUPDAttendance;
#endregion
oUPDAttendance = UPDAttendance.Service.Get(nID);
#region Cache Footer
_cache.Add(oUPDAttendance, "Get", nID);
#endregion
return oUPDAttendance;
}
public static ObjectsTemplate<UPDAttendance> Get(DateTime dt, EnumUPDStatus eType)
{
#region Cache Header
ObjectsTemplate<UPDAttendance> UPDAttendances = _cache["Get",dt,eType] as ObjectsTemplate<UPDAttendance>;
if (UPDAttendances != null)
return UPDAttendances;
#endregion
try
{
UPDAttendances = Service.Get(dt,eType);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(UPDAttendances, "Get",dt,eType);
#endregion
return UPDAttendances;
}
public static ObjectsTemplate<UPDAttendance> Get(DateTime dtFrom, DateTime dtTo, int EmpID, EnumUPDStatus eType)
{
#region Cache Header
ObjectsTemplate<UPDAttendance> UPDAttendances = _cache["Get", dtFrom, dtTo, EmpID,eType] as ObjectsTemplate<UPDAttendance>;
if (UPDAttendances != null)
return UPDAttendances;
#endregion
try
{
UPDAttendances = Service.Get(dtFrom, dtTo, EmpID,eType);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(UPDAttendances, "Get", dtFrom, dtTo, EmpID,eType);
#endregion
return UPDAttendances;
}
public static ObjectsTemplate<UPDAttendance> Get(DateTime dtFrom, DateTime dtTo, EnumUPDStatus eType)
{
#region Cache Header
ObjectsTemplate<UPDAttendance> UPDAttendances = _cache["Get", dtFrom, dtTo, eType] as ObjectsTemplate<UPDAttendance>;
if (UPDAttendances != null)
return UPDAttendances;
#endregion
try
{
UPDAttendances = Service.Get(dtFrom, dtTo, eType);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(UPDAttendances, "Get", dtFrom, dtTo, eType);
#endregion
return UPDAttendances;
}
public ID Save()
{
this.SetAuditTrailProperties();
return UPDAttendance.Service.Save(this);
}
public void Delete()
{
UPDAttendance.Service.Delete(ID);
}
}
public interface IUPDAttendanceService
{
UPDAttendance Get(ID id);
ObjectsTemplate<UPDAttendance> Get(DateTime dt, EnumUPDStatus eType);
ObjectsTemplate<UPDAttendance> Get(DateTime dtFrom, DateTime dtTo, int EmpID, EnumUPDStatus eType);
ObjectsTemplate<UPDAttendance> Get(DateTime dtFrom, DateTime dtTo, EnumUPDStatus eType);
ID Save(UPDAttendance item);
void Delete(ID id);
}
}