internal static double GetEndOfServiceCompensation(DateTime?HiringDate, double TotalSalary, EndOfServicesCasesEnum Reason) { double Compensation = 0.0; double YearsCount = CompensationCalculationsForMICEmployees.GetServicePeriodByUmAlquraYears(HiringDate.Value.Date); if (Reason == EndOfServicesCasesEnum.Death || Reason == EndOfServicesCasesEnum.Resignation || Reason == EndOfServicesCasesEnum.Retirement || Reason == EndOfServicesCasesEnum.Termination) { Compensation = CommonHelper.CalculateEndOfServiceCompensation(TotalSalary, YearsCount); } else { // later we will calcuate it Compensation = 0; } return(Math.Round(Compensation, 2)); }
internal static double GetEndOfServiceCompensation(EmployeesCareersHistoryBLL Employee, EmployeesCareersHistoryBLL HiringRecord, SalaryDetailsBLL Salary, EndOfServicesCasesEnum Reason) { double Compensation = 0.0; var RankCategory = Employee.EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankCategory.RankCategoryID; if (RankCategory == (int)RanksCategoriesEnum.Employee || RankCategory == (int)RanksCategoriesEnum.User) { if (Reason == EndOfServicesCasesEnum.Death || Reason == EndOfServicesCasesEnum.Resignation || Reason == EndOfServicesCasesEnum.Retirement || Reason == EndOfServicesCasesEnum.Termination) { return(Salary.Benefits.BasicSalary * 6); } else { return(Salary.Benefits.BasicSalary * 4); } } else if (RankCategory == (int)RanksCategoriesEnum.ContractualSaudis || RankCategory == (int)RanksCategoriesEnum.SaudiLabor || RankCategory == (int)RanksCategoriesEnum.ContractualExpats) { double YearsCount = CompensationCalculationsForMICEmployees.GetServicePeriodByUmAlquraYears(HiringRecord.JoinDate); if (Reason == EndOfServicesCasesEnum.Death || Reason == EndOfServicesCasesEnum.Resignation || Reason == EndOfServicesCasesEnum.Retirement || Reason == EndOfServicesCasesEnum.Termination) { Compensation = CommonHelper.CalculateEndOfServiceCompensation(Salary.TotalSalary, YearsCount); } else { // later we will calcuate it Compensation = 0; } } return(Math.Round(Compensation, 2)); }