public void LlenarDatos(Ventas venta) { float itbis; int id; int.TryParse(VentaIdtextBox.Text, out id); venta.VentaId = id; venta.ClienteId = (int)ClientecomboBox.SelectedValue; venta.TipoVenta = TipoVentacomboBox.Text; venta.NFC = NFCtextBox.Text; venta.TipoNFC = TipoNFCtextBox.Text; venta.Fecha = FechadateTimePicker.Text; venta.Total = total; foreach (DataGridViewRow row in VentasdataGridView.Rows) { id = Convert.ToInt32(row.Cells["ProductoId"].Value); int cantidad = Convert.ToInt32(row.Cells["Cantidad"].Value); itbis = Convert.ToSingle(row.Cells["ITBIS"].Value); float descuentos = Convert.ToSingle(row.Cells["Descuento"].Value); venta.AgregarProducto(id, row.Cells["Nombre"].Value.ToString(), Convert.ToSingle(row.Cells["Precio"].Value), itbis, cantidad, descuentos, Convert.ToSingle(row.Cells["Importe"].Value)); } }