private void fillCashFlowFromPlannerAssumption(PlannerAssumption plannerAssumption) { _cashFlow.ClientLifeExpected = plannerAssumption.ClientLifeExpectancy; _cashFlow.ClientRetirementAge = plannerAssumption.ClientRetirementAge; _cashFlow.SpouseLifeExpected = plannerAssumption.SpouseLifeExpectancy; _cashFlow.SpouseRetirementAge = plannerAssumption.SpouseRetirementAge; }
private PlannerAssumption convertToPlannerAssumptionObject(DataRow dr) { PlannerAssumption plannerAssumption = new PlannerAssumption(); plannerAssumption.Id = dr.Field <int>("ID"); plannerAssumption.Pid = dr.Field <int>("PID"); plannerAssumption.ClientRetirementAge = dr.Field <int>("ClientRetirementAge"); plannerAssumption.SpouseRetirementAge = dr.Field <int>("SpouseRetirementAge"); plannerAssumption.ClientLifeExpectancy = dr.Field <int>("ClientLifeExpectancy"); plannerAssumption.SpouseLifeExpectancy = dr.Field <int>("SpouseLifeExpectancy"); plannerAssumption.PreRetirementInflactionRate = dr.Field <decimal>("PreRetirementInflactionRate"); plannerAssumption.PostRetirementInflactionRate = dr.Field <decimal>("PostRetirementInflactionRate"); plannerAssumption.EquityReturnRate = dr.Field <decimal>("EquityReturnRate"); plannerAssumption.DebtReturnRate = dr.Field <decimal>("DebtReturnRate"); plannerAssumption.OtherReturnRate = dr.Field <decimal>("OtherReturnRate"); plannerAssumption.Decription = dr.Field <string>("Description"); plannerAssumption.UpdatedOn = dr.Field <DateTime>("UpdatedOn"); plannerAssumption.UpdatedBy = dr.Field <int>("UpdatedBy"); plannerAssumption.IsClientRetirmentAgeIsPrimary = dr.Field <bool>("ConsiderClientAgeForRetirment"); plannerAssumption.ClientIncomeRise = dr.Field <decimal>("ClientIncomeRise"); plannerAssumption.SpouseIncomeRise = dr.Field <decimal>("SpouseIncomeRise"); plannerAssumption.OngoingExpRise = dr.Field <decimal>("OngoingExpRise"); plannerAssumption.PostRetirementInvestmentReturnRate = dr.Field <decimal>("PostRetirementInvestmentReturnRate"); return(plannerAssumption); }
public Result Update(PlannerAssumption PlannerAssumption) { var result = new Result(); try { PlannerAssumptionService PlannerAssumptionService = new PlannerAssumptionService(); PlannerAssumptionService.Update(PlannerAssumption); result.IsSuccess = true; } catch (Exception exception) { result.IsSuccess = false; result.ExceptionInfo = exception; } return(result); }
internal bool Update(PlannerAssumption PlannerAssumption) { try { FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization(); string apiurl = Program.WebServiceUrl + "/" + UPDATE_PlannerAssumption_API; RestAPIExecutor restApiExecutor = new RestAPIExecutor(); var restResult = restApiExecutor.Execute <PlannerAssumption>(apiurl, PlannerAssumption, "POST"); return(true); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); return(false); } }
public PlannerAssumption GetAll(int plannerId) { try { Logger.LogInfo("Get: PlannerAssumption process start"); PlannerAssumption plannerAssumption = new PlannerAssumption(); DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ALL, plannerId)); foreach (DataRow dr in dtAppConfig.Rows) { plannerAssumption = convertToPlannerAssumptionObject(dr); } Logger.LogInfo("Get: PlannerAssumption process completed."); return(plannerAssumption); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); return(null); } }
internal PlannerAssumption GetAll(int plannerId) { PlannerAssumption PlannerAssumptionObj = new PlannerAssumption(); try { FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization(); string apiurl = Program.WebServiceUrl + "/" + string.Format(GET_ALL_PlannerAssumption_API, plannerId); RestAPIExecutor restApiExecutor = new RestAPIExecutor(); var restResult = restApiExecutor.Execute <IList <PlannerAssumption> >(apiurl, null, "GET"); if (jsonSerialization.IsValidJson(restResult.ToString())) { PlannerAssumptionObj = jsonSerialization.DeserializeFromString <PlannerAssumption>(restResult.ToString()); } return(PlannerAssumptionObj); } catch (System.Net.WebException webException) { if (webException.Message.Equals("The remote server returned an error: (401) Unauthorized.")) { MessageBox.Show("You session has been expired. Please Login again.", "Session Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(null); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); return(null); } }
public void Update(PlannerAssumption PlannerAssumption) { try { string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(GET_CLIENT_NAME_QUERY, PlannerAssumption.Pid)); string recordCount = DataBase.DBService.ExecuteCommandScalar(string.Format(SELECT_COUNT, PlannerAssumption.Pid)); DataBase.DBService.BeginTransaction(); if (recordCount != "0") { DataBase.DBService.ExecuteCommandString(string.Format(UPDATE_QUERY, PlannerAssumption.ClientRetirementAge, PlannerAssumption.SpouseRetirementAge, PlannerAssumption.ClientLifeExpectancy, PlannerAssumption.SpouseLifeExpectancy, PlannerAssumption.PreRetirementInflactionRate, PlannerAssumption.PostRetirementInflactionRate, PlannerAssumption.EquityReturnRate, PlannerAssumption.DebtReturnRate, PlannerAssumption.OtherReturnRate, PlannerAssumption.Decription, PlannerAssumption.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), PlannerAssumption.UpdatedBy, PlannerAssumption.IsClientRetirmentAgeIsPrimary, PlannerAssumption.ClientIncomeRise, PlannerAssumption.SpouseIncomeRise, PlannerAssumption.OngoingExpRise, PlannerAssumption.Id, PlannerAssumption.PostRetirementInvestmentReturnRate), true); } else { DataBase.DBService.ExecuteCommandString(string.Format(INSERT_QUERY, PlannerAssumption.Pid, PlannerAssumption.ClientRetirementAge, PlannerAssumption.SpouseRetirementAge, PlannerAssumption.ClientLifeExpectancy, PlannerAssumption.SpouseLifeExpectancy, PlannerAssumption.PreRetirementInflactionRate, PlannerAssumption.PostRetirementInflactionRate, PlannerAssumption.EquityReturnRate, PlannerAssumption.DebtReturnRate, PlannerAssumption.OtherReturnRate, PlannerAssumption.Decription, PlannerAssumption.CreatedOn.ToString("yyyy-MM-dd hh:mm:ss"), PlannerAssumption.CreatedBy, PlannerAssumption.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), PlannerAssumption.UpdatedBy, PlannerAssumption.IsClientRetirmentAgeIsPrimary, PlannerAssumption.ClientIncomeRise, PlannerAssumption.SpouseIncomeRise, PlannerAssumption.OngoingExpRise, PlannerAssumption.PostRetirementInvestmentReturnRate), true); } Activity.ActivitiesService.Add(ActivityType.UpdatePlannerAssumption, EntryStatus.Success, Source.Server, PlannerAssumption.UpdatedByUserName, clientName, PlannerAssumption.MachineName); DataBase.DBService.CommitTransaction(); } catch (Exception ex) { DataBase.DBService.RollbackTransaction(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); throw ex; } }