CEL_Payroll/Payroll.BO/Bonus/ProductionBonusSetup.cs

384 lines
9.7 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
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<double>("AchivedPercent", _achivedPercent, value);
_achivedPercent = value;
}
}
#endregion
#region OTHour : double
private double _oTHour;
public double OTHour
{
get { return _oTHour; }
set
{
base.OnPropertyChange<double>("OTHour", _oTHour, value);
_oTHour = value;
}
}
#endregion
#region MaxPerson : int
private int _maxPerson;
public int MaxPerson
{
get { return _maxPerson; }
set
{
base.OnPropertyChange<int>("MaxPerson", _maxPerson, value);
_maxPerson = value;
}
}
#endregion
#region SalaryMonth : string
private DateTime _salaryMonth;
public DateTime SalaryMonth
{
get { return _salaryMonth; }
set
{
base.OnPropertyChange<DateTime>("SalaryMonth", _salaryMonth, value);
_salaryMonth = value;
}
}
#endregion
#region DesignNo : string
private string _designNo;
public string DesignNo
{
get { return _designNo; }
set
{
base.OnPropertyChange<string>("DesignNo", _designNo, value);
_designNo = value;
}
}
#endregion
#region ProgramName : string
private string _programName;
public string ProgramName
{
get { return _programName; }
set
{
base.OnPropertyChange<string>("ProgramName", _designNo, value);
_programName = value;
}
}
#endregion
#region FromDate : DateTime
private DateTime _fromDate;
public DateTime FromDate
{
get { return _fromDate; }
set
{
base.OnPropertyChange<DateTime>("FromDate", _fromDate, value);
_fromDate = value;
}
}
#endregion
#region ToDate : DateTime
private DateTime _toDate;
public DateTime ToDate
{
get { return _toDate; }
set
{
base.OnPropertyChange<DateTime>("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> _prodBonusWorkSchedule;
public ObjectsTemplate<ProdBonusWorkSchedule> 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<ProdBonusLine> _ProdBonusLines;
public ObjectsTemplate<ProdBonusLine> 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<IProductionBonusSetupService>(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<ProductionBonusSetup> Get()
{
#region Cache Header
ObjectsTemplate<ProductionBonusSetup> ProductionBonusSetups = _cache["Get"] as ObjectsTemplate<ProductionBonusSetup>;
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<ProductionBonusSetup> Get(DateTime dtSalaryMonth)
{
#region Cache Header
ObjectsTemplate<ProductionBonusSetup> ProductionBonusSetups = _cache["Get"] as ObjectsTemplate<ProductionBonusSetup>;
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<ProductionBonusSetup> Get(EnumBonusStatus status)
{
#region Cache Header
ObjectsTemplate<ProductionBonusSetup> ProductionBonusSetups = _cache["Get", status] as ObjectsTemplate<ProductionBonusSetup>;
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<ProductionBonusSetup> Get();
ObjectsTemplate<ProductionBonusSetup> Get(DateTime dtSalaryMonth);
ObjectsTemplate<ProductionBonusSetup> Get(EnumBonusStatus status);
ID Save(ProductionBonusSetup item);
void Delete(ID id);
ProductionBonusSetup Get(string DesignNo);
ObjectsTemplate<ProdBonusLine> GetProductionBonusLine(ID iD);
ObjectsTemplate<ProdBonusWorkSchedule> GetProdBonusWorkSchedules(ID iD);
}
#endregion
}