using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35; using Ease.CoreV35.Model; using Ease.CoreV35.Caching; namespace Payroll.BO { #region BudgetCostCenter [Serializable] public class BudgetCostCenter : ObjectTemplate { #region Cache Store private static Cache _cache = new Cache(typeof(BudgetCostCenter)); #endregion #region Constructor public BudgetCostCenter() { _costCenterID = null; _budgetID = null; _employeeID = null; _fromMonth = DateTime.MinValue; _percentage = 0.0; } #endregion #region Properties #region CostCenterID : ID private ID _costCenterID; public ID CostCenterID { get { return _costCenterID; } set { _costCenterID = value; } } #endregion #region BudgetID : ID private ID _budgetID; public ID BudgetID { get { return _budgetID; } set { _budgetID = value; } } #endregion #region EmployeeID : ID private ID _employeeID; public ID EmployeeID { get { return _employeeID; } set { _employeeID = value; } } #endregion #region FromMonth : Datetime private DateTime _fromMonth; public DateTime FromMonth { get { return _fromMonth; } set { _fromMonth = value; } } #endregion #region Percentage : double private double _percentage; public double Percentage { get { return _percentage; } set { _percentage = value; } } #endregion #region Service Factory IBudgetCostCenterService : IBudgetCostCenterService internal static IBudgetCostCenterService Service { get { return Services.Factory.CreateService(typeof(IBudgetCostCenterService)); } } #endregion #endregion #region Function(s) #region Get public static BudgetCostCenter Get(ID nID) { BudgetCostCenter oBudgetCostCenter = null; #region Cache Header oBudgetCostCenter = (BudgetCostCenter)_cache["Get", nID]; if (oBudgetCostCenter != null) return oBudgetCostCenter; #endregion try { oBudgetCostCenter = Service.Get(nID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oBudgetCostCenter, "Get", nID); #endregion return oBudgetCostCenter; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate oBudgetCostCenters = _cache["Get"] as ObjectsTemplate; if (oBudgetCostCenters != null) return oBudgetCostCenters; #endregion try { oBudgetCostCenters = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oBudgetCostCenters, "Get"); #endregion return oBudgetCostCenters; } public static ObjectsTemplate Get(int nBudID) { #region Cache Header ObjectsTemplate oBudgetCostCenters = _cache["Get"] as ObjectsTemplate; if (oBudgetCostCenters != null) return oBudgetCostCenters; #endregion try { oBudgetCostCenters = Service.Get(nBudID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oBudgetCostCenters, "Get"); #endregion return oBudgetCostCenters; } #endregion #region Save public ID Save() { //SetAuditTrailProperties(); return Service.Save(this); } #endregion #region Delete public void Delete(ID id) { Service.Delete(id); } #endregion #endregion } #endregion #region IBudgetCostCenterService public interface IBudgetCostCenterService { BudgetCostCenter Get(ID nID); ObjectsTemplate Get(); ObjectsTemplate Get(int nBudID); ID Save(BudgetCostCenter item); void Delete(ID nID); } #endregion }