Exemple #1
0
        protected void RepeaterItems_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Agregar")
            {
                if (User.Identity.IsAuthenticated) //Debe logearse para agregar productos al carrito
                {
                    LabelError.Text = "";
                    int idProducto = Convert.ToInt32(e.CommandArgument);

                    try
                    {
                        PagMaestra master = (PagMaestra)this.Master;
                        master.insertaCarrito(idProducto, 1);
                        master.actualizarCarrito();
                    }
                    catch (SqlException)
                    {
                        LabelError.Text = "* Ya existe el producto en su carrito o no hay stock";
                    }
                }
                else
                {
                    FormsAuthentication.RedirectToLoginPage();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            carrito = new Carrito(Convert.ToInt32(Session["Usuario"]));
            master  = (PagMaestra)this.Master;

            if (!Page.IsPostBack)
            {
                actualizarCarrito();
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            carrito = new Carrito(Convert.ToInt32(Session["Usuario"]));
            master = (PagMaestra)this.Master;

            if (!Page.IsPostBack)
            {
                actualizarCarrito();
            }
        }