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("salaryMontlyID", _salaryMontlyID, value); _salaryMontlyID = value; } } #endregion #region costCenterID : ID private ID _costCenterID; public ID CostCenterID { get { return _costCenterID; } set { base.OnPropertyChange("costCenterID", _costCenterID, value); _costCenterID = value; } } #endregion #region percentage : double private double _percentage; public double Percentage { get { return _percentage; } set { base.OnPropertyChange("percentage", _percentage, value); _percentage = value; } } #endregion #region employeeID : ID private ID _employeeID; public ID EmployeeID { get { return _employeeID; } set { base.OnPropertyChange("employeeID", _employeeID, value); _employeeID = value; } } #endregion #region Service Factory ISalaryMonthlyService : ISalaryMonthlyService internal static ISalaryMonthlyService Service { get { return Services.Factory.CreateService(typeof(ISalaryMonthlyService)); } } #endregion #endregion #region Functions //public static ObjectsTemplate GetEmpCostCenter(ID nID) //{ // ObjectsTemplate oSalaryEmpCostCenter = null; // #region Cache Header // oSalaryEmpCostCenter = (ObjectsTemplate)_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 salaryEmpCostCenters, ID nCostCenterID) { foreach (SalaryEmpCostCenter item in salaryEmpCostCenters) { if (item.CostCenterID == nCostCenterID) { return item.Percentage; } } return 0; } public static double InvolvedPercent(ObjectsTemplate 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 salaryEmpCostCenters, ID nCostCenterID) //{ // foreach (SalaryEmpCostCenter item in salaryEmpCostCenters) // { // if (item.CostCenterID == nCostCenterID) // { // return item.EmployeeID.Integer; // } // } // return 0; //} #endregion } #endregion }