protected void Page_Load(object sender, EventArgs e) { try { var valorQueViene = Request.QueryString["valor"]; var producto = int.Parse(valorQueViene); if (producto != 0) { usuario = (Usuario)Session["Usuario"]; voucher = (Voucher)Session["Voucher"]; Producto p = new Producto(); p.Id = producto; Voucheriappal v = new Voucheriappal(); v.CrearTransaccion(usuario, voucher, p); v = null; Response.Redirect("Congratulations.aspx"); } } catch (Exception) { if (IsPostBack) { Response.Write("<script>alert('Error!');</script>"); } } }
void BuscarUsuario() { try { Voucheriappal v = new Voucheriappal(); usuario = v.BuscarCliente(usuario.Dni); } catch (Exception) { } }
protected override void OnInit(EventArgs e) { try { base.OnInit(e); Voucheriappal v = new Voucheriappal(); html = v.GetProductos(html); test.InnerHtml = html; } catch (Exception) { } }
protected void ValidarVoucher(string voucher) { try { Voucheriappal manager = new Voucheriappal(); if (manager.ValidarVoucher(voucher)) { //Response.Write("<script>alert('Voucher Correcto');</script>"); Voucher V = new Voucher(); V.codigo = voucher; V.estado = true; Session["Voucher"] = V; Response.Redirect("CargaDeDatos.aspx"); } else { Response.Write("<script>alert('Voucher ya utilizado / Voucher Invalido');</script>"); } } catch (Exception) { Response.Write("<script>alert('Voucher ya utilizado / Voucher Invalido');</script>"); } }