public bool generarDetalleFactura(detalleFacturaEntidades detalleFactura) { AccesoDatos acceso = new AccesoDatos(); SqlCommand command = new SqlCommand(); armarParametrosGenrarDetalleFactura(ref command, detalleFactura); return(Convert.ToBoolean(acceso.ejecutarSP(command, "AgregarDetalleFacturas"))); }
public void armarParametrosGenrarDetalleFactura(ref SqlCommand command, detalleFacturaEntidades detalleFactura) { SqlParameter parameter = new SqlParameter(); parameter = command.Parameters.Add("@id_Factura", SqlDbType.Int); parameter.Value = detalleFactura.Id_factura; parameter = command.Parameters.Add("@id_Articulo", SqlDbType.Int); parameter.Value = detalleFactura.Id_articulo; parameter = command.Parameters.Add("@PrecioUnitario", SqlDbType.Decimal); parameter.Value = detalleFactura.Precio_unitario; parameter = command.Parameters.Add("@descripcionProducto", SqlDbType.VarChar); parameter.Value = detalleFactura.DescripcionProducto; parameter = command.Parameters.Add("@cantidad", SqlDbType.Int); parameter.Value = detalleFactura.Cantidad; }
protected void btnConfirmar_Click(object sender, EventArgs e) { esconderBotonesCompra(); facturasNegocios facturas = new facturasNegocios(); facturasEntidades facturasEntidades = new facturasEntidades(); facturasEntidades.Dni_Usuario = Session["dni"].ToString(); facturasEntidades.Monto_final = Convert.ToDecimal(Session["total"]); if (!facturas.generarFactura(facturasEntidades)) { lblGrv.Text = "LA COMPRA NO PUDO SER CONFIRMADA"; return; } lblGrv.Text = "COMPRA CONFIRMADA"; DataTable dt = new DataTable(); string consulta = "select id_Factura from facturas where dni_Usuario =" + Session["dni"].ToString(); dt = facturas.cargarGrv(consulta); detalleFacturaEntidades detalleFacturaEntidades = new detalleFacturaEntidades(); foreach (DataRow row in dt.Rows) { detalleFacturaEntidades.Id_factura = Convert.ToInt32(row[0]); } carritoNegocios carrito = new carritoNegocios(); foreach (GridViewRow row in grvCarrito.Rows) { detalleFacturaEntidades.Id_articulo = Convert.ToInt32(((Label)row.FindControl("lblIdArt")).Text); detalleFacturaEntidades.DescripcionProducto = ((Label)row.FindControl("lblNomProducto")).Text; detalleFacturaEntidades.Precio_unitario = Convert.ToDecimal(((Label)row.FindControl("lblPrecio")).Text); detalleFacturaEntidades.Cantidad = Convert.ToInt32(((Label)row.FindControl("lblCantidad")).Text); facturas.generarDetalleFactura(detalleFacturaEntidades); carrito.borrarArticulo(Session["dni"].ToString(), detalleFacturaEntidades.Id_articulo.ToString()); } cargarGrvUsuarioXcarrito(); }
public bool generarDetalleFactura(detalleFacturaEntidades detalleFactura) { facturasDatos facturasDatos = new facturasDatos(); return(facturasDatos.generarDetalleFactura(detalleFactura)); }