Update: Re Organicé todos los form

This commit is contained in:
fedpo
2024-09-30 18:04:35 +01:00
parent 1ef74f18c4
commit 37ff7022cf
16 changed files with 117 additions and 162 deletions

View File

@@ -22,9 +22,7 @@ namespace Vista
InitializeComponent();
ActualizarGrilla();
CargarDatos();
cmbCliente.DisplayMember = "Cliente";
cmbCliente.SelectedIndex = -1;
}
private void ActualizarGrilla()
@@ -68,11 +66,7 @@ namespace Vista
private void CargarDatos()
{
// Asignar la lista de clientes como origen de datos para el ComboBox
cmbCliente.DataSource = ControladoraFacturas.Instance.ListarClientes();
// Establecer la propiedad para mostrar el nombre del cliente en el ComboBox
cmbCliente.DisplayMember = "NombreCompleto";
var listdetalle = ControladoraFacturas.Instance.Listar();
numid.Value = (listdetalle.Count > 0) ?
@@ -106,7 +100,7 @@ namespace Vista
string devolucion = "";
if (string.IsNullOrEmpty(numid.Text)) devolucion += "El ID no puede ser nulo o vacío\n";
if (cmbCliente.SelectedIndex == -1) devolucion += "Debe seleccionar un cliente\n";
//if (cmbCliente.SelectedIndex == -1) devolucion += "Debe seleccionar un cliente\n";
if (devolucion == "")
{
@@ -127,7 +121,7 @@ namespace Vista
factura.Total = Convert.ToDouble(numtotal.Value);
factura.Fecha = datepick.Value;
factura.Id = Convert.ToInt32(numid.Value);
factura.Cliente = ControladoraFacturas.Instance.ListarClientes().First(x => x.NombreCompleto == cmbCliente.SelectedValue.ToString());
string mensaje = ControladoraFacturas.Instance.Añadir(factura);
MessageBox.Show(mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);