Beispiel #1
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            if (txtCredito.Text == "" || (nudCuota.Value == 0 && nudPlazo.Value == 0))
            {
                MessageBox.Show("Ingrese todos los datos solicitados", "Error en el ingreso de datos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                Credito credito = DatosTacticos.obtenerCredito(txtCredito.Text);

                if (credito == null)
                {
                    MessageBox.Show("No se encontró un crédito con ese código", "Error en la búsqueda", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    lblAsociado.Text    = credito.asociado + ", " + credito.codigo;
                    lblMora.Text        = "$" + credito.mora.ToString();
                    lblCuotaActual.Text = "$" + credito.cuota.ToString();
                    lblPagosActual.Text = ((int)(credito.saldo / credito.cuota)).ToString();

                    if (nudPlazo.Value != 0)
                    {
                        lblPagosNuevo.Text = nudPlazo.Value.ToString();
                        lblCuotaNueva.Text = "$" + (credito.saldo / nudPlazo.Value).ToString("0.00");
                    }

                    if (nudCuota.Value != 0)
                    {
                        lblCuotaNueva.Text = nudCuota.Value.ToString();
                        lblPagosNuevo.Text = ((int)(credito.saldo / nudCuota.Value)).ToString();
                    }
                }
            }
        }