Пример #1
0
        /*  [HttpGet]
         * public IActionResult PeakPerDay()
         * {
         *    FactoryService fs = new FactoryService(_Context);
         *    ViewBag.factories = fs.GetAllFactoriesSimple();
         *    PrimarySourceSerivce ps = new PrimarySourceSerivce(_Context);
         *    ViewBag.Primary = ps.GetAllPrimarySources();
         *    LoadsServices ls = new LoadsServices(_Context);
         *    ViewBag.Loads = ls.GetAllLoads();
         *    return View();
         * }
         * [HttpPost]*/
        public IActionResult PeakPerDay(DateTime date, int type = -1, int primId = -1, int loadId = -1)
        {
            FactoryService fs = new FactoryService(_Context);

            ViewBag.factories = fs.GetAllFactoriesSimple();
            PrimarySourceSerivce ps = new PrimarySourceSerivce(_Context);

            ViewBag.Primary = ps.GetAllPrimarySources();
            LoadsServices ls = new LoadsServices(_Context);

            ViewBag.Loads = ls.GetAllLoads();
            ReportService      rs  = new ReportService(_Context);
            PowerPeakViewModel res = new PowerPeakViewModel();

            if (type == 1)
            {
                res = rs.PowerPeakPerDay(date, type, primId);
            }
            else
            {
                res = rs.PowerPeakPerDay(date, type, loadId);
            }



            return(View(res));
        }
Пример #2
0
        //ABDO
        public IActionResult powerpeak(int primId, int loadId, int type = -1) //type 1 -> prim , 2 -> load
        {
            ReportService        rs = new ReportService(_Context);
            PrimarySourceSerivce ps = new PrimarySourceSerivce(_Context);

            ViewBag.Primary = ps.GetAllPrimarySources();
            LoadsServices ls = new LoadsServices(_Context);

            ViewBag.loads = ls.GetAllLoads();
            PowerPeakViewModel res = new PowerPeakViewModel();

            if (type == 1)
            {
                res = rs.PowerPeakBySourceID(primId, type);
            }
            else if (type == 2)
            {
                res = rs.PowerPeakBySourceID(loadId, type);
            }

            return(View(res));
        }