예제 #1
0
        public IActionResult Edit(int Id)
        {
            LoadsServices ld   = new LoadsServices(_Context);
            var           load = ld.GetLoadById(Id);

            ViewBag.Functions = ld.GetAllFunctions();
            return(View(load));
        }
예제 #2
0
        public IActionResult HarmonicStat()
        {
            FactoryService fs = new FactoryService(_Context);
            LoadsServices  ls = new LoadsServices(_Context);

            ViewBag.factories = fs.GetAllFactoriesSimple();
            ViewBag.loads     = ls.GetAllLoads();
            ViewBag.functions = ls.GetAllFunctions();
            return(View());
        }
예제 #3
0
        public IActionResult homeCreate(int Id)
        {
            FactoryService fs = new FactoryService(_Context);
            LoadsServices  ls = new LoadsServices(_Context);

            ViewBag.factories = fs.GetAllFactoriesSimple();
            ViewBag.Functions = ls.GetAllFunctions();

            return(View());
        }
예제 #4
0
        public List <EnergyC> EnergyConsumedAjax(int id, int sort, string val, DateTime datefrom, DateTime dateto)
        {
            List <EnergyC> res     = new List <EnergyC>();
            List <EnergyC> results = new List <EnergyC>();

            FactoryService fs = new FactoryService(_Context);

            LoadsServices ls = new LoadsServices(_Context);
            ReportService rs = new ReportService(_Context);

            var i = 0;

            ViewBag.functions = ls.GetAllFunctions();
            if (sort == 1)
            {
                while (datefrom != dateto.AddDays(1))
                {
                    res = rs.GetEnergies(id, sort, val, datefrom);
                    foreach (var item in res)
                    {
                        results.Add(item);
                    }

                    datefrom = datefrom.AddDays(1);
                }
            }
            else
            {
                while (datefrom != dateto.AddDays(1))
                {
                    var loads = _Context.Load.Where(l => l.Function == val).ToList();
                    foreach (var load in loads)
                    {
                        res = rs.GetEnergies(id, sort, Convert.ToString(load.Id), datefrom);

                        foreach (var item in res)
                        {
                            results.Add(item);
                        }
                        sort = 2;
                    }
                    datefrom = datefrom.AddDays(1);
                    i++;
                }
            }
            return(results);
        }