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 ProductionBonusSetup [Serializable] public class ProductionBonusSetup: BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(ProductionBonusSetup)); #endregion #region Constructor #region Input validator #endregion public ProductionBonusSetup() { _oTHour = 0; _salaryMonth = DateTime.MinValue; _designNo = string.Empty; } #endregion #region Properties #region AchivedPercent : double private double _achivedPercent; public double AchivedPercent { get { return _achivedPercent; } set { base.OnPropertyChange("AchivedPercent", _achivedPercent, value); _achivedPercent = value; } } #endregion #region OTHour : double private double _oTHour; public double OTHour { get { return _oTHour; } set { base.OnPropertyChange("OTHour", _oTHour, value); _oTHour = value; } } #endregion #region MaxPerson : int private int _maxPerson; public int MaxPerson { get { return _maxPerson; } set { base.OnPropertyChange("MaxPerson", _maxPerson, value); _maxPerson = value; } } #endregion #region SalaryMonth : string private DateTime _salaryMonth; public DateTime SalaryMonth { get { return _salaryMonth; } set { base.OnPropertyChange("SalaryMonth", _salaryMonth, value); _salaryMonth = value; } } #endregion #region DesignNo : string private string _designNo; public string DesignNo { get { return _designNo; } set { base.OnPropertyChange("DesignNo", _designNo, value); _designNo = value; } } #endregion #region ProgramName : string private string _programName; public string ProgramName { get { return _programName; } set { base.OnPropertyChange("ProgramName", _designNo, value); _programName = value; } } #endregion #region FromDate : DateTime private DateTime _fromDate; public DateTime FromDate { get { return _fromDate; } set { base.OnPropertyChange("FromDate", _fromDate, value); _fromDate = value; } } #endregion #region ToDate : DateTime private DateTime _toDate; public DateTime ToDate { get { return _toDate; } set { base.OnPropertyChange("ToDate", _toDate, value); _toDate = value; } } #endregion #region Status : EnumBonusStatus private EnumBonusStatus _Status; public EnumBonusStatus Status { get { return _Status; } set { _Status = value; } } #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 ProductionBonusLines : ProductionBonusLine private ObjectsTemplate _ProdBonusLines; public ObjectsTemplate ProductionBonusLines { get { if (_ProdBonusLines == null && !this.ID.IsUnassigned && this.ID.Integer > 0) { _ProdBonusLines = Service.GetProductionBonusLine(this.ID); } return _ProdBonusLines; } set { _ProdBonusLines = value; } } #endregion #region Service Factory IProductionBonusSetupService : IProductionBonusSetupService internal static IProductionBonusSetupService Service { get { return Services.Factory.CreateService(typeof(IProductionBonusSetupService)); } } #endregion #endregion #region Functions public static ProductionBonusSetup Get(ID nID) { ProductionBonusSetup oProductionBonusSetup = null; #region Cache Header oProductionBonusSetup = (ProductionBonusSetup)_cache["Get", nID]; if (oProductionBonusSetup != null) return oProductionBonusSetup; #endregion oProductionBonusSetup = ProductionBonusSetup.Service.Get(nID); #region Cache Footer _cache.Add(oProductionBonusSetup, "Get", nID); #endregion return oProductionBonusSetup; } public static ProductionBonusSetup Get(string DesignNo) { ProductionBonusSetup oProductionBonusSetup = null; #region Cache Header oProductionBonusSetup = (ProductionBonusSetup)_cache["Get", DesignNo]; if (oProductionBonusSetup != null) return oProductionBonusSetup; #endregion oProductionBonusSetup = ProductionBonusSetup.Service.Get(DesignNo); #region Cache Footer _cache.Add(oProductionBonusSetup, "Get", DesignNo); #endregion return oProductionBonusSetup; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate ProductionBonusSetups = _cache["Get"] as ObjectsTemplate; if (ProductionBonusSetups != null) return ProductionBonusSetups; #endregion try { ProductionBonusSetups = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ProductionBonusSetups, "Get"); #endregion return ProductionBonusSetups; } public static ObjectsTemplate Get(DateTime dtSalaryMonth) { #region Cache Header ObjectsTemplate ProductionBonusSetups = _cache["Get"] as ObjectsTemplate; if (ProductionBonusSetups != null) return ProductionBonusSetups; #endregion try { ProductionBonusSetups = Service.Get(dtSalaryMonth); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ProductionBonusSetups, "Get"); #endregion return ProductionBonusSetups; } public static ObjectsTemplate Get(EnumBonusStatus status) { #region Cache Header ObjectsTemplate ProductionBonusSetups = _cache["Get", status] as ObjectsTemplate; if (ProductionBonusSetups != null) return ProductionBonusSetups; #endregion try { ProductionBonusSetups = Service.Get(status); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(ProductionBonusSetups, "Get", status); #endregion return ProductionBonusSetups; } public ID Save() { this.SetAuditTrailProperties(); return ProductionBonusSetup.Service.Save(this); } public void Delete(ID id) { ProductionBonusSetup.Service.Delete(id); } #endregion } #endregion #region IProductionBonusSetup Service public interface IProductionBonusSetupService { ProductionBonusSetup Get(ID id); ObjectsTemplate Get(); ObjectsTemplate Get(DateTime dtSalaryMonth); ObjectsTemplate Get(EnumBonusStatus status); ID Save(ProductionBonusSetup item); void Delete(ID id); ProductionBonusSetup Get(string DesignNo); ObjectsTemplate GetProductionBonusLine(ID iD); ObjectsTemplate GetProdBonusWorkSchedules(ID iD); } #endregion }