コード例 #1
0
ファイル: FCarrito.aspx.cs プロジェクト: shir1594/Patisserie
 protected void GridViewCarritoCompras_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.Footer)
     {
         e.Row.Cells[3].Text = "Subtotal: S/." + CarritoCompras.CapturarProducto().SubTotal().ToString();
     }
 }
コード例 #2
0
        protected void ButtonComprar_Click(object sender, EventArgs e)
        {
            decimal subtotal    = CarritoCompras.CapturarProducto().SubTotal();
            decimal gastosenvio = 10;
            decimal total       = subtotal + gastosenvio;

            if (RadioButtonListPago.SelectedItem.Text == "Con Pago en Efectivo")
            {
                TextBoxEfectivo.Visible = true;
                if (TextBoxEfectivo.Text == "" || Convert.ToDecimal(TextBoxEfectivo.Text) < total)
                {
                    TextBoxEfectivo.Text = "";
                }
                else if (Convert.ToDecimal(TextBoxEfectivo.Text) > total)
                {
                    //
                    Session.Clear();
                    Server.Transfer("FCarrito.aspx");
                }
            }
            else if (RadioButtonListPago.SelectedItem.Text == "Con Tarjeta Registrada")
            {
                //
                Session.Clear();
                Server.Transfer("FCarrito.aspx");
            }
        }
コード例 #3
0
ファイル: FCarrito.aspx.cs プロジェクト: shir1594/Patisserie
 protected void GridViewCarritoCompras_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Eliminar")
     {
         int productId = Convert.ToInt32(e.CommandArgument);
         CarritoCompras.CapturarProducto().EliminarProductos(productId);
     }
     BindData();
 }
コード例 #4
0
ファイル: FCarrito.aspx.cs プロジェクト: shir1594/Patisserie
 protected void BindData()
 {
     GridViewCarritoCompras.DataSource = CarritoCompras.CapturarProducto().ListaProductos;
     GridViewCarritoCompras.DataBind();
     if (CarritoCompras.CapturarProducto().SubTotal() == 00)
     {
         ButtonComprar.Visible = false;
     }
 }
コード例 #5
0
        protected void Data()
        {
            decimal subtotal    = CarritoCompras.CapturarProducto().SubTotal();
            decimal gastosenvio = 10;
            decimal total       = subtotal + gastosenvio;

            LabelSubtotal.Text    = "S/. " + subtotal;
            LabelGastosEnvio.Text = "S/. " + gastosenvio;
            LabelTotal.Text       = "S/. " + total;
        }
コード例 #6
0
        public static CarritoCompras CapturarProducto()
        {
            CarritoCompras _carrito = (CarritoCompras)HttpContext.Current.Session["ASPCarritoCompras"];

            if (_carrito == null)
            {
                HttpContext.Current.Session["ASPCarritoCompras"] = _carrito = new CarritoCompras();
            }
            return(_carrito);
        }
コード例 #7
0
ファイル: FCarrito.aspx.cs プロジェクト: shir1594/Patisserie
        protected void ButtonActualizar_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in GridViewCarritoCompras.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    try
                    {
                        int productoId = Convert.ToInt32(GridViewCarritoCompras.DataKeys[row.RowIndex].Value);
                        int cantidad   = int.Parse(((TextBox)row.Cells[1].FindControl("TextBoxCantidad")).Text);

                        if (cantidad < 0)
                        {
                            cantidad = cantidad * (-1);
                            ((TextBox)row.Cells[1].FindControl("TextBoxCantidad")).Text = "$cantidad";
                        }

                        CarritoCompras.CapturarProducto().CantidadDeProductos(productoId, cantidad);
                    }
                    catch (FormatException) { }
                }
            }
            BindData();
        }
コード例 #8
0
        protected void ButtonPayOreo_Click(object sender, EventArgs e)
        {
            CarritoCompras carrito = CarritoCompras.CapturarProducto();

            carrito.Agregar(6);
        }