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

243 lines
6.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 EmployeeTaxInvestment
[Serializable]
public class EmployeeTaxInvestment : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(EmployeeTaxInvestment));
#endregion
#region Constructor
public EmployeeTaxInvestment()
{
_employeeID = null;
_amount = 0;
_taxparameterId = null;
_typeID = null;
}
#endregion
#region Properties
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set
{
base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
_employeeID = 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 TaxparameterId : ID
private ID _taxparameterId;
public ID TaxparameterId
{
get { return _taxparameterId; }
set
{
base.OnPropertyChange<ID>("TaxparameterId", _taxparameterId, value);
_taxparameterId = value;
}
}
#endregion
#region TypeID : ID
private ID _typeID;
public ID TypeID
{
get { return _typeID; }
set
{
base.OnPropertyChange<ID>("TypeID", _typeID, value);
_typeID = value;
}
}
#endregion
#region Service Factory IEmployeeTaxInvestmentService : IEmployeeTaxInvestmentService
internal static IEmployeeTaxInvestmentService Service
{
get { return Services.Factory.CreateService<IEmployeeTaxInvestmentService>(typeof(IEmployeeTaxInvestmentService)); }
}
#endregion
#endregion
#region Functions
public static EmployeeTaxInvestment Get(ID nID)
{
EmployeeTaxInvestment oEmployeeTaxInvestment = null;
#region Cache Header
oEmployeeTaxInvestment = (EmployeeTaxInvestment)_cache["Get", nID];
if (oEmployeeTaxInvestment != null)
return oEmployeeTaxInvestment;
#endregion
oEmployeeTaxInvestment = EmployeeTaxInvestment.Service.Get(nID);
#region Cache Footer
_cache.Add(oEmployeeTaxInvestment, "Get", nID);
#endregion
return oEmployeeTaxInvestment;
}
public static ObjectsTemplate<EmployeeTaxInvestment> Get()
{
#region Cache Header
ObjectsTemplate<EmployeeTaxInvestment> employeeTaxInvestments = _cache["Get"] as ObjectsTemplate<EmployeeTaxInvestment>;
if (employeeTaxInvestments != null)
return employeeTaxInvestments;
#endregion
try
{
employeeTaxInvestments = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(employeeTaxInvestments, "Get");
#endregion
return employeeTaxInvestments;
}
public static ObjectsTemplate<EmployeeTaxInvestment> GetAllUsersInfo()
{
ObjectsTemplate<EmployeeTaxInvestment> employeeTaxInvestments = null;
try
{
employeeTaxInvestments = Service.GetAllUsersInfo(Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID.Integer);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
return employeeTaxInvestments;
}
public static ObjectsTemplate<EmployeeTaxInvestment> GetSingleEmpsInfo(ID id)
{
ObjectsTemplate<EmployeeTaxInvestment> employeeTaxInvestments = null;
try
{
employeeTaxInvestments = Service.GetSingleEmpsInfo(id);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
return employeeTaxInvestments;
}
public double GetAmount(ID TaxParamID, ID emloyeeID)
{
double InvestAmount = 0.0;
try
{
InvestAmount = Service.GetAmount(TaxParamID, emloyeeID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
return InvestAmount;
}
public ID Save()
{
this.SetAuditTrailProperties();
return EmployeeTaxInvestment.Service.Save(this);
}
public void Save(ObjectsTemplate<EmployeeTaxInvestment> empTaxInvests)
{
this.SetAuditTrailProperties();
EmployeeTaxInvestment.Service.Save(empTaxInvests);
}
public void Delete()
{
EmployeeTaxInvestment.Service.Delete(ID);
}
#endregion
}
#endregion
#region IEmployeeTaxInvestment Service
public interface IEmployeeTaxInvestmentService
{
EmployeeTaxInvestment Get(ID id);
ObjectsTemplate<EmployeeTaxInvestment> Get();
ObjectsTemplate<EmployeeTaxInvestment> GetAllUsersInfo(int taxParamID);
double GetAmount(ID TaxParamID, ID emloyeeID);
ID Save(EmployeeTaxInvestment item);
void Save(ObjectsTemplate<EmployeeTaxInvestment> empTaxInvests);
void Delete(ID id);
ObjectsTemplate<EmployeeTaxInvestment> GetSingleEmpsInfo(ID id);
}
#endregion
}