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; using System.Data; namespace Payroll.BO { #region ProdBonusParameter [Serializable] public class ProdBonusParameter: BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(ProdBonusParameter)); #endregion #region Constructor #region Input validator #endregion public ProdBonusParameter() { _itemType = EnumBonusItemType.Department; } #endregion #region Properties #region ProdBonusSetupID : ID private ID _prodBonusSetupID; public ID ProdBonusSetupID { get { return _prodBonusSetupID; } set { base.OnPropertyChange("ProdBonusSetupID", _prodBonusSetupID, value); _prodBonusSetupID = value; } } #endregion #region ProdBonusLineID : ID private ID _prodBonusLineID; public ID ProdBonusLineID { get { return _prodBonusLineID; } set { base.OnPropertyChange("ProdBonusLineID", _prodBonusLineID, value); _prodBonusLineID = value; } } #endregion #region ItemID : ID private ID _itemID; public ID ItemID { get { return _itemID; } set { base.OnPropertyChange("ItemID", _itemID, value); _itemID = value; } } #endregion #region ItemType : EnumBonusItemType private EnumBonusItemType _itemType; public EnumBonusItemType ItemType { get { return _itemType; } set { _itemType = value; } } #endregion #region Service Factory IProdBonusParameterService : IProdBonusParameterService internal static IProdBonusParameterService Service { get { return Services.Factory.CreateService(typeof(IProdBonusParameterService)); } } #endregion #endregion #region Functions public static ProdBonusParameter Get(ID nID) { ProdBonusParameter oProdBonusParameter = null; #region Cache Header oProdBonusParameter = (ProdBonusParameter)_cache["Get", nID]; if (oProdBonusParameter != null) return oProdBonusParameter; #endregion oProdBonusParameter = ProdBonusParameter.Service.Get(nID); #region Cache Footer _cache.Add(oProdBonusParameter, "Get", nID); #endregion return oProdBonusParameter; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate ProdBonusParameters = _cache["Get"] as ObjectsTemplate; if (ProdBonusParameters != null) return ProdBonusParameters; #endregion try { ProdBonusParameters = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ProdBonusParameters, "Get"); #endregion return ProdBonusParameters; } public static ObjectsTemplate Get(int nSetupID) { #region Cache Header ObjectsTemplate ProdBonusParameters = _cache["Get"] as ObjectsTemplate; if (ProdBonusParameters != null) return ProdBonusParameters; #endregion try { ProdBonusParameters = Service.Get(nSetupID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ProdBonusParameters, "Get"); #endregion return ProdBonusParameters; } public static ObjectsTemplate Get(EnumStatus status) { #region Cache Header ObjectsTemplate ProdBonusParameters = _cache["Get", status] as ObjectsTemplate; if (ProdBonusParameters != null) return ProdBonusParameters; #endregion try { // ProdBonusParameters = Service.Get(status); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ProdBonusParameters, "Get", status); #endregion return ProdBonusParameters; } public ID Save() { this.SetAuditTrailProperties(); return ProdBonusParameter.Service.Save(this); } public void Delete(ID id) { ProdBonusParameter.Service.Delete(id); } #endregion } #endregion #region IProdBonusParameter Service public interface IProdBonusParameterService { ProdBonusParameter Get(ID id); ObjectsTemplate Get(); ObjectsTemplate Get(int nSetupID); ID Save(ProdBonusParameter item); void Delete(ID id); } #endregion }