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 CRGDepartmentLookup [Serializable] public class CRGDepartmentLookup : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(CRGDepartmentLookup)); #endregion #region Constructor public CRGDepartmentLookup() { _CrgID = ID.FromInteger(0); _DepartmentID = ID.FromInteger(0); } #endregion #region Properties #region CrgID : ID private ID _CrgID; public ID CrgID { get { return _CrgID; } set { base.OnPropertyChange("CrgID", _CrgID, value); _CrgID = value; } } #endregion #region DepartmentID : ID private ID _DepartmentID; public ID DepartmentID { get { return _DepartmentID; } set { base.OnPropertyChange("DepartmentID", _DepartmentID, value); _DepartmentID = value; } } #endregion #region Service Factory ICompanyService : ICompanyService internal static ICRGDepartmentLookupService Service { get { return Services.Factory.CreateService(typeof(ICRGDepartmentLookupService)); } } #endregion #endregion #region Functions public static CRGDepartmentLookup Get(ID nID) { CRGDepartmentLookup oCRGDepartmentLookup = null; #region Cache Header oCRGDepartmentLookup = (CRGDepartmentLookup)_cache["Get", nID]; if (oCRGDepartmentLookup != null) return oCRGDepartmentLookup; #endregion oCRGDepartmentLookup = CRGDepartmentLookup.Service.Get(nID); #region Cache Footer _cache.Add(oCRGDepartmentLookup, "Get", nID); #endregion return oCRGDepartmentLookup; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate oCDlookups = _cache["Get"] as ObjectsTemplate; if (oCDlookups != null) return oCDlookups; #endregion try { oCDlookups = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oCDlookups, "Get"); #endregion return oCDlookups; } public ID Save() { base.SetAuditTrailProperties(); return CRGDepartmentLookup.Service.Save(this); } public void Save(ObjectsTemplate oCDLookups) { foreach (CRGDepartmentLookup item in oCDLookups) { item.SetAuditTrailProperties(); } CRGDepartmentLookup.Service.Save(oCDLookups); } public void Delete(ID id) { CRGDepartmentLookup.Service.Delete(id); } #endregion } #endregion #region ICompany Service public interface ICRGDepartmentLookupService { CRGDepartmentLookup Get(ID id); ID Save(CRGDepartmentLookup item); void Delete(ID id); ObjectsTemplate Get(); void Save(ObjectsTemplate oCDLookups); } #endregion }