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("employeeID", _employeeID, value); _employeeID = value; } } #endregion #region shiftID : ID private ID _shiftID; public ID ShiftID { get { return _shiftID; } set { base.OnPropertyChange("shiftID", _shiftID, value); _shiftID = value; } } #endregion #region StartDate : DateTime private DateTime _startDate; public DateTime StartDate { get { return _startDate; } set { base.OnPropertyChange("StartDate", _startDate, value); _startDate = value; } } #endregion #region Service Factory IAutoWorkPlanService : IAutoWorkPlanService internal static IAutoWorkPlanService Service { get { return Services.Factory.CreateService(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 Get() { #region Cache Header ObjectsTemplate autoWorkPlans = _cache["Get"] as ObjectsTemplate; 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 Get(); ID Save(AutoWorkPlan item); void Delete(ID id); } #endregion }