protected void Page_Load(object sender, EventArgs e) { compra = new Compra(); if (!Page.IsPostBack) { GridDetalle.DataSource = carrito.listarDetalle(); GridDetalle.DataBind(); LabelEnvio.Text = string.Format("{0:c}", ENVIO); LabelTotal.Text = string.Format("{0:c}", carrito.totalCarrito() + ENVIO); } }
protected void GridCompras_RowCommand(object sender, GridViewCommandEventArgs e) { int idCompra = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Confirmar") { compra.confirmarCompra(idCompra); actualizarGrid(); } else if (e.CommandName == "Detalle") { GridDetalle.DataSource = compra.compraDetalle(idCompra); GridDetalle.DataBind(); } }
private void actualizarCarrito() { GridDetalle.DataSource = carrito.listarDetalle(); GridDetalle.DataBind(); decimal total = carrito.totalCarrito(); if (total > 0) { LabelTotal.Text = string.Format("{0:c}", carrito.totalCarrito()); } else { LabelTotalText.Text = ""; LabelTotal.Text = ""; TituloCarrito.InnerText = "Su carrito se encuentra vacĂo"; BtnActualizarCarrito.Visible = false; BtnEliminaCarrito.Visible = false; BtnConfirmaCompra.Visible = false; } }
protected void ChargeGridPedido(List <T_temp_DetPedido> Datos) { GridDetalle.DataSource = Datos; GridDetalle.DataBind(); }