Esempio n. 1
0
 protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.Footer)
     {
         e.Row.Cells[3].Text = "Total: " + CarroDeCompras.CapturarProducto().SubTotal().ToString("C");
     }
 }
Esempio n. 2
0
 protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Eliminar")
     {
         int productId = Convert.ToInt32(e.CommandArgument);
         CarroDeCompras.CapturarProducto().EliminarProductos(productId);
     }
     BindData();
 }
Esempio n. 3
0
        public static CarroDeCompras CapturarProducto()
        {
            CarroDeCompras _carrito = (CarroDeCompras)HttpContext.Current.Session["ASPCarroDeCompras"];

            if (_carrito == null)
            {
                HttpContext.Current.Session["ASPCarroDeCompras"] = _carrito = new CarroDeCompras();
            }
            return(_carrito);
        }
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            CarroDeCompras carrito = CarroDeCompras.CapturarProducto();

            Button Button2 = (Button)sender;

            int ID = int.Parse(Button2.CommandArgument);

            carrito.Agregar(ID);
            Response.Redirect("VerCarrito.aspx");
        }
Esempio n. 5
0
 protected void BindData()
 {
     GridView2.DataSource = CarroDeCompras.CapturarProducto().ListaProductos;
     GridView2.DataBind();
 }