public List <SalaryDetailsBLL> GetSalaryDetails(string EmployeeCodeNo) { try { List <SalaryDetailsBLL> SalaryDetailsList = new List <SalaryDetailsBLL>(); List <EmployeesCareersHistory> EmployeesBLLs = string.IsNullOrEmpty(EmployeeCodeNo) ? new EmployeesCareersHistoryDAL().GetActiveEmployeesCareersHistory() : new EmployeesCareersHistoryDAL().GetActiveEmployeesCareersHistory(EmployeeCodeNo);//.Take(200).ToList();//.Where(x=> x.EmployeesCodes.EmployeeCodeNo == EmployeeCodeNo).ToList(); List <EmployeesAllowancesBLL> Allowances = string.IsNullOrEmpty(EmployeeCodeNo) ? new EmployeesAllowancesBLL().GetEmployeesAllowances() : new EmployeesAllowancesBLL().GetEmployeesAllowances(EmployeeCodeNo); List <GovernmentFundsBLL> GovernmentFunds = string.IsNullOrEmpty(EmployeeCodeNo) ? new GovernmentFundsBLL().GetGovernmentFunds() : new GovernmentFundsBLL().GetGovernmentFunds(EmployeeCodeNo); List <BasicSalariesBLL> BasicSalariesDefination = new BasicSalariesBLL().GetBasicSalaries(); List <RanksBLL> Ranks = new RanksBLL().GetRanks(); foreach (var item in EmployeesBLLs) { SalaryDetailsBLL SalaryDetail = new SalaryDetailsBLL(); EmployeesCareersHistoryBLL EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(item); EmployeeCareerHistory.EmployeeCode.EmployeeCurrentJob = EmployeeCareerHistory; SalaryDetail = this.GetSalaryDetailsByEmployeeCodeNo(EmployeeCareerHistory.EmployeeCode, Allowances, GovernmentFunds, BasicSalariesDefination, Ranks); SalaryDetail.Employee = EmployeeCareerHistory; SalaryDetailsList.Add(SalaryDetail); } return(SalaryDetailsList); } catch (Exception) { throw; } }
/// <summary> /// This function return BasicSalary of the next rank with higher BasicSalary /// </summary> /// <param name="RankID"></param> /// <param name="CareerDegreeID"></param> /// <returns></returns> public BasicSalariesBLL GetGreaterBasicSalaryOfNextRank(int RankID, int CareerDegreeID) { int NextRankID = RankID + 1; BasicSalariesBLL BasicSalariesBLL = GetBasicSalary(RankID, CareerDegreeID); BasicSalariesBLL NextBasicSalariesBLL = GetBasicSalaries().Where(c => c.Rank.RankID == NextRankID && c.BasicSalary > BasicSalariesBLL.BasicSalary).OrderBy(c => c.BasicSalary).FirstOrDefault(); return(NextBasicSalariesBLL); }
public Result IncreaseCareerDegree(EmployeesCareersHistoryBLL EmpCareerHistory) { try { Result result = new Result(); int newCareerDegree = EmpCareerHistory.CareerDegree.CareerDegreeID + 1; #region Check newCareerDegree Exist In CareerDegree table. if (!new CareersDegreesBLL().GetCareersDegrees().Exists(c => c.CareerDegreeID == newCareerDegree)) { result.Entity = EmpCareerHistory; result.EnumType = typeof(CareersHistoryValidationEnum); result.EnumMember = CareersHistoryValidationEnum.RejectedBecauseOfCareerDegreeOutOfRange.ToString(); return(result); } #endregion // checking if new career degree & rank has 'basic salary' exists or not, if not exists skip if (EmpCareerHistory.OrganizationJob != null && EmpCareerHistory.OrganizationJob.Rank != null) { BasicSalariesBLL BasicSalary = new BasicSalariesBLL().GetBasicSalary(EmpCareerHistory.OrganizationJob.Rank.RankID, newCareerDegree); if (BasicSalary.BasicSalary <= 0) { result.Entity = EmpCareerHistory; result.EnumType = typeof(CareersHistoryValidationEnum); result.EnumMember = CareersHistoryValidationEnum.RejectedBecauseOfCareerDegreeOutOfRange.ToString(); return(result); } } #region Update record EmployeesCareersHistory EmployeeCareerHistory = new EmployeesCareersHistory() { EmployeeCareerHistoryID = EmpCareerHistory.EmployeeCareerHistoryID, CareerDegreeID = newCareerDegree, LastUpdatedBy = EmpCareerHistory.LoginIdentity != null ? EmpCareerHistory.LoginIdentity.EmployeeCodeID : (int?)null, LastUpdatedDate = DateTime.Now, }; new EmployeesCareersHistoryDAL().UpdateCareerDegree(EmployeeCareerHistory); #endregion result.Entity = EmpCareerHistory; result.EnumType = typeof(CareersHistoryValidationEnum); result.EnumMember = CareersHistoryValidationEnum.Done.ToString(); return(result); } catch { throw; } }
public Result IncreaseCareerDegree() { try { int newCareerDegree; Result result = new Result(); List <EmployeesCareersHistory> Employees = new EmployeesCareersHistoryDAL().GetActiveEmployeesCareersHistory(); List <EmployeesCareersHistory> EmployeesToUpdate = new List <EmployeesCareersHistory>(); foreach (var EmpCareerHistory in Employees) { newCareerDegree = EmpCareerHistory.CareerDegreeID + 1; // checking if new career degree exists or not, if not exists skip if (!new CareersDegreesBLL().GetCareersDegrees().Exists(c => c.CareerDegreeID == newCareerDegree)) { continue; } // checking if new career degree & rank has 'basic salary' exists or not, if not exists skip BasicSalariesBLL BasicSalary = new BasicSalariesBLL().GetBasicSalary(EmpCareerHistory.OrganizationsJobs.RankID, newCareerDegree); if (BasicSalary.BasicSalary <= 0) { continue; } // Update record EmpCareerHistory.CareerDegreeID = newCareerDegree; EmpCareerHistory.LastUpdatedBy = this.LoginIdentity != null ? this.LoginIdentity.EmployeeCodeID : (int?)null; EmpCareerHistory.LastUpdatedDate = DateTime.Now; EmployeesToUpdate.Add(EmpCareerHistory); } new EmployeesCareersHistoryDAL().UpdateCareerDegree(EmployeesToUpdate); //#endregion result.Entity = this; result.EnumType = typeof(CareersHistoryValidationEnum); result.EnumMember = CareersHistoryValidationEnum.Done.ToString(); return(result); } catch { throw; } }
///// <summary> ///// Dated : 24-08-2020 : getting ContractualSaudi TransfareAllowance from ContractorBasicSalary Table ///// </summary> ///// <param name="EmployeeCode"></param> ///// <returns></returns> //private SalaryDetailsBLL GetSalaryDetailsBenefitsByEmployeeCodeNo(EmployeesCodesBLL EmployeeCode) //{ // try // { // double FirstDegreeBasicSalary = 0, CurrentDegreeBasicSalary = 0; // double BasicSalary = 0, TransfareAllowance = 0, TotalAllowances = 0; // SalaryDetailsBLL SalaryDetails = new SalaryDetailsBLL(); // //EmployeesCodesBLL EmployeeCode = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo); // if (EmployeeCode != null) // { // EmployeesCareersHistoryBLL Employee = EmployeeCode.EmployeeCurrentJob; // if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.Employee) // BasicSalary = new BasicSalariesBLL().GetBasicSalary(Employee.OrganizationJob.Rank.RankID, Employee.CareerDegree.CareerDegreeID).BasicSalary; // else if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.User) // BasicSalary = new BasicSalariesBLL().GetBasicSalary(Employee.OrganizationJob.Rank.RankID, Employee.CareerDegree.CareerDegreeID).BasicSalary; // else if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.SaudiLabor) // BasicSalary = new BasicSalariesBLL().GetBasicSalary(Employee.OrganizationJob.Rank.RankID, Employee.CareerDegree.CareerDegreeID).BasicSalary; // else if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualSaudis) // BasicSalary = new ContractorsBasicSalariesBLL().GetByEmployeeCodeID(EmployeeCode.EmployeeCodeID).BasicSalary; // else if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualExpats) // BasicSalary = new ContractorsBasicSalariesBLL().GetByEmployeeCodeID(EmployeeCode.EmployeeCodeID).BasicSalary; // else // BasicSalary = 0; // // Dated : 24-08-2020 : getting ContractualSaudi TransfareAllowance from ContractorBasicSalary Table // if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualSaudis) // TransfareAllowance = new ContractorsBasicSalariesBLL().GetByEmployeeCodeID(EmployeeCode.EmployeeCodeID).TransfareAllowance; // else // TransfareAllowance = new RanksBLL().GetByRankID(Employee.OrganizationJob.Rank.RankID).TransfareAllowance; // SalaryDetails.Benefits = new SalaryBenefits() // { // BasicSalary = BasicSalary, // TransfareAllowance = TransfareAllowance, // EmployeesAllowances = new EmployeesCodesBLL().GetActiveAllownacessByEmployeeCodeID(EmployeeCode.EmployeeCodeID), // }; // // some allowances should be calcualted based on current basic salary of employee, and some should be calculated based on basic salary of first degree of employee current rank // FirstDegreeBasicSalary = new BasicSalariesBLL().GetBasicSalary(EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankID, 1).BasicSalary; // CurrentDegreeBasicSalary = SalaryDetails.Benefits.BasicSalary; // foreach (var item in SalaryDetails.Benefits.EmployeesAllowances) // { // if (item.Allowance.AllowanceAmountType.AllowanceAmountTypeID == Convert.ToInt16(AllowancesAmountTypesEnum.Fixed)) // SalaryDetails.Benefits.TotalAllowances = TotalAllowances + item.Allowance.AllowanceAmount; // else if (item.Allowance.AllowanceAmountType.AllowanceAmountTypeID == Convert.ToInt16(AllowancesAmountTypesEnum.Percentage)) // { // if (item.Allowance.AllowanceCalculationType.AllowanceCalculationTypeID == Convert.ToInt16(AllowancesCalculationTypesEnum.BasedOnBasicSalaryOfFirstDegree)) // TotalAllowances = TotalAllowances + ((item.Allowance.AllowanceAmount / 100) * FirstDegreeBasicSalary); // else // TotalAllowances = TotalAllowances + ((item.Allowance.AllowanceAmount / 100) * CurrentDegreeBasicSalary); // } // } // SalaryDetails.Benefits.TotalAllowances = TotalAllowances; // } // return SalaryDetails; // } // catch // { // throw; // } //} //private SalaryDetailsBLL GetSalaryDetailsDeductionsByEmployeeCodeNo(EmployeesCodesBLL EmployeeCode, double BasicSalary) //{ // try // { // SalaryDetailsBLL SalaryDetails = new SalaryDetailsBLL(); // //EmployeesCodesBLL EmployeeCode = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo); // SalaryDetails.Deductions = new SalaryDeductions() // { // //RetirmentDeduction = Math.Round(new BasicSalariesBLL().GetBasicSalary(EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankID, EmployeeCode.EmployeeCurrentJob.CareerDegree.CareerDegreeID).BasicSalary * .09, 2) // RetirmentDeduction = Math.Round(BasicSalary * EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankCategory.RetirementPercentage / 100, 2), // //TakafulDeductions = new TakafulDeductionsBLL().GetActiveTakafulDeductions(EmployeeCode.Employee.EmployeeID), // TakafulDeductions = new List<Deduction>(), // GovernmentFundsDeductions = new GovernmentFundsBLL().GetActiveGovernmentFundsByEmployeeCodeID(EmployeeCode.EmployeeCodeID), // }; // SalaryDetails.Deductions.TotalDeductions = SalaryDetails.Deductions.RetirmentDeduction + // double.Parse(SalaryDetails.Deductions.TakafulDeductions.Sum(x => x.DeductionAmount).ToString()) + // SalaryDetails.Deductions.GovernmentFundsDeductions.Sum(x => x.MonthlyDeductionAmount); // return SalaryDetails; // } // catch // { // throw; // } //} ///// <summary> ///// This is to calculate employee net salary, formula of net salary : ///// (BasicSalary + TransfareAllowance + TotalAllowances) - (RetirmentDeduction + TakafulDeduction + GovernmentFundsDeductions) ///// </summary> ///// <param name="EmployeeCodeNo"></param> ///// <returns></returns> //public SalaryDetailsBLL GetSalaryDetailsByEmployeeCodeNo(string EmployeeCodeNo) //{ // try // { // EmployeesCodesBLL EmployeeCode = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo); // SalaryDetailsBLL SalaryDetails = new SalaryDetailsBLL(); // SalaryDetails.Benefits = SalaryDetails.GetSalaryDetailsBenefitsByEmployeeCodeNo(EmployeeCode).Benefits; // SalaryDetails.Deductions = SalaryDetails.GetSalaryDetailsDeductionsByEmployeeCodeNo(EmployeeCode, SalaryDetails.Benefits.BasicSalary).Deductions; // //#region Total Allowances // ////only Active allowances // //double TotalAllowances = 0; // //double FirstDegreeBasicSalary = 0; // //double CurrentDegreeBasicSalary = 0; // //foreach (var item in SalaryDetails.Benefits.EmployeesAllowances) // //{ // // if (item.Allowance.AllowanceAmountType.AllowanceAmountTypeID == Convert.ToInt16(AllowancesAmountTypesEnum.Fixed)) // // TotalAllowances = TotalAllowances + item.Allowance.AllowanceAmount; // // else if (item.Allowance.AllowanceAmountType.AllowanceAmountTypeID == Convert.ToInt16(AllowancesAmountTypesEnum.Percentage)) // // { // // if(item.Allowance.AllowanceCalculationType.AllowanceCalculationTypeID == Convert.ToInt16(AllowancesCalculationTypesEnum.BasedOnBasicSalaryOfFirstDegree)) // // TotalAllowances = TotalAllowances + ((item.Allowance.AllowanceAmount / 100) * FirstDegreeBasicSalary); // // else // // TotalAllowances = TotalAllowances + ((item.Allowance.AllowanceAmount / 100) * CurrentDegreeBasicSalary); // // } // //} // //#endregion // #region Net salary // SalaryDetails.NetSalary = Math.Round((SalaryDetails.Benefits.BasicSalary + // SalaryDetails.Benefits.TransfareAllowance + // SalaryDetails.Benefits.TotalAllowances) - // (SalaryDetails.Deductions.TotalDeductions), 2); // #endregion // return SalaryDetails; // } // catch // { // throw; // } //} /// <summary> /// Dated : 24-08-2020 : getting ContractualSaudi TransfareAllowance from ContractorBasicSalary Table /// </summary> /// <param name="EmployeeCode"></param> /// <returns></returns> private SalaryDetailsBLL GetSalaryDetailsBenefitsByEmployeeCodeNo(EmployeesCodesBLL EmployeeCode, List <EmployeesAllowancesBLL> Allowances, List <BasicSalariesBLL> BasicSalaries, List <RanksBLL> Ranks) { try { double FirstDegreeBasicSalary = 0, CurrentDegreeBasicSalary = 0; double BasicSalary = 0, TransfareAllowance = 0, TotalAllowances = 0; SalaryDetailsBLL SalaryDetails = new SalaryDetailsBLL(); if (EmployeeCode != null) { EmployeesCareersHistoryBLL Employee = EmployeeCode.EmployeeCurrentJob; if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.Employee) { BasicSalary = new BasicSalariesBLL().GetBasicSalary(Employee.OrganizationJob.Rank.RankID, Employee.CareerDegree.CareerDegreeID).BasicSalary; } else if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.User) { BasicSalary = new BasicSalariesBLL().GetBasicSalary(Employee.OrganizationJob.Rank.RankID, Employee.CareerDegree.CareerDegreeID).BasicSalary; } else if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.SaudiLabor) { BasicSalary = new BasicSalariesBLL().GetBasicSalary(Employee.OrganizationJob.Rank.RankID, Employee.CareerDegree.CareerDegreeID).BasicSalary; } else if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualSaudis) { BasicSalary = new ContractorsBasicSalariesBLL().GetByEmployeeCodeID(EmployeeCode.EmployeeCodeID).BasicSalary; } else if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualExpats) { BasicSalary = new ContractorsBasicSalariesBLL().GetByEmployeeCodeID(EmployeeCode.EmployeeCodeID).BasicSalary; } else { BasicSalary = 0; } // Dated : 24-08-2020 : getting ContractualSaudi TransfareAllowance from ContractorBasicSalary Table if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.ContractualSaudis) { TransfareAllowance = new ContractorsBasicSalariesBLL().GetByEmployeeCodeID(EmployeeCode.EmployeeCodeID).TransfareAllowance; } else { TransfareAllowance = Ranks.FirstOrDefault(x => x.RankID == Employee.OrganizationJob.Rank.RankID).TransfareAllowance; } SalaryDetails.Benefits = new SalaryBenefits() { BasicSalary = BasicSalary, TransfareAllowance = TransfareAllowance, EmployeesAllowances = Allowances.Where(x => x.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID == EmployeeCode.EmployeeCodeID).ToList(), }; // some allowances should be calcualted based on current basic salary of employee, and some should be calculated based on basic salary of first degree of employee current rank if (Employee.OrganizationJob.Rank.RankCategory.RankCategoryID != (int)RanksCategoriesEnum.ContractualExpats && Employee.OrganizationJob.Rank.RankCategory.RankCategoryID != (int)RanksCategoriesEnum.ContractualSaudis) { BasicSalariesBLL basicSalary = BasicSalaries.FirstOrDefault(x => x.Rank.RankID == EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankID && x.CareerDegree.CareerDegreeID == 1); FirstDegreeBasicSalary = basicSalary != null ? basicSalary.BasicSalary : 0; } CurrentDegreeBasicSalary = SalaryDetails.Benefits.BasicSalary; foreach (var item in SalaryDetails.Benefits.EmployeesAllowances) { if (item.Allowance.AllowanceAmountType.AllowanceAmountTypeID == Convert.ToInt16(AllowancesAmountTypesEnum.Fixed)) { TotalAllowances += item.Allowance.AllowanceAmount; } else if (item.Allowance.AllowanceAmountType.AllowanceAmountTypeID == Convert.ToInt16(AllowancesAmountTypesEnum.Percentage)) { if (item.Allowance.AllowanceCalculationType.AllowanceCalculationTypeID == Convert.ToInt16(AllowancesCalculationTypesEnum.BasedOnBasicSalaryOfFirstDegree)) { TotalAllowances += ((item.Allowance.AllowanceAmount / 100) * FirstDegreeBasicSalary); } else { TotalAllowances += ((item.Allowance.AllowanceAmount / 100) * CurrentDegreeBasicSalary); } } } SalaryDetails.Benefits.TotalAllowances = Math.Round(TotalAllowances, 2); //SalaryDetails.TotalSalary = SalaryDetails.Benefits.BasicSalary + SalaryDetails.Benefits.TotalAllowances + SalaryDetails.Benefits.TransfareAllowance; } return(SalaryDetails); } catch { throw; } }
public List <EmployeesBenefitsAfterEndOfServiceBLL> GetEmployeesBenefits(string EmployeeCodeNo) { try { List <EmployeesBenefitsAfterEndOfServiceBLL> EmployeesBenefitsBLLList = new List <EmployeesBenefitsAfterEndOfServiceBLL>(); List <SalaryDetailsBLL> SalaryDetailsList = new List <SalaryDetailsBLL>(); List <EmployeesCareersHistory> ActiveEmployeesList = string.IsNullOrEmpty(EmployeeCodeNo) ? new EmployeesCareersHistoryDAL().GetActiveEmployeesCareersHistory().ToList() : new EmployeesCareersHistoryDAL().GetActiveEmployeesCareersHistory(EmployeeCodeNo).ToList(); List <EmployeesCareersHistory> EmployeesHiringRecordsList = string.IsNullOrEmpty(EmployeeCodeNo) ? new EmployeesCareersHistoryDAL().GetHiringRecordsForEmployees().ToList() : new EmployeesCareersHistoryDAL().GetHiringRecordsForEmployees(EmployeeCodeNo).ToList(); List <EmployeesAllowancesBLL> AllowancesList = string.IsNullOrEmpty(EmployeeCodeNo) ? new EmployeesAllowancesBLL().GetEmployeesAllowances().ToList() : new EmployeesAllowancesBLL().GetEmployeesAllowances(EmployeeCodeNo); //List<EmployeesAllowancesBLL> AllowancesList = new List<EmployeesAllowancesBLL>(); List <GovernmentFundsBLL> GovernmentFundsList = string.IsNullOrEmpty(EmployeeCodeNo) ? new GovernmentFundsBLL().GetGovernmentFunds() : new GovernmentFundsBLL().GetGovernmentFunds(EmployeeCodeNo); List <BasicSalariesBLL> BasicSalariesDefination = new BasicSalariesBLL().GetBasicSalaries(); List <RanksBLL> Ranks = new RanksBLL().GetRanks(); List <EmployeesNormalVacationsBalances> EmployeesNormalVacationsBalancesList = new EmployeesNormalVacationsBalancesDAL().GetNormalVacationsBalances(); foreach (var item in ActiveEmployeesList) { EmployeesBenefitsAfterEndOfServiceBLL EmployeeBenefitsAfterEndOfServiceBLL = new EmployeesBenefitsAfterEndOfServiceBLL(); EmployeesCareersHistoryBLL EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(item); EmployeeCareerHistory.EmployeeCode.EmployeeCurrentJob = EmployeeCareerHistory; EmployeeBenefitsAfterEndOfServiceBLL.EmployeeCareerHistory = EmployeeCareerHistory; EmployeeBenefitsAfterEndOfServiceBLL.SalaryDetails = new SalaryDetailsBLL().GetSalaryDetailsByEmployeeCodeNo(EmployeeCareerHistory.EmployeeCode, AllowancesList, GovernmentFundsList, BasicSalariesDefination, Ranks); EmployeeBenefitsAfterEndOfServiceBLL.SalaryDetails.Employee = EmployeeCareerHistory; #region NormalVacationBalanceCompensation EmployeesNormalVacationsBalances ee = EmployeesNormalVacationsBalancesList.FirstOrDefault(x => x.EmployeeCodeID == EmployeeCareerHistory.EmployeeCode.EmployeeCodeID); if (ee is null) { ee = new EmployeesNormalVacationsBalances(); } EmployeeBenefitsAfterEndOfServiceBLL.TotalRemainingBalance = ee.TotalRemainingBalance; EmployeeBenefitsAfterEndOfServiceBLL.RemainingNormalVacationBalanceCompensation = Math.Round(CompensationCalculationsForMICEmployees.GetNormalVacationCompensation(EmployeeCareerHistory, EmployeeBenefitsAfterEndOfServiceBLL.SalaryDetails, ee.TotalRemainingBalance), 2); #endregion #region EndOfServiceCompensation EmployeeBenefitsAfterEndOfServiceBLL.EmployeeHiringRecord = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(EmployeesHiringRecordsList.FirstOrDefault(x => x.EmployeeCodeID == item.EmployeeCodeID)); EmployeeBenefitsAfterEndOfServiceBLL.ServicePeriod = CompensationCalculationsForMICEmployees.GetServicePeriodByUmAlquraYears(EmployeeBenefitsAfterEndOfServiceBLL.EmployeeHiringRecord != null ? EmployeeBenefitsAfterEndOfServiceBLL.EmployeeHiringRecord.JoinDate.Date : (DateTime?)null).ToString(); EmployeeBenefitsAfterEndOfServiceBLL.EndOfServiceCompensation = CompensationCalculationsForMICEmployees.GetEndOfServiceCompensation(EmployeeBenefitsAfterEndOfServiceBLL.EmployeeCareerHistory, EmployeeBenefitsAfterEndOfServiceBLL.EmployeeHiringRecord, EmployeeBenefitsAfterEndOfServiceBLL.SalaryDetails, Enums.EndOfServicesCasesEnum.Retirement); #endregion #region AdditionalCompensation EmployeeBenefitsAfterEndOfServiceBLL.RemainingYearsCountInService = CompensationCalculationsForMICEmployees.GetRemainingYearsInService(item.EmployeesCodes.Employees.EmployeeBirthDate != null ? item.EmployeesCodes.Employees.EmployeeBirthDate : (DateTime?)null); EmployeeBenefitsAfterEndOfServiceBLL.AdditionalCompensation = CompensationCalculationsForMICEmployees.GetAdditionalCompensation(EmployeeBenefitsAfterEndOfServiceBLL.EmployeeCareerHistory, EmployeeBenefitsAfterEndOfServiceBLL.SalaryDetails, EmployeeBenefitsAfterEndOfServiceBLL.RemainingYearsCountInService, double.Parse(EmployeeBenefitsAfterEndOfServiceBLL.ServicePeriod)); #endregion EmployeesBenefitsBLLList.Add(EmployeeBenefitsAfterEndOfServiceBLL); } return(EmployeesBenefitsBLLList); } catch (Exception ex) { throw ex; } }