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

287 lines
7.6 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;
using Ease.CoreV35.DataAccess;
namespace Payroll.BO
{
#region ESBProvision
[Serializable]
public class ESBProvision : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(ESBProvision));
#endregion
#region Constructor
public ESBProvision()
{
_employeeID = null;
_processMonthDate = DateTime.MinValue;
_salaryMonthlyID = null;
_provision = 0.0;
_provisionOne = 0.0;
_userID = null;
_provisionTwo = 0.0;
}
#endregion
#region Properties
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set
{
_employeeID = value;
}
}
#endregion
#region ProcessMonthDate : DateTime
private DateTime _processMonthDate;
public DateTime ProcessMonthDate
{
get { return _processMonthDate; }
set
{
_processMonthDate = value;
}
}
#endregion
#region SalaryMonthlyID : ID
private ID _salaryMonthlyID;
public ID SalaryMonthlyID
{
get { return _salaryMonthlyID; }
set
{
_salaryMonthlyID = value;
}
}
#endregion
#region UserID : ID
private ID _userID;
public ID UserID
{
get { return _userID; }
set
{
_userID = value;
}
}
#endregion
#region Provision : Double
private Double _provision;
public Double Provision
{
get { return _provision; }
set
{
_provision = value;
}
}
#endregion
#region ProvisionOne : Double
private Double _provisionOne;
public Double ProvisionOne
{
get { return _provisionOne; }
set
{
_provisionOne = value;
}
}
#endregion
#region ProvisionTwo : Double
private Double _provisionTwo;
public Double ProvisionTwo
{
get { return _provisionTwo; }
set
{
_provisionTwo = value;
}
}
#endregion
#region Service Factory IBranchService : IBranchService
internal static IESBProvisionService Service
{
get { return Services.Factory.CreateService<IESBProvisionService>(typeof(IESBProvisionService)); }
}
#endregion
#endregion
#region Functions
public static ESBProvision Get(ID nID)
{
ESBProvision oESBProvision = null;
#region Cache Header
oESBProvision = (ESBProvision)_cache["Get", nID];
if (oESBProvision != null)
return oESBProvision;
#endregion
oESBProvision = ESBProvision.Service.Get(nID);
#region Cache Footer
_cache.Add(oESBProvision, "Get", nID);
#endregion
return oESBProvision;
}
public static ObjectsTemplate<ESBProvision> GetProvision(DateTime dFromDate, DateTime dToDate)
{
#region Cache Header
ObjectsTemplate<ESBProvision> oESBProvision = _cache["GetProvision", dFromDate, dToDate] as ObjectsTemplate<ESBProvision>;
if (oESBProvision != null)
return oESBProvision;
#endregion
try
{
oESBProvision = Service.GetProvision(dFromDate, dToDate);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oESBProvision, "GetProvision", dFromDate, dToDate);
#endregion
return oESBProvision;
}
public static ObjectsTemplate<ESBProvision> GetProvision(int EmployeeID,DateTime dFromDate, DateTime dToDate)
{
#region Cache Header
ObjectsTemplate<ESBProvision> oESBProvision = _cache["GetProvision",EmployeeID, dFromDate, dToDate] as ObjectsTemplate<ESBProvision>;
if (oESBProvision != null)
return oESBProvision;
#endregion
try
{
oESBProvision = Service.GetProvision(EmployeeID,dFromDate, dToDate);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oESBProvision, "GetProvision",EmployeeID, dFromDate, dToDate);
#endregion
return oESBProvision;
}
public static double GetOpeningBalance(int nEmpID, DateTime dFromDate)
{
double nAmount = 0.0;
nAmount = ESBProvision.Service.GetOpeningBalance(nEmpID, dFromDate);
return nAmount;
}
public static DataSet GetCumulativeProv(DateTime dSMonthDate)
{
DataSet ds = null;
try
{
ds = Service.GetCumulativeProv(dSMonthDate);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public ID Save()
{
return ESBProvision.Service.Save(this);
}
public ID Save(TransactionContext tc)
{
return ESBProvision.Service.Save(tc,this);
}
public void Delete(ID nEmpID,ID nSalaryMonthlyID)
{
ESBProvision.Service.Delete(nEmpID,nSalaryMonthlyID);
}
public static ObjectsTemplate<ESBProvision> GetProvision(string sEmpID, DateTime GratuityMonth)
{
#region Cache Header
ObjectsTemplate<ESBProvision> oESBProvision = _cache["GetProvision", sEmpID, GratuityMonth] as ObjectsTemplate<ESBProvision>;
if (oESBProvision != null)
return oESBProvision;
#endregion
try
{
oESBProvision = Service.GetProvision(sEmpID, GratuityMonth);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oESBProvision, "GetProvision", sEmpID, GratuityMonth);
#endregion
return oESBProvision;
}
#endregion
}
#endregion
#region IBranch Service
public interface IESBProvisionService
{
ESBProvision Get(ID id);
ObjectsTemplate<ESBProvision> GetProvision(DateTime dFromDate, DateTime dToDate);
ObjectsTemplate<ESBProvision> GetProvision(int EmployeeID, DateTime dFromDate, DateTime dToDate);
DataSet GetCumulativeProv(DateTime dSMonthDate);
ObjectsTemplate<ESBProvision> GetProvision(string sEmpID, DateTime GratuityMonth);
double GetOpeningBalance(int nEmpID, DateTime dFromDate);
ID Save(ESBProvision item);
ID Save(TransactionContext tc, ESBProvision item);
void Delete(ID nEmpID, ID nSalaryMonthlyID);
}
#endregion
}