CEL_Payroll/Payroll.BO/Bonus/ProdBonusLine.cs
2024-09-17 14:30:13 +06:00

286 lines
7.1 KiB
C#

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<ID>("ProdBonusSetupID", _prodBonusSetupID, value);
_prodBonusSetupID = value;
}
}
#endregion
//#region EmployeeID : ID
//private ID _employeeID;
//public ID EmployeeID
//{
// get { return _employeeID; }
// set
// {
// base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
// _employeeID = value;
// }
//}
//#endregion
#region LineAchievedPercent : double
private double _lineAchievedPercent;
public double LineAchievedPercent
{
get { return _lineAchievedPercent; }
set
{
base.OnPropertyChange<double>("LineAchievedPercent", _lineAchievedPercent, value);
_lineAchievedPercent = value;
}
}
#endregion
#region OTHour : double
private double _lineOTHour;
public double LineOTHour
{
get { return _lineOTHour; }
set
{
base.OnPropertyChange<double>("OTHour", _lineOTHour, value);
_lineOTHour = value;
}
}
#endregion
#region ScheduledHour : double
private double _scheduledHour;
public double ScheduledHour
{
get { return _scheduledHour; }
set
{
base.OnPropertyChange<double>("OTHour", _scheduledHour, value);
_scheduledHour = value;
}
}
#endregion
#region LineName : string
private string _lineName;
public string LineName
{
get { return _lineName; }
set
{
base.OnPropertyChange<string>("LineName", _lineName, value);
_lineName = value;
}
}
#region Property ProdBonusParameters : ProdBonusParameters
private ObjectsTemplate<ProdBonusParameter> _prodBonusParameter;
public ObjectsTemplate<ProdBonusParameter> 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> _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 ProdBonusSupervisor : ProdBonusSupervisors
private ObjectsTemplate<ProdBonusSupervisor> _prodBonusSupervisor;
public ObjectsTemplate<ProdBonusSupervisor> 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<IProdBonusLineService>(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<ProdBonusLine> Get()
{
#region Cache Header
ObjectsTemplate<ProdBonusLine> ProdBonusSupervisors = _cache["Get"] as ObjectsTemplate<ProdBonusLine>;
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<ProdBonusLine> Get();
ID Save(ProdBonusLine item);
void Delete(ID id);
ObjectsTemplate<ProdBonusParameter> GetProdBonusParameters(ID iD);
ObjectsTemplate<ProdBonusWorkSchedule> GetProdBonusWorkSchedules(ID iD);
ObjectsTemplate<ProdBonusSupervisor> GetProdBonusSupervisors(ID iD);
}
#endregion
}