public List <RRViewModel> ItensReserva(RRViewModel reser) { List <RRViewModel> ResList = new List <RRViewModel>(); MySqlCommand cmd = new MySqlCommand("select * from ResumoReserva where cd_reserva = @cd", con.MyConectarBD()); cmd.Parameters.Add("@cd", MySqlDbType.VarChar).Value = reser.cd_reserva; MySqlDataAdapter sd = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); sd.Fill(dt); con.MyDesconectarBD(); foreach (DataRow dr in dt.Rows) { ResList.Add( new RRViewModel { cd_reserva = Convert.ToString(dr["cd_reserva"]), cpf_cliente = Convert.ToString(dr["CPF"]), nome_pacote = Convert.ToString(dr["nome_pacote"]), img = Convert.ToString(dr["img_pacote"]), vl_unit = string.Format(CultureInfo.GetCultureInfo("pt-BR"), "{0:#,###.##}", dr["vl_unit"]) }); } return(ResList); }
public List <RRViewModel> ResumoReserva(RRViewModel reser) { List <RRViewModel> ResList = new List <RRViewModel>(); MySqlCommand cmd = new MySqlCommand("select * from ResumoReserva ORDER BY cd_reserva DESC limit 1", con.MyConectarBD()); cmd.Parameters.Add("@cd", MySqlDbType.VarChar).Value = reser.cd_reserva; MySqlDataAdapter sd = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); sd.Fill(dt); con.MyDesconectarBD(); foreach (DataRow dr in dt.Rows) { ResList.Add( new RRViewModel { cd_reserva = Convert.ToString(dr["cd_reserva"]), cpf_cliente = Convert.ToString(dr["CPF"]), cd_cartao = Convert.ToString(dr["cd_cartao"]), nome_cartao = Convert.ToString(dr["nome_cartao"]), nome_cliente = Convert.ToString(dr["nome"]), dt_reserva = Convert.ToString(dr["dthr_reserva"]), vl_total = string.Format(CultureInfo.GetCultureInfo("pt-BR"), "R$ {0:#,###.##}", dr["vl_total"]) }); } return(ResList); }
//------------------- DETALHES VENDAS --------------------- public ActionResult DetalhesVenda(RRViewModel reser, string id) { reser.cd_reserva = id; ViewBag.reserva = acR.ResumoReservas(reser); ViewBag.itens = acR.ItensReserva(reser); return(View()); }
//------------------- RESUMO DA COMPRA EFETUADA ------------------------ public ActionResult ResumoCompra(RRViewModel reser) { reser.cd_reserva = Session["reserva"].ToString(); ViewBag.reserva = acR.ResumoReserva(reser); ViewBag.itens = acR.ItensReserva(reser); return(View()); }
public IActionResult RussianRoulette() { RRViewModel.rr = new RussianRoulette(); RRViewModel model = new RRViewModel(); User newUser = new User(); try{ newUser = HttpContext.Session.Get <User>("currentUser"); newUser.Equals("check"); } catch { return(RedirectToAction("Login", "User")); } ViewData["game"] = "bet"; return(View(model)); }
/* ------------------- PERFIL CLIENTE -------------------- */ public ActionResult PerfilCliente(Cartao card, Cliente cli, RRViewModel reser) { cli.rg = Session["rg"].ToString(); acC.PegaDados(cli); Session["tel"] = cli.telefone; ViewBag.nome = Session["nome"]; ViewBag.rg = Session["rg"]; ViewBag.img = Session["img"]; ViewBag.email = Session["email"]; ViewBag.tel = Session["tel"]; ViewBag.cpf = Session["cpf"]; ViewBag.senha = Session["senha"]; card.cpf = ViewBag.cpf; if (acCard.GetCartoes(card).Count == 0) { ViewBag.listaCartoes = acCard.GetCartoes(card); ViewBag.cardne = "Nenhum Cartão Cadastrado"; } else { ViewBag.cardne = ""; ViewBag.listaCartoes = acCard.GetCartoes(card); } reser.cpf_cliente = ViewBag.cpf; if (acR.GetReservas(reser).Count == 0) { ViewBag.reserva = acR.GetReservas(reser); ViewBag.reserne = "Nenhuma Reserva Cadastrado"; } else { ViewBag.reserne = ""; ViewBag.reserva = acR.GetReservas(reser); } return(View()); }
public IActionResult RussianRoulette(RRViewModel model, IFormCollection collection, string submitButton) { model = new RRViewModel(); ChipHelper ch = new ChipHelper(); foreach (var item in (new Pocket()).AllChips) { int intThrow; if (Int32.TryParse(collection[item.Type], out intThrow)) { RRViewModel.rr.GamePocket.AllChips.Add(new Chips() { Amount = Int32.Parse(collection[item.Type]), Type = item.Type }); } } ch.pocketSubtraction(model.User.UserPocket, RRViewModel.rr.GamePocket); if (submitButton.Equals("bet")) { foreach (var item in RRViewModel.rr.GamePocket.AllChips) { if (item.Amount > 0) { model.Bet.Add(item.Type, item.Amount); } } model.User.UserPocket.AllChips[0].Amount = 237; model.User.UserPocket.AllChips[1].Amount = 314; model.User.UserPocket.AllChips[2].Amount = 5798; model.User.UserPocket.AllChips[3].Amount = 221; } else { model.Bet = HttpContext.Session.Get <IDictionary <string, int> >("bet"); model.User.UserPocket.AllChips = HttpContext.Session.Get <List <Chips> >("chips"); } if (submitButton == "fire") { RRViewModel.rr.NextTurn(); ViewData["game"] = RRViewModel.rr.status; if (RRViewModel.rr.PlayerGun[RRViewModel.rr.turn - 1]) { ViewData["you"] = "BANG!"; } else { ViewData["you"] = "*click*"; } if (RRViewModel.rr.OpponentGun[RRViewModel.rr.turn - 1]) { ViewData["they"] = "BANG!"; } else { ViewData["they"] = "*click*"; } ViewData["turn"] = RRViewModel.rr.turn.ToString(); } if (submitButton == "leave") { RRViewModel.rr.PlayerLeave(); } ViewData["game"] = RRViewModel.rr.status; HttpContext.Session.Set <IDictionary <string, int> >("bet", model.Bet); if (submitButton.Equals("play")) { RRViewModel.rr = new RussianRoulette(); RRViewModel x = new RRViewModel(); User newUser = new User(); try { newUser = HttpContext.Session.Get <User>("currentUser"); newUser.Equals("check"); } catch { return(RedirectToAction("Login", "User")); } ViewData["game"] = "bet"; return(View(x)); } return(View(model)); }