Exemplo n.º 1
0
 public ActionResult Index()
 {
     var today = DateTime.Today.AddYears(-1);
     var startDate = new DateTime(today.Year, today.Month, 1);
     var endDate = startDate.AddYears(1).AddDays(-1);
     var model = new ComparisonChartRequestModel
         {
             targetType = TargetType.CarbonEmissions,
             startDate = startDate,
             endDate = endDate
         };
     return View(model);
 }
Exemplo n.º 2
0
 private ComparisonChartViewModel CreatePrintModel(ComparisonChartRequestModel request)
 {
     var model = service.CreateModel(request);
     model.request = request;
     foreach (var series in model.series.ToArray())
     {
         var seriesRequest = new ComparisonSeriesRequestModel
             {
                 activityId = series.activityId,
                 costCode = series.costCode,
                 endDate = request.endDate,
                 startDate = request.startDate,
                 target = series.target,
                 targetType = request.targetType
             };
         series.data = service.ComparisonData(seriesRequest).ToArray();
     }
     return model;
 }
Exemplo n.º 3
0
 public ActionResult ComparisonChart(ComparisonChartRequestModel request)
 {
     var model = service.CreateModel(request);
     return Json(model, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 4
0
 public ActionResult PrintPdf(ComparisonChartRequestModel request)
 {
     var model = CreatePrintModel(request);
     return PrintResult.PrintToPdf("Print", model);
 }
 public ComparisonChartViewModel CreateModel(ComparisonChartRequestModel request)
 {
     var model = new ComparisonChartViewModel
         {
             categories = Categories(request.startDate, request.endDate),
             series = ChartSeries(request.targetType).ToArray()
         };
     return model;
 }