public PensionRequest CalculatePensionFormula(int userStaffId, SuccessFactor successFactorData) { PensionRequest pension = new PensionRequest(); pension.isEligible = true; pension.isEnrolled = true; if (this.IsWithdraw(userStaffId)) { pension.isEligible = false; return(pension); } pension.VestingPercent = GetVestingPercent(successFactorData.Band, successFactorData.Tenure); if (pension.VestingPercent == -1) { pension.isEligible = false; pension.isEnrolled = false; pension.NumberOfMonthsToEnroll = GetNumberOfMonthsToEnroll(successFactorData.Tenure); return(pension); } pension = FillPensionObject(userStaffId, successFactorData, pension); return(pension); }
public PensionRequest CreatePensionRequest(PensionRequest pensionRequest) { pensionRequestRepository.Add(pensionRequest); // if the record added successfully to the database // send email for user //SendConfirmationEmail(pensionRequest.StaffId, pensionRequest.Name, pensionRequest.WithdrawalAmmount); return(pensionRequest); }
public async Task <IActionResult> Post(PensionRequestForAddDto model) { PensionRequest pensionRequest = mapper.Map <PensionRequest>(model); pensionRequestService.CreatePensionRequest(pensionRequest); await unitOfWork.Commit(); return(Ok()); }
public async Task <PensionRequest> Add(PensionRequest pensionRequest) { await context.PensionRequests.AddAsync(pensionRequest); return(pensionRequest); }
public PensionRequest FillPensionObject(int userStaffId, SuccessFactor successFactorData, PensionRequest pension) { // pension.Id = userStaffId; // PensionRequest pension = new PensionRequest(); MetlifeData metlifeData = metlifeDataRepository.GetMetlifeDataForUser(userStaffId); // metlife data pension.BeginingBalance = metlifeData.OldBalance; pension.CurrentyearContribution = metlifeData.Contribution; //change the logic from constants to dynamic data // pension.CurrentAvailableBalance = metlifeData.NewBalance; pension.CurrentAvailableBalance = CalculateCurrentAvailableBalance(metlifeData.Contribution, metlifeData.OldBalance, metlifeData.Income, metlifeData.Withdrawals); pension.WithdrawalAmmount = metlifeData.Withdrawals; pension.LastRoundWithdrawal = metlifeData.Withdrawals; pension.Income = metlifeData.Income; /// /// calculated data pension.VestedBalance = ((pension.VestingPercent * pension.CurrentAvailableBalance) / 100); pension.MaxWithdrawalAmount = ((pension.VestedBalance * 65) / 100); //change the logic from constants to dynamic data // pension.ProratedNewContribution = ((pension.CurrentyearContribution / 12) * 8); pension.ProratedNewContribution = CalculateProratedContribution(metlifeData.Contribution); //// // success factor data pension.StaffId = successFactorData.StaffId; pension.Name = successFactorData.Name; pension.Band = successFactorData.Band; pension.CostCenter = successFactorData.CostCenter; pension.Tenure = successFactorData.Tenure; //var x = (DateTime.Now - successFactorData.HiringDate); //pension.Tenure = x.Days / 365; pension.SubBand = successFactorData.SubBand; pension.HiringDate = successFactorData.HiringDate; //// // dummy data related to the request pension.RequestedById = 1; pension.RequestedOn = DateTime.Now; pension.isActive = true; pension.isApproved = false; pension.ApprovedOn = DateTime.Now; pension.RejectedOn = DateTime.Now; return(pension); }