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 ProdBonusSupervisor [Serializable] public class ProdBonusLine: BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(ProdBonusLine)); #endregion #region Constructor #region Input validator #endregion public ProdBonusLine() { _scheduledHour = 0; } #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 EmployeeID : ID //private ID _employeeID; //public ID EmployeeID //{ // get { return _employeeID; } // set // { // base.OnPropertyChange("EmployeeID", _employeeID, value); // _employeeID = value; // } //} //#endregion #region LineAchievedPercent : double private double _lineAchievedPercent; public double LineAchievedPercent { get { return _lineAchievedPercent; } set { base.OnPropertyChange("LineAchievedPercent", _lineAchievedPercent, value); _lineAchievedPercent = value; } } #endregion #region OTHour : double private double _lineOTHour; public double LineOTHour { get { return _lineOTHour; } set { base.OnPropertyChange("OTHour", _lineOTHour, value); _lineOTHour = value; } } #endregion #region ScheduledHour : double private double _scheduledHour; public double ScheduledHour { get { return _scheduledHour; } set { base.OnPropertyChange("OTHour", _scheduledHour, value); _scheduledHour = value; } } #endregion #region LineName : string private string _lineName; public string LineName { get { return _lineName; } set { base.OnPropertyChange("LineName", _lineName, value); _lineName = value; } } #region Property ProdBonusParameters : ProdBonusParameters private ObjectsTemplate _prodBonusParameter; public ObjectsTemplate ProdBonusParameters { get { if (_prodBonusParameter == null && !this.ID.IsUnassigned && this.ID.Integer > 0) { _prodBonusParameter = Service.GetProdBonusParameters(this.ID); } return _prodBonusParameter; } set { _prodBonusParameter = value; } } #endregion #endregion #region Property ProdBonusWorkSchedule : ProdBonusWorkSchedules private ObjectsTemplate _prodBonusWorkSchedule; public ObjectsTemplate ProdBonusWorkSchedules { get { if (_prodBonusWorkSchedule == null && !this.ID.IsUnassigned && this.ID.Integer > 0) { _prodBonusWorkSchedule = Service.GetProdBonusWorkSchedules(this.ID); } return _prodBonusWorkSchedule; } set { _prodBonusWorkSchedule = value; } } #endregion #region Property ProdBonusSupervisor : ProdBonusSupervisors private ObjectsTemplate _prodBonusSupervisor; public ObjectsTemplate ProdBonusSupervisors { get { if (_prodBonusSupervisor == null && !this.ID.IsUnassigned && this.ID.Integer > 0) { _prodBonusSupervisor = Service.GetProdBonusSupervisors(this.ID); } return _prodBonusSupervisor; } set { _prodBonusSupervisor = value; } } #endregion #region Service Factory IProdBonusLineService : IProdBonusLineService internal static IProdBonusLineService Service { get { return Services.Factory.CreateService(typeof(IProdBonusLineService)); } } #endregion #endregion #region Functions public static ProdBonusLine Get(ID nID) { ProdBonusLine oProdBonusSupervisor = null; #region Cache Header oProdBonusSupervisor = (ProdBonusLine)_cache["Get", nID]; if (oProdBonusSupervisor != null) return oProdBonusSupervisor; #endregion oProdBonusSupervisor = ProdBonusLine.Service.Get(nID); #region Cache Footer _cache.Add(oProdBonusSupervisor, "Get", nID); #endregion return oProdBonusSupervisor; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate ProdBonusSupervisors = _cache["Get"] as ObjectsTemplate; if (ProdBonusSupervisors != null) return ProdBonusSupervisors; #endregion try { ProdBonusSupervisors = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ProdBonusSupervisors, "Get"); #endregion return ProdBonusSupervisors; } public ID Save() { this.SetAuditTrailProperties(); return ProdBonusLine.Service.Save(this); } public void Delete(ID id) { ProdBonusLine.Service.Delete(id); } #endregion } #endregion #region IProdBonusSupervisor Service public interface IProdBonusLineService { ProdBonusLine Get(ID id); ObjectsTemplate Get(); ID Save(ProdBonusLine item); void Delete(ID id); ObjectsTemplate GetProdBonusParameters(ID iD); ObjectsTemplate GetProdBonusWorkSchedules(ID iD); ObjectsTemplate GetProdBonusSupervisors(ID iD); } #endregion }