Beispiel #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");
     }
 }
Beispiel #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();
 }
Beispiel #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");
        }
Beispiel #5
0
 protected void BindData()
 {
     GridView2.DataSource = CarroDeCompras.CapturarProducto().ListaProductos;
     GridView2.DataBind();
 }