Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public IActionResult Status()
        {
            ReportService          rs = new ReportService(_con);
            PrimarySourceSerivce   ps = new PrimarySourceSerivce(_con);
            SecoundrySourceService ss = new SecoundrySourceService(_con);

            ViewBag.primaries   = ps.GetAllPrimarySources();
            ViewBag.secondaries = ss.GetAllSecoundrySources();
            var model = rs.GetSourceStatus();

            return(View(model));
        }
        public IActionResult Index(int Id = -1)
        {
            PrimarySourceSerivce ps = new PrimarySourceSerivce(_Context);

            List <PrimarySourceDataModel> Model = null;
            FactoryService fs = new FactoryService(_Context);

            ViewBag.factories = fs.GetAllFactoriesSimple();
            if (Id != -1)
            {
                Model = ps.GetAllPrimarySourcesbyfacId(Id);
            }
            else
            {
                Model = ps.GetAllPrimarySources();
            }
            return(View(Model));
        }
        public IActionResult Create(int Id)
        {
            if (Id != -1)
            {
                PrimarySourceDataModel viewModel = new PrimarySourceDataModel()
                {
                    FacId = Id
                };
                return(View(viewModel));
            }
            else
            {
                FactoryService       fs = new FactoryService(_Context);
                PrimarySourceSerivce ps = new PrimarySourceSerivce(_Context);
                ViewBag.factories = fs.GetAllFactoriesSimple();
                ViewBag.primaries = ps.GetAllPrimarySources();


                return(View("homeCreate"));
            }
        }
Exemplo n.º 5
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));
        }