/// <summary> /// Zapisanie do bazy /// Dokonuje zapisu do bazy danych /// </summary> /// <param name="zest"></param> /// <returns></returns> public IActionResult Zakonczenie(Zestawienie zest) { zest.il_N1 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N2 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N3 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N4 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N5 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N6 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N7 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N8 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N9 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N10 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N11 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N12 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N13 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N14 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.il_N15 = Int32.Parse(HttpContext.Session.GetString("il_N1")); zest.IDFirmy = Int32.Parse(HttpContext.Session.GetString("IDFirmy")); zest.IDWaluty = Int32.Parse(HttpContext.Session.GetString("IDWaluty")); zest.NazwaZ = HttpContext.Session.GetString("NazwaZ"); int result = zest.SaveDetails(); if (result > 0) { HttpContext.Session.SetString("Podsumowanie", "Zapisano Poprawnie!"); } else { HttpContext.Session.SetString("Podsumowanie", "Bład"); } return(RedirectToAction("Index")); }
/// <summary> /// Warosci /// </summary> /// <returns></returns> public IActionResult Podsumowanie() { ZbierzDaneZBazy ZB = new ZbierzDaneZBazy(); Zestawienie zest = new Zestawienie(); zest.il_N1 = Int32.Parse(HttpContext.Request.Form["1"]); zest.il_N2 = Int32.Parse(HttpContext.Request.Form["2"]); zest.il_N3 = Int32.Parse(HttpContext.Request.Form["3"]); zest.il_N4 = Int32.Parse(HttpContext.Request.Form["4"]); zest.il_N5 = Int32.Parse(HttpContext.Request.Form["5"]); zest.il_N6 = Int32.Parse(HttpContext.Request.Form["6"]); zest.il_N7 = Int32.Parse(HttpContext.Request.Form["7"]); zest.il_N8 = Int32.Parse(HttpContext.Request.Form["8"]); zest.il_N9 = Int32.Parse(HttpContext.Request.Form["9"]); zest.il_N10 = Int32.Parse(HttpContext.Request.Form["10"]); zest.il_N11 = Int32.Parse(HttpContext.Request.Form["11"]); zest.il_N12 = Int32.Parse(HttpContext.Request.Form["12"]); zest.il_N13 = Int32.Parse(HttpContext.Request.Form["13"]); zest.il_N14 = Int32.Parse(HttpContext.Request.Form["14"]); zest.il_N15 = Int32.Parse(HttpContext.Request.Form["15"]); zest.IDFirmy = ZB.GetIDFirmy(HttpContext.Session.GetString("WybranFirma")); zest.IDWaluty = ZB.GetIDWaluty(HttpContext.Session.GetString("WybranWaluta")); zest.NazwaZ = ZB.NazwaZ(zest.IDFirmy); return(RedirectToAction("OPodsumowanie", new RouteValueDictionary(zest))); }
/// <summary> /// Zestawienie /// Zestawienie po wyborze firmy i waluty /// </summary> /// <returns></returns> public IActionResult Zestawienie() { if (HttpContext.Session.GetString("WybranFirma") != null && HttpContext.Session.GetString("WybranWaluta") != null) { ViewBag.NazwaFirmy = HttpContext.Session.GetString("WybranFirma").ToString(); ViewBag.NazwaWaluty = HttpContext.Session.GetString("WybranWaluta").ToString(); } else { HttpContext.Session.SetString("Blad", "Nie wybrano Firmy lub Waluty!"); return(RedirectToAction("Index")); } var model = new Zestawienie(); model.Nominaly = model.ZaktualizujListeNominalow(); model.waluty = model.ZaktualizujListeWalut(); foreach (var item in model.waluty) { if (item.Key.ToString().Equals(HttpContext.Session.GetString("WybranWaluta"))) { model.wybranaWaluta = item.Value; } } return(View(model)); }
/// <summary> /// Podsumowanie kwoty /// Podlicza kwote /// </summary> /// <param name="zest"></param> /// <returns></returns> public IActionResult OPodsumowanie(Zestawienie zest) { zest.PelnaCena = zest.oblPelnaCena(); var a = zest.IDFirmy; SaveToCookie(zest); return(View(zest)); }
/// <summary> /// Dane w cookie /// Przechowuje dane w pliku cookie /// </summary> /// <param name="zest"></param> public void SaveToCookie(Zestawienie zest) { HttpContext.Session.SetString("il_N1", zest.il_N1.ToString()); HttpContext.Session.SetString("il_N2", zest.il_N2.ToString()); HttpContext.Session.SetString("il_N3", zest.il_N3.ToString()); HttpContext.Session.SetString("il_N4", zest.il_N4.ToString()); HttpContext.Session.SetString("il_N5", zest.il_N5.ToString()); HttpContext.Session.SetString("il_N6", zest.il_N6.ToString()); HttpContext.Session.SetString("il_N7", zest.il_N7.ToString()); HttpContext.Session.SetString("il_N8", zest.il_N8.ToString()); HttpContext.Session.SetString("il_N9", zest.il_N9.ToString()); HttpContext.Session.SetString("il_N10", zest.il_N10.ToString()); HttpContext.Session.SetString("il_N11", zest.il_N11.ToString()); HttpContext.Session.SetString("il_N12", zest.il_N12.ToString()); HttpContext.Session.SetString("il_N13", zest.il_N13.ToString()); HttpContext.Session.SetString("il_N14", zest.il_N14.ToString()); HttpContext.Session.SetString("il_N15", zest.il_N15.ToString()); HttpContext.Session.SetString("IDFirmy", zest.IDFirmy.ToString()); HttpContext.Session.SetString("IDWaluty", zest.IDWaluty.ToString()); HttpContext.Session.SetString("NazwaZ", zest.NazwaZ.ToString()); }