コード例 #1
0
        public IActionResult Pregled()
        {
            if (TempData["ID_uporabnika"] == null)
            {
                return(RedirectToAction("Login", "Home"));
            }

            if (TempData["dodano"] != null)
            {
                ViewBag.dodano     = TempData["dodano"];
                TempData["dodano"] = null;
            }
            TempData.Keep();

            List <TransportStava> seznam = new List <TransportStava>();

            DALStava s = new DALStava(configuration);

            seznam = s.dobiVseStave(Convert.ToInt16(TempData["ID_uporabnika"]));

            ViewBag.podatki  = seznam;
            ViewBag.win_loss = s.trenutnoStanje(Convert.ToInt16(TempData["ID_uporabnika"]));

            return(View());
        }
コード例 #2
0
        public IActionResult Statistika()
        {
            if (TempData["ID_uporabnika"] == null)
            {
                return(RedirectToAction("Login", "Home"));
            }

            TempData.Keep();
            DALStava s           = new DALStava(configuration);
            double   stanje      = s.trenutnoStanje(Convert.ToInt16(TempData["ID_uporabnika"]));
            double   maxdobljeno = s.maxDobljena(Convert.ToInt16(TempData["ID_uporabnika"]));
            double   maxizguba   = s.maxIzguba(Convert.ToInt16(TempData["ID_uporabnika"]));
            string   winp        = s.winpercantage(Convert.ToInt16(TempData["ID_uporabnika"]));

            List <TransportStava> seznam = new List <TransportStava>();

            seznam = s.dobiVseStave(Convert.ToInt16(TempData["ID_uporabnika"]));

            string cas = "0, ";

            double dozdej = 0;

            foreach (var x in seznam)
            {
                double preracunano = Math.Round(x.Kvota * x.Kolicina, 2);
                if (x.Izid == 1)
                {
                    dozdej = dozdej + Math.Round(x.Kvota * x.Kolicina, 2) - x.Kolicina;
                    cas    = cas + dozdej + ", ";
                }
                else if (x.Izid == 2)
                {
                    preracunano = x.Kolicina * -1;
                    dozdej      = dozdej + preracunano;
                    cas         = cas + dozdej + ", ";
                }
            }
            //ViewBag.skozi_cas = "10, 30, 70, 150, 80, 40, 4, 0, 10, 0";
            ViewBag.skozi_cas = cas;

            ViewBag.stanje      = stanje;
            ViewBag.maxdobljeno = maxdobljeno;
            ViewBag.maxizguba   = maxizguba;
            ViewBag.winp        = winp;
            return(View());
        }