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 BudgetGrade [Serializable] public class BudgetGrade : ObjectTemplate { #region Cache Store private static Cache _cache = new Cache(typeof(BudgetGrade)); #endregion #region Constructor public BudgetGrade() { _budgetID = null; _changedPercentage = 0.0; _fixedAmount = 0.0; _gradeID = null; } #endregion #region Properties #region BudgetID : ID private ID _budgetID; public ID BudgetID { get { return _budgetID; } set { _budgetID = value; } } #endregion #region ChangedPercentage : double private double _changedPercentage; public double ChangedPercentage { get { return _changedPercentage; } set { _changedPercentage = value; } } #endregion #region FixedAmount : double private double _fixedAmount; public double FixedAmount { get { return _fixedAmount; } set { _fixedAmount = value; } } #endregion #region GradeID : ID private ID _gradeID; public ID GradeID { get { return _gradeID; } set { _gradeID = value; } } #endregion #region Service Factory IBudgetGradeService : IBudgetGradeService internal static IBudgetGradeService Service { get { return Services.Factory.CreateService(typeof(IBudgetGradeService)); } } #endregion #endregion #region Function(s) #region Get public static BudgetGrade Get(ID nID) { BudgetGrade oBudgetGrade = null; #region Cache Header oBudgetGrade = (BudgetGrade)_cache["Get", nID]; if (oBudgetGrade != null) return oBudgetGrade; #endregion try { oBudgetGrade = Service.Get(nID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oBudgetGrade, "Get", nID); #endregion return oBudgetGrade; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate oBudgetGrades = _cache["Get"] as ObjectsTemplate; if (oBudgetGrades != null) return oBudgetGrades; #endregion try { oBudgetGrades = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oBudgetGrades, "Get"); #endregion return oBudgetGrades; } public static ObjectsTemplate Get(int nBudID) { #region Cache Header ObjectsTemplate oBudgetGrades = _cache["Get"] as ObjectsTemplate; if (oBudgetGrades != null) return oBudgetGrades; #endregion try { oBudgetGrades = Service.Get(nBudID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(oBudgetGrades, "Get"); #endregion return oBudgetGrades; } #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 IBudgetGradeService public interface IBudgetGradeService { BudgetGrade Get(ID nID); ObjectsTemplate Get(); ObjectsTemplate Get(int nBudID); ID Save(BudgetGrade oBudgetGrade); void Delete(ID nID); } #endregion }