Exemplo n.º 1
0
 protected void registrar_boton_Click(object sender, ImageClickEventArgs e)
 {
     if (IsValid)
     {
         usuario = new Usuario(text_Nombre.Text, text_Apellido.Text, text_Contraseña.Text, text_Direccion.Text, text_Email.Text);
         CFichero.añadirUsuario(usuario);
         if (Request.Cookies["usuario"] != null)
         {
             Request.Cookies["usuario"].Value = text_Nombre.Text;
         }
         else
         {
             HttpCookie miCookie = new HttpCookie("usuario");
             miCookie.Value = text_Nombre.Text;
             Response.Cookies.Add(miCookie);
         }
         Response.Redirect("Centro.aspx");
     }
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            usuario = ayudante.fabricaUsuario(Request.Cookies["usuario"].Value);
            ayudante.construirPath((Table)Master.FindControl("table_Path"), "Inicio:Carro:Facturacion");

            if (IsPostBack)
            {
                foreach (string clave in Request.Params)
                {
                    // Boton Pagar
                    if (clave.Contains("button_Pagar"))
                    {
                        if (CMensajeria.mandarMail(usuario.email))
                        {
                            CFichero.sobrescribirCestasTxT(CFichero.rutaCestas, usuario.nombre, "0", false, true);
                            Response.Redirect("Centro.aspx");
                        }
                    }

                    if (clave.Contains("button_Volver"))
                    {
                        Response.Redirect("Carro.aspx");
                    }
                }
            }

            campo_nombre.Text    = usuario.nombre;
            campo_apellido.Text  = usuario.apellido;
            campo_direccion.Text = "C/ " + usuario.direccion;
            campo_email.Text     = usuario.email;
            list_Cesta.Rows      = usuario.cesta.listaLibros.Count;
            foreach (Libro libro in usuario.cesta.listaLibros)
            {
                list_Cesta.Items.Add("Titulo: " + libro.titulo + "    Autor: " + libro.autor + "    Editorial: " + libro.editorial + "    Precio: " + libro.precio + " €");
            }
        }