CEL_Payroll/Payroll.BO/Salary/SalaryEmpCostCenter.cs

165 lines
4.4 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 SalaryEmpCostCenter
[Serializable]
public class SalaryEmpCostCenter :AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(SalaryEmpCostCenter));
#endregion
#region Constructor
public SalaryEmpCostCenter()
{
_salaryMontlyID = null;
_costCenterID = null;
_percentage = 0.0;
_employeeID = null;
}
#endregion
#region Properties
#region salaryMontlyID : ID
private ID _salaryMontlyID;
public ID SalaryMontlyID
{
get { return _salaryMontlyID; }
set
{
base.OnPropertyChange<ID>("salaryMontlyID", _salaryMontlyID, value);
_salaryMontlyID = value;
}
}
#endregion
#region costCenterID : ID
private ID _costCenterID;
public ID CostCenterID
{
get { return _costCenterID; }
set
{
base.OnPropertyChange<ID>("costCenterID", _costCenterID, value);
_costCenterID = value;
}
}
#endregion
#region percentage : double
private double _percentage;
public double Percentage
{
get { return _percentage; }
set
{
base.OnPropertyChange<double>("percentage", _percentage, value);
_percentage = value;
}
}
#endregion
#region employeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set
{
base.OnPropertyChange<ID>("employeeID", _employeeID, value);
_employeeID = value;
}
}
#endregion
#region Service Factory ISalaryMonthlyService : ISalaryMonthlyService
internal static ISalaryMonthlyService Service
{
get { return Services.Factory.CreateService<ISalaryMonthlyService>(typeof(ISalaryMonthlyService)); }
}
#endregion
#endregion
#region Functions
//public static ObjectsTemplate<SalaryEmpCostCenter> GetEmpCostCenter(ID nID)
//{
// ObjectsTemplate<SalaryEmpCostCenter> oSalaryEmpCostCenter = null;
// #region Cache Header
// oSalaryEmpCostCenter = (ObjectsTemplate<SalaryEmpCostCenter>)_cache["GetEmpCostCenter", nID];
// if (oSalaryEmpCostCenter != null)
// return oSalaryEmpCostCenter;
// #endregion
// oSalaryEmpCostCenter = SalaryMonthly.Service.GetEmpCostCenter(nID);
// #region Cache Footer
// _cache.Add(oSalaryEmpCostCenter, "GetEmpCostCenter", nID);
// #endregion
// return oSalaryEmpCostCenter;
//}
public static double InvolvedPercent(ObjectsTemplate<SalaryEmpCostCenter> salaryEmpCostCenters, ID nCostCenterID)
{
foreach (SalaryEmpCostCenter item in salaryEmpCostCenters)
{
if (item.CostCenterID == nCostCenterID)
{
return item.Percentage;
}
}
return 0;
}
public static double InvolvedPercent(ObjectsTemplate<SalaryEmpCostCenter> salaryEmpCostCenters, ID nCostCenterID, ID employeeID)
{
foreach (SalaryEmpCostCenter item in salaryEmpCostCenters)
{
if (item.CostCenterID == nCostCenterID && item.EmployeeID == employeeID)
{
return item.Percentage;
}
}
return 0;
}
//public static int GetEmpID(ObjectsTemplate<SalaryEmpCostCenter> salaryEmpCostCenters, ID nCostCenterID)
//{
// foreach (SalaryEmpCostCenter item in salaryEmpCostCenters)
// {
// if (item.CostCenterID == nCostCenterID)
// {
// return item.EmployeeID.Integer;
// }
// }
// return 0;
//}
#endregion
}
#endregion
}