public bool AddMetlifeDataRecord(MetlifeData metlifeDataRecord) { if (!metlifeDataRepository.Add(metlifeDataRecord)) { return(false); } else { return(true); } }
public bool Add(MetlifeData metlifeData) { try { context.metlifeData.Add(metlifeData); context.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
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); }
public bool IsWithdraw(int userStaffId) { //If metlifedata last round withdrawal != zero then notEligible MetlifeData metlifeData = metlifeDataRepository.GetMetlifeDataForUser(userStaffId); if (metlifeData.Withdrawals != 0) { return(true); } else { return(false); } }
public IActionResult Post(List <MetlifeDataForAddDto> model) { List <MetlifeData> errorList = new List <MetlifeData>(); foreach (var metlifeDataRecord in model) { MetlifeData metlifeData = mapper.Map <MetlifeData>(metlifeDataRecord); if (!metlifeDataService.AddMetlifeDataRecord(metlifeData)) { errorList.Add(metlifeData); } } //await unitOfWork.Commit(); return(Ok()); }