Beispiel #1
0
    protected void GV_Verproducto_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "B_agregarp")
        {
            int index;

            index = int.Parse(e.CommandArgument.ToString());
            ClientScriptManager cm = this.ClientScript;
            if (Int32.Parse(TB_cantidad.Text) <= index)
            {
                E_venta     nuevo   = new E_venta();
                Dao_carrito agregar = new Dao_carrito();

                nuevo.Cantidad    = Int32.Parse(TB_cantidad.Text);
                nuevo.Id_estado   = 2;
                nuevo.Id_cliente  = Int32.Parse(Session["id_usuaro"].ToString());
                nuevo.Id_producto = Int32.Parse(Session["id_producto"].ToString());
                agregar.agregarCarrito(nuevo);

                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Producto agregado corectamente');window.location=\"seleccionCarrito.aspx\"</script>");
            }
            else
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('No contamos con la cantidad solicitada. ');window.location=\"Catalogo_Cliente.aspx\"</script>");
            }
        }
    }
    protected Factura_clien llenarFactura()
    {
        Factura_clien factura = new Factura_clien();
        Dao_carrito   datos   = new Dao_carrito();
        Int32         id      = Int32.Parse(Session["id_usuaro"].ToString());

        DataTable datosFactura = datos.verCarrito(id);
        DataTable datosFinal   = factura.Factura;
        DataRow   fila;


        for (int i = 0; i < datosFactura.Rows.Count; i++)
        {
            fila = datosFinal.NewRow();

            fila["Fecha"]      = datosFactura.Rows[i]["Fecha"].ToString();
            fila["Nombre"]     = datosFactura.Rows[i]["Nombre"].ToString();
            fila["Apellido"]   = datosFactura.Rows[i]["Apellido"].ToString();
            fila["Direccion"]  = datosFactura.Rows[i]["Direccion"].ToString();
            fila["Marca"]      = datosFactura.Rows[i]["Marca"].ToString();
            fila["Referencia"] = datosFactura.Rows[i]["Referencia"].ToString();
            fila["Cantidad"]   = int.Parse(datosFactura.Rows[i]["Cantidad"].ToString());
            fila["Valor"]      = int.Parse(datosFactura.Rows[i]["Valor"].ToString());
            fila["Subtotal"]   = int.Parse(datosFactura.Rows[i]["Subtotal"].ToString());
            fila["Iva"]        = double.Parse(datosFactura.Rows[i]["Iva"].ToString());
            fila["Total"]      = double.Parse(datosFactura.Rows[i]["Total"].ToString());



            datosFinal.Rows.Add(fila);
        }

        return(factura);
    }
Beispiel #3
0
    protected void GV_venta_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "B_eliminar")
        {
            int         index;
            Dao_carrito nuevo = new Dao_carrito();

            index = int.Parse(e.CommandArgument.ToString());
            Session["id_venta"] = index;
            nuevo.eliminarPedido(index);


            Response.Redirect("Carrito.aspx");
        }
    }