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 BudgetDepartment [Serializable] public class BudgetDepartment : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(BudgetDepartment)); #endregion #region Constructor public BudgetDepartment() { _deptID = null; _budID = null; } #endregion #region Properties #region BudgetID : ID private ID _budID; public ID BudgetudID { get { return _budID; } set { base.OnPropertyChange("BudgetudID", _budID, value); _budID = value; } } #endregion #region DepartmentID : ID private ID _deptID; public ID DepartmentID { get { return _deptID; } set { base.OnPropertyChange("DepartmentID", _deptID, value); _deptID = value; } } #endregion #region Service Factory IBudgetDepartmentService : IBudgetDepartmentService internal static IBudgetDepartmentService Service { get { return Services.Factory.CreateService(typeof(IBudgetDepartmentService)); } } #endregion #endregion #region Functions public static BudgetDepartment Get(ID nID) { BudgetDepartment oBudgetDepartment = null; #region Cache Header oBudgetDepartment = (BudgetDepartment)_cache["Get", nID]; if (oBudgetDepartment != null) return oBudgetDepartment; #endregion oBudgetDepartment = BudgetDepartment.Service.Get(nID); #region Cache Footer _cache.Add(oBudgetDepartment, "Get", nID); #endregion return oBudgetDepartment; } public static ObjectsTemplate Get(int nBudgetID) { #region Cache Header ObjectsTemplate BudgetDepartments = _cache["Get",nBudgetID] as ObjectsTemplate; if (BudgetDepartments != null) return BudgetDepartments; #endregion try { BudgetDepartments = Service.Get(nBudgetID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(BudgetDepartments, "Get",nBudgetID); #endregion return BudgetDepartments; } public ID Save() { this.SetAuditTrailProperties(); return BudgetDepartment.Service.Save(this); } public void Delete(ID id) { BudgetDepartment.Service.Delete(id); } #endregion } #endregion #region IBudgetDepartment Service public interface IBudgetDepartmentService { BudgetDepartment Get(ID id); ObjectsTemplate Get(int nBudgetID); ID Save(BudgetDepartment item); void Delete(ID id); } #endregion }