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

301 lines
8.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;
namespace Payroll.BO
{
#region FSTranDetail
[Serializable]
public class FSTranDetail : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(FSTranDetail));
#endregion
#region Declarations
private double _amount;
private EnumValueType _amountType;
private double _changedValue;
private string _description;
private EnumFSTranType _fsTranType;
private EnumFSItemCode _itemCode;
private int _itemID;
private string _remarks;
private EnumSide _side;
private ID _tranID;
private bool _isTaxable;
#endregion
#region Constructor
public FSTranDetail()
{
_amount = 0.0;
_amountType = EnumValueType.Amount;
_changedValue = 0.0;
_description = "";
_fsTranType = EnumFSTranType.Fraction;
_itemCode = EnumFSItemCode.Gross;
_isTaxable = false;
_remarks = "";
_itemID = 0;
_side = EnumSide.Add;
_tranID = null;
}
#endregion
#region Properties
#region Amount : double
public double Amount
{
get { return _amount; }
set { _amount = value; }
}
#endregion
#region AmountType : EnumValueType
public EnumValueType AmountType
{
get { return _amountType; }
set
{
base.OnPropertyChange<short>("amountType", (short)_amountType, (short)value);
_amountType = value;
}
}
#endregion
#region FsTranType : EnumFSTranType
public EnumFSTranType FsTranType
{
get { return _fsTranType; }
set
{
base.OnPropertyChange<short>("fsTranType", (short)_fsTranType, (short)value);
_fsTranType = value;
}
}
#endregion
#region ItemCode : EnumFSItemCode
public EnumFSItemCode ItemCode
{
get { return _itemCode; }
set
{
base.OnPropertyChange<short>("itemCode", (short)_itemCode, (short)value);
_itemCode = value;
}
}
#endregion
#region Side : EnumSide
public EnumSide Side
{
get { return _side; }
set
{
base.OnPropertyChange<short>("side", (short)_side, (short)value);
_side = value;
}
}
#endregion
#region TranID
public ID TranID
{
get
{
return _tranID;
}
set
{
base.OnPropertyChange<ID>("tranID", _tranID, value);
_tranID = value;
}
}
#endregion
#region Remarks : string
public string Remarks
{
get { return _remarks; }
set { _remarks = value; }
}
#endregion
#region Description : string
public string Description
{
get { return _description; }
set { _description = value; }
}
#endregion
#region ChangedValue : double
public double ChangedValue
{
get { return _changedValue; }
set { _changedValue = value; }
}
#endregion
#region ItemID : int
public int ItemID
{
get { return _itemID; }
set { _itemID = value; }
}
#endregion
#region _isTaxable : bool
public bool IsTaxable
{
get { return _isTaxable; }
set { _isTaxable = value; }
}
#endregion
#region Property IncomeTaxItemType : enumIncomeTaxItemType
private enumIncomeTaxItemType _incomeTaxItemType;
public enumIncomeTaxItemType IncomeTaxItemType
{
get { return _incomeTaxItemType; }
set
{
base.OnPropertyChange<short>("IncomeTaxItemType", (short)_incomeTaxItemType, (short)value);
_incomeTaxItemType = value;
}
}
#endregion Property IncomeTaxItemType : enumIncomeTaxItemType
#region Service Factory IFSTranDetailService : IFSTranDetailService
internal static IFSTranDetailService Service
{
get { return Services.Factory.CreateService<IFSTranDetailService>(typeof(IFSTranDetailService)); }
}
#endregion
#endregion
#region Functions
public static FSTranDetail Get(ID nID)
{
FSTranDetail oFSTranDetail = null;
#region Cache Header
oFSTranDetail = (FSTranDetail)_cache["Get", nID];
if (oFSTranDetail != null)
return oFSTranDetail;
#endregion
oFSTranDetail = FSTranDetail.Service.Get(nID);
#region Cache Footer
_cache.Add(oFSTranDetail, "Get", nID);
#endregion
return oFSTranDetail;
}
public static ObjectsTemplate<FSTranDetail> Get()
{
#region Cache Header
ObjectsTemplate<FSTranDetail> FSTranDetails = _cache["Get"] as ObjectsTemplate<FSTranDetail>;
if (FSTranDetails != null)
return FSTranDetails;
#endregion
try
{
FSTranDetails = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(FSTranDetails, "Get");
#endregion
return FSTranDetails;
}
public static ObjectsTemplate<FSTranDetail> GetDetail(ID nTranID)
{
#region Cache Header
ObjectsTemplate<FSTranDetail> FSTranDetails = _cache["GetDetail", nTranID] as ObjectsTemplate<FSTranDetail>;
if (FSTranDetails != null)
return FSTranDetails;
#endregion
try
{
FSTranDetails = Service.GetDetail(nTranID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(FSTranDetails, "GetDetail", nTranID);
#endregion
return FSTranDetails;
}
public static ObjectsTemplate<FSTranDetail> GetDetailByEmp(int nEmpID)
{
#region Cache Header
ObjectsTemplate<FSTranDetail> FSTranDetails = _cache["GetDetailByEmp", nEmpID] as ObjectsTemplate<FSTranDetail>;
if (FSTranDetails != null)
return FSTranDetails;
#endregion
try
{
FSTranDetails = Service.GetDetailByEmp(nEmpID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(FSTranDetails, "GetDetailByEmp", nEmpID);
#endregion
return FSTranDetails;
}
public ID Save()
{
this.SetAuditTrailProperties();
return FSTranDetail.Service.Save(this);
}
public void Delete(ID id)
{
FSTranDetail.Service.Delete(id);
}
#endregion
}
#endregion
#region IFSTranDetail Service
public interface IFSTranDetailService
{
FSTranDetail Get(ID id);
ObjectsTemplate<FSTranDetail> GetDetail(ID nTranID);
ObjectsTemplate<FSTranDetail> GetDetailByEmp(int nEmpID);
ObjectsTemplate<FSTranDetail> Get();
ID Save(FSTranDetail item);
void Delete(ID id);
}
#endregion
}