Пример #1
0
        protected void GridDetalle_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EliminarProducto")
            {
                int idProducto = Convert.ToInt32(e.CommandArgument);
                carrito.eliminaProductoDetalle(idProducto);

                actualizarCarrito();
                master.actualizarCarrito();
            }
        }
Пример #2
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();
                }
            }
        }