protected void GridDetalle_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EliminarProducto") { int idProducto = Convert.ToInt32(e.CommandArgument); carrito.eliminaProductoDetalle(idProducto); actualizarCarrito(); master.actualizarCarrito(); } }
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(); } } }