Exemplo n.º 1
0
        private void btnAltaPrestamo_Click(object sender, EventArgs e)
        {
            try
            {
                ValidacionBotonAlta();

                string linea = txtLinea.Text;
                double tna   = double.Parse(txtTNA.Text);
                int    plazo = int.Parse(txtPlazo.Text);
                double monto = double.Parse(txtMonto.Text);
                double cuota = double.Parse(txtCuotaTotal.Text);
                int    id    = _prestamoServicio.ProximoId();

                Prestamo prestamo = new Prestamo(linea, tna, plazo, monto, cuota, id);

                _prestamoServicio.AgregarPrestamo(prestamo);

                MessageBox.Show("Alta Exitosa!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);

                CargarPrestamos(_prestamoServicio.TraerPrestamos());

                BloquearCampos();
            }
            catch (CamposVaciosAltaException ex1)
            {
                MessageBox.Show(ex1.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                BloquearCampos();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                BloquearCampos();
            }
        }
        private Prestamo CargarPrestamo()
        {
            string       linea     = txtlinea.Text;
            double       tna       = double.Parse(txttna.Text);
            double       monto     = double.Parse(txtmonto.Text);
            int          plazo     = int.Parse(txtplazo.Text);
            TipoPrestamo tipo      = (TipoPrestamo)lstTipoPrestamo.SelectedItem;
            int          idtipo    = tipo.Id;
            Cliente      cliente   = (Cliente)comboBox1.SelectedItem;
            int          idcliente = cliente.Id;
            Prestamo     p         = new Prestamo(prestamoservicio.ProximoId(), linea, plazo, tna, monto, idcliente, idtipo);

            txtcuotacap.Text = p.CuotaCapital.ToString();
            txtcuotaint.Text = p.CuotaInteres.ToString();
            txtcuotatot.Text = p.CuotaTotal.ToString();

            return(p);
        }
Exemplo n.º 3
0
 private void btnSimular_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.errores))
     {
         throw new Exception("Error en los campos: " + "\n" + this.errores);
     }
     else
     {
         p = new Operador(new Prestamo(prestamoservicio.ProximoId(),
                                       Double.Parse(txtTNA.Text),
                                       txtLinea.Text,
                                       cmbPlazo.SelectedIndex,
                                       ((Cliente)cmbCliente.SelectedItem).Id,
                                       ((PrestamoTipo)lstPrestamoTipo.SelectedItem).Id,
                                       double.Parse(txtMonto.Text),
                                       (PrestamoTipo)lstPrestamoTipo.SelectedItem));
         prestamoservicio.SimularCuotaCapital(p);
         prestamoservicio.SimularCuotaInteres(p);
         txtMonto.ReadOnly = true;
     }
 }