public decimal GetInflationPercent() { CustomerGoalSetupDao CustomerGoalDao = new CustomerGoalSetupDao(); decimal InflationPercent = CustomerGoalDao.GetInflationPercent(); return(InflationPercent); }
public GoalProfileSetupVo CalculateGoalProfile(GoalProfileSetupVo GoalProfileVo) { double futureInvValue = 0; double futureCost = 0; double requiredSavings = 0; double costToday = 0; double requiredAfter = 0; double currentValue = 0; double rateEarned = 0; double rateOfReturn = 0; double inflationValues = 0; string goal = string.Empty; CustomerGoalSetupDao CustomerGoalDao = new CustomerGoalSetupDao(); decimal InflationPercent = CustomerGoalDao.GetInflationPercent(); try { costToday = GoalProfileVo.CostOfGoalToday; // requiredAfter = GoalProfileVo.GoalYear; requiredAfter = GoalProfileVo.GoalYear - DateTime.Today.Year; currentValue = GoalProfileVo.CurrInvestementForGoal; rateEarned = GoalProfileVo.ROIEarned / 100; rateOfReturn = GoalProfileVo.ExpectedROI / 100; inflationValues = (Double)InflationPercent / 100; futureCost = Math.Abs(FutureValue(inflationValues, requiredAfter, 0, costToday, 0)); if (currentValue == 0 && rateEarned == 0) { futureInvValue = 0; } else { futureInvValue = Math.Abs(FutureValue(rateEarned, requiredAfter, 0, currentValue, 0)); } requiredSavings = Math.Abs(PMT((rateOfReturn / 12), (requiredAfter * 12), 0, (futureCost - futureInvValue), 0)); GoalProfileVo.MonthlySavingsReq = requiredSavings; GoalProfileVo.InflationPercent = (Double)InflationPercent; return(GoalProfileVo); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerGoalSetupBo.cs:CalculateGoalProfile()"); object[] objects = new object[1]; objects[0] = GoalProfileVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }