public virtual ActionResult GetGraphData(Models.GraphModel graphData) { var ajaxResult = new Dictionary <string, string>(); try { DateTime currentExpirationDate = graphData.CurrentDisbursementExpirationDate; string pcMail = IDBContext.Current.UserName; var result = new Dictionary <string, List <decimal?[]> >(); var projectionMatrix = new ProjectedLoanModel() { ProjectedMonths = new List <MW.Domain.Models.Disbursement.ProjectedMonthYearModel>(), AllLoans = new OperationLevelProjectionsViewModel() { ProjectedMonths = new List <MW.Domain.Models.Disbursement.ProjectedMonthYearModel>() } }; if (graphData.ProjectedMonths != null) { projectionMatrix.ProjectedMonths = graphData.ProjectedMonths.ConvertToModel(); } if (graphData.AllLoansProjectedMonths != null) { projectionMatrix.AllLoans.ProjectedMonths = graphData.AllLoansProjectedMonths.ConvertToModel(); } _disbursementService.CalculateGraphPoints( result, projectionMatrix, graphData.OperationNumber, pcMail, false, currentExpirationDate, projectionMatrix.AllLoans); ajaxResult[DisbursementValues.ACTION] = DisbursementValues.CALL_FUNCTION_PARAMETERED; ajaxResult[DisbursementValues.CALL_FUNCTION_FN] = DisbursementValues.DISBURSEMENT_SHOW_GRAPH; ajaxResult[DisbursementValues.CALL_FUNCTION_PARAMETERS] = string.Format("[{0}]", new JavaScriptSerializer().Serialize(result)); } catch (Exception e) { ajaxResult[DisbursementValues.ACTION] = DisbursementValues.SHOW_ERROR; ajaxResult[DisbursementValues.ERROR_TEXT] = e.Message; } return(Content(new JavaScriptSerializer().Serialize(ajaxResult))); }
public virtual ActionResult GetGraphData(Models.GraphModel graphData) { var ajaxResult = new Dictionary <string, string>(); try { var result = new Dictionary <string, List <decimal?[]> >(); string operationNumber = graphData.OperationNumber; string group = graphData.Group; string pcMail = IDBContext.Current.UserName; var currentExpiration = graphData.CurrentDisbursementExpirationDate; var projectionMatrix = new OperationLevelProjectionsViewModel() { ProjectedMonths = graphData.ProjectedMonths != null ? graphData.ProjectedMonths.ConvertToModel() : new List <MW.Domain.Models.Disbursement.ProjectedMonthYearModel>() }; _disbursementService.CalculateGraphPoints( result, projectionMatrix, operationNumber, pcMail, group == DisbursementValues.GROUPED, currentExpiration); ajaxResult[DisbursementValues.ACTION] = DisbursementValues.CALL_FUNCTION_PARAMETERED; ajaxResult[DisbursementValues.CALL_FUNCTION_FN] = DisbursementValues.DISBURSEMENT_SHOW_GRAPH; ajaxResult[DisbursementValues.CALL_FUNCTION_PARAMETERS] = string.Format( DisbursementValues.STRING_FORMAT, new JavaScriptSerializer().Serialize(result)); } catch (Exception e) { ajaxResult[DisbursementValues.ACTION] = DisbursementValues.SHOW_ERROR; ajaxResult[DisbursementValues.ERROR_TEXT] = e.Message; Logger.GetLogger() .WriteMessage( DisbursementValues.OPERATION_LEVEL_PROJECTIONS_CONTROLLER, e.Message + e.StackTrace); } return(Content(new JavaScriptSerializer().Serialize(ajaxResult))); }