private void GuardarDetalleVenta(Int32 objIdVenta, Int32 objIdProducto, Int32 objCantidad, Double objPUnitario, Double objTotal) { DescripcionVentaXDetalle descripcionVentaDetalle; descripcionVentaDetalle = new DescripcionVentaXDetalle { IdVentaDetalle = objIdVenta, IdProducto = objIdProducto, Cantidad = objCantidad, PrecioUnitario = objPUnitario, Total = objTotal }; procesar.InsertarDescripcionVentaAlDetalle(descripcionVentaDetalle); limpiar(); }
public void InsertarDescripcionVentaAlDetalle(DescripcionVentaXDetalle descripcionVentaDetalle) { try { using (TransactionScope scope = new TransactionScope()) { DAL.Modapie.Mantenimiento.Instancia.InsertarDescripcionVentaAlDetalle(descripcionVentaDetalle); scope.Complete(); } } catch (Exception ee) { throw; } }
private void btnAgregar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtCedula.Text)) { if (!string.IsNullOrEmpty(txtCodigo.Text)) { if (!string.IsNullOrEmpty(txtCantidad.Text)) { if (Convert.ToInt32(txtCantidad.Text) > Program.Cantidad) { DialogResult d = MessageBox.Show("La cantidad de productos seleccionada es mayor a la existente en las bodegas", "No se puede agregar el producto", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { btnRegistro.Enabled = true; txtPago.Enabled = true; DescripcionVentaXDetalle V = new DescripcionVentaXDetalle(); double SubTotal; //V.IdProducto = Convert.ToInt32(txtCodigo.Text); Hay un problema con la llave primaria para poder registrar este campo //V.IdVenta = Convert.ToInt32(txtIdVenta.Text); Hay que decidir como se va a guardar V.Cantidad = Convert.ToInt32(txtCantidad.Text); V.IdProducto = Program.IdProducto; V.PrecioUnitario = precio; SubTotal = V.PrecioUnitario * V.Cantidad; V.Total = SubTotal; lst.Add(V); llenarGrid(); limpiarProducto(); } } else { DialogResult d = MessageBox.Show("No hay una cantidad de productos registrada", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { DialogResult d = MessageBox.Show("No hay ningĂșn producto ingresado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("No se ha ingresado ningĂșn cliente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }