CEL_Payroll/Payroll.BO/Attendence/AutoWorkPlan.cs

152 lines
3.6 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
{
#region AutoWorkPlan
[Serializable]
public class AutoWorkPlan : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(AutoWorkPlan));
#endregion
#region Constructor
public AutoWorkPlan()
{
_employeeID = null;
_shiftID = null;
_startDate = DateTime.MinValue;
}
#endregion
#region Properties
#region employeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set
{
base.OnPropertyChange<ID>("employeeID", _employeeID, value);
_employeeID = value;
}
}
#endregion
#region shiftID : ID
private ID _shiftID;
public ID ShiftID
{
get { return _shiftID; }
set
{
base.OnPropertyChange<ID>("shiftID", _shiftID, value);
_shiftID = value;
}
}
#endregion
#region StartDate : DateTime
private DateTime _startDate;
public DateTime StartDate
{
get { return _startDate; }
set
{
base.OnPropertyChange<DateTime>("StartDate", _startDate, value);
_startDate = value;
}
}
#endregion
#region Service Factory IAutoWorkPlanService : IAutoWorkPlanService
internal static IAutoWorkPlanService Service
{
get { return Services.Factory.CreateService<IAutoWorkPlanService>(typeof(IAutoWorkPlanService)); }
}
#endregion
#endregion
#region Functions
public static AutoWorkPlan Get(ID nID)
{
AutoWorkPlan oAutoWorkPlan = null;
#region Cache Header
oAutoWorkPlan = (AutoWorkPlan)_cache["Get", nID];
if (oAutoWorkPlan != null)
return oAutoWorkPlan;
#endregion
oAutoWorkPlan = AutoWorkPlan.Service.Get(nID);
#region Cache Footer
_cache.Add(oAutoWorkPlan, "Get", nID);
#endregion
return oAutoWorkPlan;
}
public static ObjectsTemplate<AutoWorkPlan> Get()
{
#region Cache Header
ObjectsTemplate<AutoWorkPlan> autoWorkPlans = _cache["Get"] as ObjectsTemplate<AutoWorkPlan>;
if (autoWorkPlans != null)
return autoWorkPlans;
#endregion
try
{
autoWorkPlans = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(autoWorkPlans, "Get");
#endregion
return autoWorkPlans;
}
public ID Save()
{
this.SetAuditTrailProperties();
return AutoWorkPlan.Service.Save(this);
}
public void Delete()
{
AutoWorkPlan.Service.Delete(ID);
}
#endregion
}
#endregion
#region IAutoWorkPlan Service
public interface IAutoWorkPlanService
{
AutoWorkPlan Get(ID id);
ObjectsTemplate<AutoWorkPlan> Get();
ID Save(AutoWorkPlan item);
void Delete(ID id);
}
#endregion
}