/// <summary> /// Método de respuesta al evento de cambio de Objeto. /// Coloca los datos de el Cliente "actual" en los textBox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bindingSource1_CurrentChanged(object sender, EventArgs e) { Cliente c = (Cliente)bindingSource1.Current; if (c != null) { tbDNI.Text = c.Dni; tbApellidos.Text = c.Apellido; tbImporte.Text = GestionCliente.getPresupuestos(new Implementacion.ClienteDTO1(c.Dni)).ToString(); tbNombre.Text = c.Nombre; } }
/// <summary> /// Ordena los datos por Importe de menor a mayor. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnImporte_Click(object sender, EventArgs e) { this.listBox1.Items.Clear(); this.listBox2.Items.Clear(); this.listBox3.Items.Clear(); List <Cliente> lord = GestionCliente.listarClientes(); lord.Sort(ComparaPresupuestos); foreach (Cliente c in lord) { listBox1.Items.Add(c.Dni); listBox2.Items.Add(c.Apellido + ", " + c.Nombre); listBox3.Items.Add(GestionCliente.getPresupuestos(new Implementacion.ClienteDTO1(c.Dni))); } }
public FRecorridoCliente(List <Cliente> lc) { InitializeComponent(); this.lc = lc; if (lc.Count != 0) { this.bindingSource1.DataSource = lc; this.bindingNavigator1.BindingSource = bindingSource1; Cliente c = (Cliente)bindingSource1.Current; tbDNI.Text = c.Dni; tbApellidos.Text = c.Apellido; tbImporte.Text = GestionCliente.getPresupuestos(new ClienteDTO1(c.Dni)).ToString(); tbNombre.Text = c.Nombre; } else { MessageBox.Show("No hay clientes en la BD."); this.Close(); } }
/// <summary> /// Compara los presupuestos de dos clientes y devuelve un entero. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static int ComparaPresupuestos(Cliente c1, Cliente c2) { return(GestionCliente.getPresupuestos(new Implementacion.ClienteDTO1(c1.Dni)).CompareTo(GestionCliente.getPresupuestos(new Implementacion.ClienteDTO1(c2.Dni)))); }
/// <summary> /// Método de respuesta al evento de click en el menú tsImporteCliente. /// Devuelve un mensaje con el importe del cliente con el DNI introducido. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsImporteCliente_Click(object sender, EventArgs e) { FClave fc = new FClave("ID Cliente (DNI):"); DialogResult dr = fc.ShowDialog(); if (dr == DialogResult.OK) { ClienteDTO1 cdto = new ClienteDTO1(fc.Clave); if (GestionCliente.existeCliente(cdto)) { MessageBox.Show("El importe total del cliente " + fc.Clave + " es " + GestionCliente.getPresupuestos(cdto), "Importe total", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("El cliente introducido no existe", "Cliente inexistente", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }