예제 #1
0
        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;
            }
        }
예제 #2
0
 internal RanksBLL MapRank(Ranks Rank)
 {
     try
     {
         RanksBLL RankBLL = null;
         if (Rank != null)
         {
             RankBLL = new RanksBLL()
             {
                 RankID             = Rank.RankID,
                 RankName           = Rank.RankName,
                 TransfareAllowance = Rank.TransfareAllowance.HasValue ? Rank.TransfareAllowance.Value : 0,
                 InternalDelegation = Rank.InternalDelegation.HasValue ? Rank.InternalDelegation.Value : 0,
                 ExternalDelegation = Rank.ExternalDelegation.HasValue ? Rank.ExternalDelegation.Value : 0,
                 RankCategory       = Rank.RanksCategories != null ? new RanksCategoriesBLL().MapRanksCategories(Rank.RanksCategories) : new RanksCategoriesBLL().GetByRankCategoryID(Rank.RankCategoryID),
                 NextRank           = Rank.NextRankID.HasValue ? new RanksBLL()
                 {
                     RankID = Rank.NextRankID.Value
                 } : null,
                 IsActiveForPromotion = Rank.IsActiveForPromotion.HasValue ? Rank.IsActiveForPromotion.Value : false
             };
         }
         return(RankBLL);
     }
     catch
     {
         throw;
     }
 }
예제 #3
0
        public EmployeesCareersHistoryBLL GetEmployeePreviousJob(int EmployeeCodeID)
        {
            EmployeesCareersHistoryBLL CurrentJob = this.GetEmployeeCurrentJob(EmployeeCodeID);
            RanksBLL PreviousRank = new RanksBLL().GetPreviousRankByRankID(CurrentJob.OrganizationJob.Rank.RankID);

            EmployeesCareersHistory    EmployeeCareerHistory    = new EmployeesCareersHistoryDAL().GetByEmployeeCodeIDRankID(EmployeeCodeID, PreviousRank.RankID);
            EmployeesCareersHistoryBLL EmployeeCareerHistoryBLL = new EmployeesCareersHistoryBLL();

            if (EmployeeCareerHistory != null)
            {
                EmployeeCareerHistoryBLL = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(EmployeeCareerHistory);
            }

            return(EmployeeCareerHistoryBLL);
        }
예제 #4
0
        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;
            }
        }