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 ProdBonusAttn [Serializable] public class ProdBonusAttn: BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(ProdBonusAttn)); #endregion #region Constructor #region Input validator #endregion public ProdBonusAttn() { _isCommon = false; } #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 BonusScheduleID : ID private ID _bonusScheduleID; public ID BonusScheduleID { get { return _bonusScheduleID; } set { base.OnPropertyChange("BonusScheduleID", _bonusScheduleID, value); _bonusScheduleID = value; } } #endregion #region ProdBonusLineID : ID private ID _prodBonusLineID; public ID ProdBonusLineID { get { return _prodBonusLineID; } set { base.OnPropertyChange("ProdBonusLineID", _prodBonusLineID, value); _prodBonusLineID = value; } } #endregion #region InTime : DateTime private DateTime _inTime; public DateTime InTime { get { return _inTime; } set { base.OnPropertyChange("InTime", _inTime, value); _inTime = value; } } #endregion #region OutTime : DateTime private DateTime _outTime; public DateTime OutTime { get { return _outTime; } set { base.OnPropertyChange("OutTime", _outTime, value); _outTime = value; } } #endregion #region BonusHour : float private double _bonusHour; public double BonusHour { get { return _bonusHour; } set { base.OnPropertyChange("BonusHour", _bonusHour, value); _bonusHour = value; } } #endregion #region EmployeeID : ID private ID _employeeID; public ID EmployeeID { get { return _employeeID; } set { base.OnPropertyChange("EmployeeID", _employeeID, value); _employeeID = value; } } #endregion #region IsCommon : bool private bool _isCommon; public bool IsCommon { get { return _isCommon; } set { base.OnPropertyChange("IsCommon", _isCommon, value); _isCommon = value; } } #endregion #region Service Factory IProdBonusAttnService : IProdBonusAttnService internal static IProdBonusAttnService Service { get { return Services.Factory.CreateService(typeof(IProdBonusAttnService)); } } #endregion #endregion #region Functions public static ProdBonusAttn Get(ID nID) { ProdBonusAttn oProdBonusAttn = null; #region Cache Header oProdBonusAttn = (ProdBonusAttn)_cache["Get", nID]; if (oProdBonusAttn != null) return oProdBonusAttn; #endregion oProdBonusAttn = ProdBonusAttn.Service.Get(nID); #region Cache Footer _cache.Add(oProdBonusAttn, "Get", nID); #endregion return oProdBonusAttn; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate ProdBonusAttns = _cache["Get"] as ObjectsTemplate; if (ProdBonusAttns != null) return ProdBonusAttns; #endregion try { ProdBonusAttns = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ProdBonusAttns, "Get"); #endregion return ProdBonusAttns; } public static ObjectsTemplate Get(int setupID, int ScheduleID) { ObjectsTemplate ProdBonusAttns = new ObjectsTemplate(); try { ProdBonusAttns = Service.Get(setupID, ScheduleID); } catch (ServiceException e) { throw new Exception(e.Message, e); } return ProdBonusAttns; } public static ObjectsTemplate Get(EnumStatus status) { #region Cache Header ObjectsTemplate ProdBonusAttns = _cache["Get", status] as ObjectsTemplate; if (ProdBonusAttns != null) return ProdBonusAttns; #endregion try { //ProdBonusAttns = Service.Get(status); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ProdBonusAttns, "Get", status); #endregion return ProdBonusAttns; } public static ObjectsTemplate GetBySetupID(ID iD) { ObjectsTemplate ProdBonusAttns = new ObjectsTemplate(); try { ProdBonusAttns = Service.GetBySetupID(iD); } catch (ServiceException e) { throw new Exception(e.Message, e); } return ProdBonusAttns; } public static ObjectsTemplate GetByLineID(ID lineID) { ObjectsTemplate ProdBonusAttns = new ObjectsTemplate(); try { ProdBonusAttns = Service.GetByLineID(lineID); } catch (ServiceException e) { throw new Exception(e.Message, e); } return ProdBonusAttns; } public ID Save() { this.SetAuditTrailProperties(); return ProdBonusAttn.Service.Save(this); } public static void SaveAll(List oProdBonusAttns,ID bSetupID, ID scheduleID) { foreach (ProdBonusAttn item in oProdBonusAttns) { item.SetAuditTrailProperties(); } ProdBonusAttn.Service.Save(oProdBonusAttns, bSetupID, scheduleID); } public void Delete(ID id) { ProdBonusAttn.Service.Delete(id); } #endregion public static List Get(int setupID, DateTime dateTime) { ObjectsTemplate ProdBonusAttns = new ObjectsTemplate(); try { ProdBonusAttns = Service.Get(setupID, dateTime); } catch (ServiceException e) { throw new Exception(e.Message, e); } return ProdBonusAttns; } } #endregion #region IProdBonusAttn Service public interface IProdBonusAttnService { ProdBonusAttn Get(ID id); ObjectsTemplate Get(); ID Save(ProdBonusAttn item); void Delete(ID id); void Save(List oProdBonusAttns, ID bSetupID, ID scheduleID); ObjectsTemplate Get(int setupID, int ScheduleID); ObjectsTemplate GetBySetupID(ID iD); ObjectsTemplate GetByLineID(ID lineID); ObjectsTemplate Get(int setupID, DateTime dateTime); } #endregion }