CEL_Payroll/Payroll.BO/Bonus/ProdBonusAttn.cs

348 lines
8.6 KiB
C#
Raw Permalink 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 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<ID>("ProdBonusSetupID", _prodBonusSetupID, value);
_prodBonusSetupID = value;
}
}
#endregion
#region BonusScheduleID : ID
private ID _bonusScheduleID;
public ID BonusScheduleID
{
get { return _bonusScheduleID; }
set
{
base.OnPropertyChange<ID>("BonusScheduleID", _bonusScheduleID, value);
_bonusScheduleID = value;
}
}
#endregion
#region ProdBonusLineID : ID
private ID _prodBonusLineID;
public ID ProdBonusLineID
{
get { return _prodBonusLineID; }
set
{
base.OnPropertyChange<ID>("ProdBonusLineID", _prodBonusLineID, value);
_prodBonusLineID = value;
}
}
#endregion
#region InTime : DateTime
private DateTime _inTime;
public DateTime InTime
{
get { return _inTime; }
set
{
base.OnPropertyChange<DateTime>("InTime", _inTime, value);
_inTime = value;
}
}
#endregion
#region OutTime : DateTime
private DateTime _outTime;
public DateTime OutTime
{
get { return _outTime; }
set
{
base.OnPropertyChange<DateTime>("OutTime", _outTime, value);
_outTime = value;
}
}
#endregion
#region BonusHour : float
private double _bonusHour;
public double BonusHour
{
get { return _bonusHour; }
set
{
base.OnPropertyChange<double>("BonusHour", _bonusHour, value);
_bonusHour = 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 IsCommon : bool
private bool _isCommon;
public bool IsCommon
{
get { return _isCommon; }
set
{
base.OnPropertyChange<bool>("IsCommon", _isCommon, value);
_isCommon = value;
}
}
#endregion
#region Service Factory IProdBonusAttnService : IProdBonusAttnService
internal static IProdBonusAttnService Service
{
get { return Services.Factory.CreateService<IProdBonusAttnService>(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<ProdBonusAttn> Get()
{
#region Cache Header
ObjectsTemplate<ProdBonusAttn> ProdBonusAttns = _cache["Get"] as ObjectsTemplate<ProdBonusAttn>;
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<ProdBonusAttn> Get(int setupID, int ScheduleID)
{
ObjectsTemplate<ProdBonusAttn> ProdBonusAttns = new ObjectsTemplate<ProdBonusAttn>();
try
{
ProdBonusAttns = Service.Get(setupID, ScheduleID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
return ProdBonusAttns;
}
public static ObjectsTemplate<ProdBonusAttn> Get(EnumStatus status)
{
#region Cache Header
ObjectsTemplate<ProdBonusAttn> ProdBonusAttns = _cache["Get", status] as ObjectsTemplate<ProdBonusAttn>;
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<ProdBonusAttn> GetBySetupID(ID iD)
{
ObjectsTemplate<ProdBonusAttn> ProdBonusAttns = new ObjectsTemplate<ProdBonusAttn>();
try
{
ProdBonusAttns = Service.GetBySetupID(iD);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
return ProdBonusAttns;
}
public static ObjectsTemplate<ProdBonusAttn> GetByLineID(ID lineID)
{
ObjectsTemplate<ProdBonusAttn> ProdBonusAttns = new ObjectsTemplate<ProdBonusAttn>();
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<ProdBonusAttn> 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<ProdBonusAttn> Get(int setupID, DateTime dateTime)
{
ObjectsTemplate<ProdBonusAttn> ProdBonusAttns = new ObjectsTemplate<ProdBonusAttn>();
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<ProdBonusAttn> Get();
ID Save(ProdBonusAttn item);
void Delete(ID id);
void Save(List<ProdBonusAttn> oProdBonusAttns, ID bSetupID, ID scheduleID);
ObjectsTemplate<ProdBonusAttn> Get(int setupID, int ScheduleID);
ObjectsTemplate<ProdBonusAttn> GetBySetupID(ID iD);
ObjectsTemplate<ProdBonusAttn> GetByLineID(ID lineID);
ObjectsTemplate<ProdBonusAttn> Get(int setupID, DateTime dateTime);
}
#endregion
}