Ejemplo n.º 1
0
        public ActionResult ReportPage()
        {
            SecondReportViewModel model = (SecondReportViewModel)TempData["model"];

            TempData["model"] = model;

            model.BranchList = model.List.GroupBy(t => t.BranchName, t => t.HAList).ToList();
            double cost        = 0.0;
            double maintenance = 0.0;

            model.BranchList.ForEach(t =>
            {
                t.ToList().ForEach(s =>
                {
                    s.ForEach(r =>
                    {
                        cost += r.Cost;
                        if (r.Maintenance != null)
                        {
                            maintenance += r.Maintenance.Price;
                        }
                    });
                });
                model.BranchCost.Add(cost);
                model.BranchMaintenance.Add(maintenance);
                cost        = 0.0;
                maintenance = 0.0;
            });


            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult ConfirmationPage(bool future)
        {
            List <SecondMakeReport> l  = (List <SecondMakeReport>)TempData["list"];
            DateTime startDate         = (DateTime)TempData["Start"];
            DateTime endDate           = (DateTime)TempData["End"];
            SecondReportViewModel srvm = new SecondReportViewModel(l, future, startDate, endDate);

            return(View(srvm));
        }
Ejemplo n.º 3
0
 public ActionResult ReportPageConfirmed()
 {
     try
     {
         SecondReportViewModel model = (SecondReportViewModel)TempData["model"];
         System.Data.DataTable data  = MakeTable(model.List);
         MakeExcel(data);
     }
     catch (Exception ex)
     {
         TempData["error"] = "there has been an error. Please contact the IT department";
         return(RedirectToAction("Index"));
     }
     return(Redirect("ReportPage"));
 }