CEL_Payroll/Payroll.BO/Basic/PayScaleDetail.cs

312 lines
7.5 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;
namespace Payroll.BO
{
#region PayScaleDetail
[Serializable]
public class PayScaleDetail:AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(PayScaleDetail));
#endregion
#region Constructor
public PayScaleDetail()
{
_payscaleID = null;
_stepNo = 0;
_amount = 0;
_stepAmount = 0;
_stepIncrement = 0;
}
#endregion
#region Properties
#region payscaleID : ID
private ID _payscaleID;
public ID PayscaleID
{
get { return _payscaleID; }
set
{
base.OnPropertyChange<ID>("payscaleID", _payscaleID, value);
_payscaleID = value;
}
}
#endregion
#region StepNo : int
private int _stepNo;
public int StepNo
{
get { return _stepNo; }
set
{
base.OnPropertyChange<int>("StepNo", _stepNo, value);
_stepNo = value;
}
}
#endregion
#region Amount : double
private double _amount;
public double Amount
{
get { return _amount; }
set
{
base.OnPropertyChange<double>("Amount", _amount, value);
_amount = value;
}
}
#endregion
#region stepAmount : double
private double _stepAmount;
public double StepAmount
{
get { return _stepAmount; }
set
{
base.OnPropertyChange<double>("stepAmount", _stepAmount, value);
_stepAmount = value;
}
}
#endregion
#region stepIncrement : double
private double _stepIncrement;
public double StepIncrement
{
get { return _stepIncrement; }
set
{
base.OnPropertyChange<double>("stepIncrement", _stepIncrement, value);
_stepIncrement = value;
}
}
#endregion
#region GradeID : ID
private ID _gradeID;
public ID GradeID
{
get { return _gradeID; }
set
{
base.OnPropertyChange<ID>("gradeID", _gradeID, value);
_gradeID = value;
}
}
#endregion
#region GradeID : ID
private ID _AllowanceID;
public ID AllowanceID
{
get { return _AllowanceID; }
set
{
base.OnPropertyChange<ID>("allowanceID", _AllowanceID, value);
_AllowanceID = value;
}
}
#endregion
#region Service Factory IPayScaleDetailService : IPayScaleDetailService
internal static IPayScaleDetailService Service
{
get { return Services.Factory.CreateService<IPayScaleDetailService>(typeof(IPayScaleDetailService)); }
}
#endregion
#endregion
#region Functions
public static PayScaleDetail Get(ID nID)
{
PayScaleDetail oPayScaleDetail = null;
#region Cache Header
oPayScaleDetail = (PayScaleDetail)_cache["Get", nID];
if (oPayScaleDetail != null)
return oPayScaleDetail;
#endregion
oPayScaleDetail = PayScaleDetail.Service.Get(nID);
#region Cache Footer
_cache.Add(oPayScaleDetail, "Get", nID);
#endregion
return oPayScaleDetail;
}
public static ObjectsTemplate<PayScaleDetail> Get()
{
#region Cache Header
ObjectsTemplate<PayScaleDetail> payScaleDetails = _cache["Get"] as ObjectsTemplate<PayScaleDetail>;
if (payScaleDetails != null)
return payScaleDetails;
#endregion
try
{
payScaleDetails = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(payScaleDetails, "Get");
#endregion
return payScaleDetails;
}
public static ObjectsTemplate<PayScaleDetail> GetByPayScale(ID payscaleID)
{
#region Cache Header
ObjectsTemplate<PayScaleDetail> payScaleDetails = _cache["GetByPayScale", payscaleID] as ObjectsTemplate<PayScaleDetail>;
if (payScaleDetails != null)
return payScaleDetails;
#endregion
try
{
payScaleDetails = Service.GetByPayScale(payscaleID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(payScaleDetails, "GetByPayScale", payscaleID);
#endregion
return payScaleDetails;
}
public static ObjectsTemplate<PayScaleDetail> Get(ID nGradeID,ID nAllowID)
{
#region Cache Header
ObjectsTemplate<PayScaleDetail> payScaleDetails = _cache["Get", nGradeID, nAllowID] as ObjectsTemplate<PayScaleDetail>;
if (payScaleDetails != null)
return payScaleDetails;
#endregion
try
{
payScaleDetails = Service.Get(nGradeID, nAllowID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(payScaleDetails, "Get", nGradeID, nAllowID);
#endregion
return payScaleDetails;
}
public static ObjectsTemplate<PayScaleDetail> GetByGradeID(ID nGradeID)
{
#region Cache Header
ObjectsTemplate<PayScaleDetail> payScaleDetails = _cache["GetByGradeID", nGradeID] as ObjectsTemplate<PayScaleDetail>;
if (payScaleDetails != null)
return payScaleDetails;
#endregion
try
{
payScaleDetails = Service.GetByGradeID(nGradeID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(payScaleDetails, "GetByGradeID", nGradeID);
#endregion
return payScaleDetails;
}
public ID Save()
{
return PayScaleDetail.Service.Save(this);
}
public void Delete()
{
PayScaleDetail.Service.Delete(ID);
}
#endregion
}
#endregion
#region IPayScaleDetail Service
public interface IPayScaleDetailService
{
PayScaleDetail Get(ID id);
ObjectsTemplate<PayScaleDetail> Get();
ID Save(PayScaleDetail item);
void Delete(ID id);
ObjectsTemplate<PayScaleDetail> GetByGradeID(ID nGradeID, ID PayrollTypeID);
ObjectsTemplate<PayScaleDetail> Get(ID nGradeID, ID nAllowID);
ObjectsTemplate<PayScaleDetail> GetByPayScale(ID payscaleID);
}
#endregion
}