using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35; using Ease.CoreV35.Model; using Ease.CoreV35.Caching; using System.Data.Linq.Mapping; namespace Payroll.BO { #region OTSlab [Serializable] public class OTSlab:AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(OTSlab)); #endregion #region Constructor public OTSlab() { // _payrollTypeID = 0; _termID = null; _hours = 0; _amount = 0; } #endregion #region Properties #region TermID : ID private ID _termID; public ID TermID { get { return _termID; } set { base.OnPropertyChange("TermID", _termID, value); _termID = value; } } #endregion #region hours : int private int _hours; public int Hours { get { return _hours; } set { base.OnPropertyChange("hours", _hours, value); _hours = value; } } #endregion #region amount : int private double _amount; public double Amount { get { return _amount; } set { base.OnPropertyChange("amount", _amount, value); _amount = value; } } #endregion #region Service Factory IOTSlabService : IOTSlabService internal static IOTSlabService Service { get { return Services.Factory.CreateService(typeof(IOTSlabService)); } } #endregion #endregion #region Functions public static OTSlab Get(ID nID) { OTSlab oOTSlab = null; #region Cache Header oOTSlab = (OTSlab)_cache["Get", nID]; if (oOTSlab != null) return oOTSlab; #endregion oOTSlab = OTSlab.Service.Get(nID); #region Cache Footer _cache.Add(oOTSlab, "Get", nID); #endregion return oOTSlab; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate oTSlabs = _cache["Get"] as ObjectsTemplate; if (oTSlabs != null) return oTSlabs; #endregion try { oTSlabs = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oTSlabs, "Get"); #endregion return oTSlabs; } public static ObjectsTemplate GetByTermID(ID nTermID) { #region Cache Header ObjectsTemplate oTSlabs = _cache["Get",nTermID] as ObjectsTemplate; if (oTSlabs != null) return oTSlabs; #endregion try { oTSlabs = Service.GetByTermID(nTermID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oTSlabs, "Get",nTermID); #endregion return oTSlabs; } public static void Save(ObjectsTemplate _OTSlabs) { //foreach (OTSlab oTSlab in _OTSlabs) //{ // oTSlab.SetAuditTrailProperties(); //} OTSlab.Service.Save(_OTSlabs); } public ID Save() { return OTSlab.Service.Save(this); } public void Delete() { OTSlab.Service.Delete(ID); } #endregion } #endregion #region IOTSlab Service public interface IOTSlabService { OTSlab Get(ID id); ObjectsTemplate Get(); ObjectsTemplate GetByTermID(ID nTermID); ID Save(OTSlab item); void Save(ObjectsTemplate _OTSlabs); void Delete(ID id); } #endregion }