示例#1
0
        /// <summary>
        /// Saves the level grade edit information.
        /// </summary>
        /// <param name="levelGradeInfo">The level grade information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">levelGradeInfo</exception>
        public string SaveLevelGradeEditInfo(IPayScale levelGradeInfo)
        {
            if (levelGradeInfo == null)
            {
                throw new ArgumentNullException(nameof(levelGradeInfo));
            }

            var result = string.Empty;

            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var levelGradeModel = dbContext.PayScales.SingleOrDefault(p => p.PayScaleId.Equals(levelGradeInfo.PayScaleId));

                    levelGradeModel.LevelId      = levelGradeInfo.LevelId;
                    levelGradeModel.GradeId      = levelGradeInfo.GradeId;
                    levelGradeModel.DateModified = DateTime.UtcNow;;
                    levelGradeModel.BasePay      = levelGradeInfo.BasePay;

                    dbContext.SaveChanges();
                }
            }
            catch (Exception e)
            {
                result = string.Format("Save Level Grade Edit Info - {0} , {1}", e.Message,
                                       e.InnerException != null ? e.InnerException.Message : "");
            }
            return(result);
        }
示例#2
0
        /// <summary>
        /// Creates the pay slip view.
        /// </summary>
        /// <param name="payroll">The payroll.</param>
        /// <param name="employee">The employee.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">payroll</exception>
        public IPaySlipViewModel CreatePaySlipView(IPayroll payroll, IPayScale payScale, decimal taxRate, IList <IPayScaleBenefit> payScaleBenefits,
                                                   ICompanyDetail companyDetail, IDigitalFile companyLogo, IEmployee employee, ILevel level, IGrade grade, IList <IPayrollEmployeeReward> rewardCollection,
                                                   IList <IPayrollEmployeeDeduction> employeeDeductionCollection, IList <IPayrollEmployeeLoan> loanCollection, decimal pensionContribution, decimal spouseConsolidation,
                                                   decimal childrenConsolidation, decimal consolidationTaxRelief, decimal taxableIncome)
        {
            if (payroll == null)
            {
                throw new ArgumentNullException(nameof(payroll));
            }

            var viewModel = new PaySlipViewModel
            {
                CompanyDetail       = companyDetail,
                Payroll             = payroll,
                Employee            = employee,
                Loan                = loanCollection,
                Reward              = rewardCollection,
                EmployeeDeduction   = employeeDeductionCollection,
                Level               = level,
                Grade               = grade,
                PayScale            = payScale,
                PayScaleCollection  = payScaleBenefits,
                CompanyLogo         = companyLogo,
                TaxRate             = taxRate,
                PensionContribution = pensionContribution,
                Dependant           = spouseConsolidation,
                Children            = childrenConsolidation,
                TaxCollation        = consolidationTaxRelief,
                TaxationAmount      = taxableIncome,
            };

            return(viewModel);
        }
示例#3
0
        /// <summary>
        /// Saves the level grade information.
        /// </summary>
        /// <param name="levelGradeInfo">The level grade information.</param>
        /// <param name="payScaleId">The pay scale identifier.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">levelGradeInfo</exception>
        public string SaveLevelGradeInfo(IPayScale levelGradeInfo, out int payScaleId)
        {
            if (levelGradeInfo == null)
            {
                throw new ArgumentNullException(nameof(levelGradeInfo));
            }

            var result = string.Empty;

            var newRecord = new PayScale
            {
                PayScaleId  = levelGradeInfo.PayScaleId,
                LevelId     = levelGradeInfo.LevelId,
                GradeId     = levelGradeInfo.GradeId,
                CompanyId   = levelGradeInfo.CompanyId,
                BasePay     = levelGradeInfo.BasePay,
                DateCreated = DateTime.UtcNow,
                IsActive    = true,
            };

            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    dbContext.PayScales.Add(newRecord);
                    dbContext.SaveChanges();
                }
            }
            catch (Exception e)
            {
                result = string.Format("Save Level Grade Info - {0} , {1}", e.Message,
                                       e.InnerException != null ? e.InnerException.Message : "");
            }

            payScaleId = newRecord.PayScaleId;

            return(result);
        }