private void btnSimular_Click(object sender, EventArgs e) { string mensaje = ""; List <string> errores = new List <string>(); errores.Add(Validacion.ValidarNumero(txtMonto.Text, "monto")); errores.Add(Validacion.ValidarNumero(txtPlazo.Text, "plazo")); if (errores.Any()) { foreach (string error in errores) { if (error != "") { mensaje += error + "\n"; } } } if (mensaje == "") { Prestamo simulacro = new Prestamo(ObtenerTipoPrestamoSeleccionado(), Convert.ToDouble(txtMonto.Text), Convert.ToInt32(txtMonto.Text)); txtCapital.Text = (simulacro.CuotaCapital()).ToString(); txtInteres.Text = simulacro.CuotaInteres().ToString(); txtCuota.Text = simulacro.Cuota().ToString(); } else { MessageBox.Show(mensaje); } }
private NameValueCollection ReverseMap(Prestamo prestamo) { NameValueCollection n = new NameValueCollection(); n.Add("Linea", prestamo.Linea); n.Add("TNA", prestamo.TNA.ToString()); n.Add("Plazo", prestamo.Plazo.ToString()); n.Add("Monto", prestamo.Monto.ToString()); n.Add("Cuota", prestamo.Cuota().ToString()); n.Add("Usuario", ConfigurationManager.AppSettings["Legajo"]); return(n); }
private void btnSimular_Click(object sender, EventArgs e) { try { VerificarErrores(); Prestamo simulacro = DevolverPrestamoSegunDatos(); txtCapital.Text = (simulacro.CuotaCapital()).ToString(); txtInteres.Text = simulacro.CuotaInteres().ToString(); txtCuota.Text = simulacro.Cuota().ToString(); } catch (FormatException fex) { MessageBox.Show(fex.Message); MessageBox.Show(fex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }