CEL_Payroll/Payroll.BO/Bonus/ProdBonusParameter.cs

239 lines
5.7 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 ProdBonusParameter
[Serializable]
public class ProdBonusParameter: BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(ProdBonusParameter));
#endregion
#region Constructor
#region Input validator
#endregion
public ProdBonusParameter()
{
_itemType = EnumBonusItemType.Department;
}
#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 ProdBonusLineID : ID
private ID _prodBonusLineID;
public ID ProdBonusLineID
{
get { return _prodBonusLineID; }
set
{
base.OnPropertyChange<ID>("ProdBonusLineID", _prodBonusLineID, value);
_prodBonusLineID = value;
}
}
#endregion
#region ItemID : ID
private ID _itemID;
public ID ItemID
{
get { return _itemID; }
set
{
base.OnPropertyChange<ID>("ItemID", _itemID, value);
_itemID = value;
}
}
#endregion
#region ItemType : EnumBonusItemType
private EnumBonusItemType _itemType;
public EnumBonusItemType ItemType
{
get { return _itemType; }
set
{
_itemType = value;
}
}
#endregion
#region Service Factory IProdBonusParameterService : IProdBonusParameterService
internal static IProdBonusParameterService Service
{
get { return Services.Factory.CreateService<IProdBonusParameterService>(typeof(IProdBonusParameterService)); }
}
#endregion
#endregion
#region Functions
public static ProdBonusParameter Get(ID nID)
{
ProdBonusParameter oProdBonusParameter = null;
#region Cache Header
oProdBonusParameter = (ProdBonusParameter)_cache["Get", nID];
if (oProdBonusParameter != null)
return oProdBonusParameter;
#endregion
oProdBonusParameter = ProdBonusParameter.Service.Get(nID);
#region Cache Footer
_cache.Add(oProdBonusParameter, "Get", nID);
#endregion
return oProdBonusParameter;
}
public static ObjectsTemplate<ProdBonusParameter> Get()
{
#region Cache Header
ObjectsTemplate<ProdBonusParameter> ProdBonusParameters = _cache["Get"] as ObjectsTemplate<ProdBonusParameter>;
if (ProdBonusParameters != null)
return ProdBonusParameters;
#endregion
try
{
ProdBonusParameters = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(ProdBonusParameters, "Get");
#endregion
return ProdBonusParameters;
}
public static ObjectsTemplate<ProdBonusParameter> Get(int nSetupID)
{
#region Cache Header
ObjectsTemplate<ProdBonusParameter> ProdBonusParameters = _cache["Get"] as ObjectsTemplate<ProdBonusParameter>;
if (ProdBonusParameters != null)
return ProdBonusParameters;
#endregion
try
{
ProdBonusParameters = Service.Get(nSetupID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(ProdBonusParameters, "Get");
#endregion
return ProdBonusParameters;
}
public static ObjectsTemplate<ProdBonusParameter> Get(EnumStatus status)
{
#region Cache Header
ObjectsTemplate<ProdBonusParameter> ProdBonusParameters = _cache["Get", status] as ObjectsTemplate<ProdBonusParameter>;
if (ProdBonusParameters != null)
return ProdBonusParameters;
#endregion
try
{
// ProdBonusParameters = Service.Get(status);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(ProdBonusParameters, "Get", status);
#endregion
return ProdBonusParameters;
}
public ID Save()
{
this.SetAuditTrailProperties();
return ProdBonusParameter.Service.Save(this);
}
public void Delete(ID id)
{
ProdBonusParameter.Service.Delete(id);
}
#endregion
}
#endregion
#region IProdBonusParameter Service
public interface IProdBonusParameterService
{
ProdBonusParameter Get(ID id);
ObjectsTemplate<ProdBonusParameter> Get();
ObjectsTemplate<ProdBonusParameter> Get(int nSetupID);
ID Save(ProdBonusParameter item);
void Delete(ID id);
}
#endregion
}