private static bool Insertar(Mora moras) { bool paso = false; Contexto db = new Contexto(); try { if (db.mora.Add(moras) != null) { foreach (var item in moras.MorasDetalles) { db.Prestamoss.Find(item.PrestamoId).Balance += item.Valor; } } paso = db.SaveChanges() > 0; } catch (Exception) { throw; } finally { db.Dispose(); } return(paso); }
private static bool Insertar(Prestamos prestamo) { Persona persona = new Persona(); bool paso = false; Contexto contexto = new Contexto(); Mora mora = new Mora(); MoraDetalle moraDetalle = new MoraDetalle(); try { if (contexto.prestamos.Add(prestamo) != null) { contexto.personas.Find(prestamo.PersonaId).Balance += prestamo.Monto; paso = contexto.SaveChanges() > 0; } } catch (Exception) { throw; } finally { contexto.Dispose(); } return(paso); }
private static bool Modificar(Mora mora) { bool paso = false; Contexto contexto = new Contexto(); try { //busca la entidad en la base de datos y la elimina contexto.Database.ExecuteSqlRaw($"Delete FROM TareasDetalle Where TareaId={mora.MoraId}"); foreach (var item in mora.Detalle) { contexto.Entry(item).State = EntityState.Added; } //marcar la entidad como modificada para que el contexto sepa como proceder contexto.Entry(mora).State = EntityState.Modified; paso = contexto.SaveChanges() > 0; } catch (Exception) { throw; } finally { contexto.Dispose(); } return(paso); }
public void BuscarTest() { Mora mora = new Mora(); mora = MoraBLL.Buscar(1); Assert.IsNotNull(mora); }
public static bool Eliminar(int id) { bool paso = false; Contexto db = new Contexto(); try { Mora moras = db.mora.Where(e => e.MoraId == id).Include(d => d.MorasDetalles).FirstOrDefault(); foreach (var item in moras.MorasDetalles) { db.Prestamoss.Find(item.PrestamoId).Balance -= item.Valor; } db.mora.Remove(moras); paso = db.SaveChanges() > 0; } catch (Exception) { throw; } finally { db.Dispose(); } return(paso); }
private static bool Modificar(Mora mora) { bool paso = false; Contexto db = new Contexto(); try { db.Database.ExecuteSqlRaw($"Delete FROM MoraDetalle Where MoraId = {mora.MoraId}"); foreach (var item in mora.MoraDetalle) { db.Entry(item).State = EntityState.Added; } db.Entry(mora).State = EntityState.Modified; paso = db.SaveChanges() > 0; } catch (Exception) { throw; } finally { db.Dispose(); } return(paso); }
private static bool Insertar(Mora mora) { bool paso = false; Contexto contexto = new Contexto(); try { foreach (var item in mora.MoraDetalles) { var auxPrestamo = contexto.Prestamos.Find(item.PrestamoId); if (auxPrestamo != null) { auxPrestamo.Balance += item.Valor; contexto.Personas.Find(auxPrestamo.PersonaId).Balance += item.Valor; } } contexto.Moras.Add(mora); paso = contexto.SaveChanges() > 0; } catch (Exception) { throw; } finally { contexto.Dispose(); } return(paso); }
private static bool Modificar(Mora mora) { bool paso = false; var Anterior = Buscar(mora.moraId); Contexto contexto = new Contexto(); try { //aqui borro y disminuyo la mora al prestamo foreach (var item in Anterior.MoraDetalles) { var auxPrestamo = contexto.Prestamos.Find(item.prestamoId); if (!mora.MoraDetalles.Exists(d => d.moraDetalleId == item.moraDetalleId)) { if (auxPrestamo != null) { auxPrestamo.balance -= item.valor; contexto.Personas.Find(auxPrestamo.personaId).balance -= item.valor; } contexto.Entry(item).State = EntityState.Deleted; } } //aqui agrego lo nuevo al detalle foreach (var item in mora.MoraDetalles) { var auxPrestamo = contexto.Prestamos.Find(item.prestamoId); if (item.moraDetalleId == 0) { contexto.Entry(item).State = EntityState.Added; if (auxPrestamo != null) { auxPrestamo.balance += item.valor; contexto.Personas.Find(auxPrestamo.personaId).balance += item.valor; } } else { contexto.Entry(item).State = EntityState.Modified; } } contexto.Entry(mora).State = EntityState.Modified; paso = contexto.SaveChanges() > 0; } catch (Exception) { throw; } finally { contexto.Dispose(); } return(paso); }
public static bool Guardar(Mora mora) { if (!Existe(mora.MoraId))//si no existe insertamos { return(Insertar(mora)); } else { return(Modificar(mora)); } }
public static bool Modificar(Mora mora) { bool paso = false; Contexto contexto = new Contexto(); var anterior = Buscar(mora.MoraId); try { foreach (var item in anterior.moradetalles) { var aux = contexto.prestamos.Find(item.PrestamoId); if (!mora.moradetalles.Exists(d => d.MoraId == item.MoraId)) { if (aux != null) { aux.Monto -= item.Valor; contexto.personas.Find(aux.PersonaId).Balance -= item.Valor; } contexto.Entry(item).State = EntityState.Deleted; } } foreach (var item in mora.moradetalles) { var aux = contexto.prestamos.Find(item.PrestamoId); if (item.MoraId == 0) { contexto.Entry(item).State = EntityState.Added; if (aux != null) { aux.Monto += item.Valor; contexto.personas.Find(aux.PersonaId).Balance += item.Valor; } } else { contexto.Entry(item).State = EntityState.Modified; } } contexto.Entry(mora).State = EntityState.Modified; paso = contexto.SaveChanges() > 0; } catch (Exception) { throw; } finally { contexto.Dispose(); } return(paso); }
public void GuardarMora() { Mora mo = new Mora(); mo.Cantidad = Convert.ToSingle(tbxAgregarMora.Text); mo.Fecha = Utilitario.FormatoFecha(DateTime.Now.ToString()); mo.PrestamoId = Convert.ToInt32(tbxPrestamo.Text); mo.Estado = 0; if (mo.Insertar("Mora")) { Utilitario.ShowToastr(this, "MoraAgregada", "Mensaje", "success"); } }
public static bool Modificar(Mora mora) { bool paso = false; Contexto db = new Contexto(); try { Mora mora_anterior = db.mora.Where(e => e.MoraId == mora.MoraId) .Include(d => d.MorasDetalles) .FirstOrDefault(); db = new Contexto(); foreach (var item in mora_anterior.MorasDetalles) { if (!mora.MorasDetalles.Any(d => d.Id == item.Id)) { db.Prestamoss.Find(item.PrestamoId).Balance -= item.Valor; db.Entry(item).State = EntityState.Deleted; } } foreach (var item in mora.MorasDetalles) { if (item.Id == 0) { db.Prestamoss.Find(item.PrestamoId).Balance += item.Valor; db.Entry(item).State = EntityState.Added; } else { db.Entry(item).State = EntityState.Modified; } } db.Entry(mora).State = EntityState.Modified; paso = db.SaveChanges() > 0; } catch (Exception) { throw; } finally { db.Dispose(); } return(paso); }
public void ModificarTest() { bool paso = false; MoraDetalle moraDetalle = new MoraDetalle(1, 1, 1, Convert.ToDecimal(100.00)); List <MoraDetalle> list = new List <MoraDetalle>(); list.Add(moraDetalle); Mora mora = new Mora(); mora.MoraId = 1; mora.Fecha = DateTime.Now; mora.Total = Convert.ToDecimal(130.00); paso = MoraBLL.Modificar(mora); Assert.AreEqual(paso, true); }
private void EliminarBoton_Click(object sender, RoutedEventArgs e) { Mora existe = MoraBLL.Buscar(mora.MoraId); if (existe == null) { MessageBox.Show("No existe la tarea en la base de datos", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { MoraBLL.Eliminar(mora.MoraId); MessageBox.Show("Eliminado", "Exito", MessageBoxButton.OK, MessageBoxImage.Information); Limpiar(); } }
private void BuscarBoton_Click(object sender, RoutedEventArgs e) { Mora encontrado = MoraBLL.Buscar(Convert.ToInt32(MoraIdTextBox.Text)); if (encontrado != null) { mora = encontrado; Cargar(); MessageBox.Show("Mora encontrada", "Exito", MessageBoxButton.OK, MessageBoxImage.Information); } else { Limpiar(); MessageBox.Show("Mora no existe en la base de datos", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void GuardarTest() { Mora mora = new Mora(); mora.moraId = 0; mora.fecha = DateTime.Now; mora.total = 10; mora.MoraDetalles.Add(new MoraDetalle { moraDetalleId = 0, moraId = mora.moraId, prestamoId = 1, valor = 10 }); Assert.IsTrue(MoraBLL.Guardar(mora)); }
public void GuardarTest() { Mora mora = new Mora(); mora.MoraId = 0; mora.Fecha = DateTime.Now; mora.Total = 10; mora.MoraDetalle.Add(new MorasDetalle { MoraDetalleId = 0, MoraId = mora.MoraId, PrestamoId = 1, Valor = 10 }); Assert.IsTrue(MoraBLL.Guardar(mora)); }
public void GuardarTest() { bool paso = false; Mora mora = new Mora(); mora.MoraId = 0; mora.Fecha = DateTime.Now; mora.Total = 10; mora.MoraDetalle.Add(new MoraDetalle { MoraDetalleId = 0, MoraId = mora.MoraId, PrestamoId = 1, Monto = 10 }); Assert.IsTrue(MorasBLL.Guardar(mora)); }
public static Mora Buscar(int id) { Contexto db = new Contexto(); Mora mora = new Mora(); try { mora = db.Moras.Where(m => m.MoraId == id).Include(m => m.MoraDetalle).FirstOrDefault(); } catch (Exception) { throw; } finally { db.Dispose(); } return(mora); }
private static bool Insertar(Mora mora) { bool paso = false; Contexto db = new Contexto(); try { db.Moras.Add(mora); paso = db.SaveChanges() > 0; } catch (Exception) { throw; } finally { db.Dispose(); } return(paso); }
/// <summary> /// Permite guardar una entidad en la base de datos /// </summary> /// <param name="tarea">La entidad que se desea guardar</param> private static bool Insertar(Mora mora) { bool paso = false; Contexto contexto = new Contexto(); try { //Agregar la entidad que se desea insertar al contexto contexto.Mora.Add(mora); paso = contexto.SaveChanges() > 0; } catch (Exception) { throw; } finally { contexto.Dispose(); } return(paso); }
public static Mora Buscar(int id) { Mora tarea = new Mora(); Contexto contexto = new Contexto(); try { tarea = contexto.Mora.Include(x => x.Detalle) .Where(x => x.MoraId == id) .SingleOrDefault(); } catch (Exception) { throw; } finally { contexto.Dispose(); } return(tarea); }
/// <summary> /// /// </summary> /// <param name="mora"></param> public void addMora(Mora mora) { try { Con = openBd(); comand = Con.CreateCommand(); comand.CommandText = "INSERT INTO mora(idMora, idPrestamoLibro, moraCancelada) " + "VALUES (null, @idPrestamoLibro, 'No')"; comand.Prepare(); comand.Parameters.AddWithValue("@idPrestamoLibro", mora.PrestamoLibro.IdPrestamoLibro); comand.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("El error es " + ex); } finally { closeBd(); } }
public static Mora Buscar(int id) { Contexto db = new Contexto(); Mora moras = new Mora(); try { moras = db.mora.Where(o => o.MoraId == id) .Include(o => o.MorasDetalles) .SingleOrDefault(); } catch (Exception) { throw; } finally { db.Dispose(); } return(moras); }
/// <summary> /// /// </summary> /// <param name="mora"></param> public void solventarMora(Mora mora) { try { Con = openBd(); comand = Con.CreateCommand(); comand.CommandText = "UPDATE mora SET moraCancelada = 'Si', cantidadMora = 5.00, " + "fechaPagoMora = @fechaPagoMora " + "WHERE idMora = @idMora"; comand.Prepare(); comand.Parameters.AddWithValue("@fechaPagoMora", mora.FechaPagoMora); comand.Parameters.AddWithValue("@idMora", mora.IdMora); comand.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("Error al actualizar " + ex); } finally { closeBd(); } }
public void AplicarMora(int condicion, int cuota) { Mora Mo = new Mora(); string FechaInicio = ""; int cuota2 = 0; float auxCuota = 0; int cantidad = 0; float CantidadCuotaPrestamo = 0; //ESTA ES LA CANTIDAD DE $ CUOTA REGITRADA EN EL PRESTAMO DataTable dt = new DataTable(); DataTable dt2 = new DataTable(); dt = Utilitario.Lista(" FechaInicio,Cuota", " from Prestamo ", " where PrestamoId = " + tbxPrestamo.Text); dt2 = Utilitario.Lista(" Max(Fecha) as Fecha ", " from Abono ", " where PrestamoId = " + tbxPrestamo.Text); FechaInicio = Utilitario.FormatoFecha(dt.Rows[0]["FechaInicio"].ToString()); DateTime DateFechaInicio = Convert.ToDateTime(FechaInicio); cuota2 = Convert.ToInt32(dt.Rows[0]["Cuota"].ToString()); string valortbla = dt2.Rows[0]["Fecha"].ToString(); if (valortbla != string.Empty) // ESTA CONDICIO ES SI HAY ABONO REGISTRADA PARA COMPARAR APARTIR DE AHI { DateTime FechaUltimaCuota = Convert.ToDateTime(dt2.Rows[0]["Fecha"].ToString()); auxCuota = Utilitario.Cuota(cuota, DateTime.Now, DateFechaInicio); } else { auxCuota = Utilitario.Cuota(cuota, DateTime.Now, DateFechaInicio); //ES ES SI HAY RETRASO APARTIR DEL DIA DEL PRESTAMO } cantidad = CantidadCuota(auxCuota, cuota2); Mo.ClienteId = Convert.ToInt32(tbxCliente.Text); Mo.PrestamoId = Convert.ToInt32(tbxPrestamo.Text); Mo.Fecha = Utilitario.FormatoFecha(DateTime.Now.ToString()); CantidadCuotaPrestamo = Convert.ToSingle(tbxCuota.Text); int UsuarioId = Utilitario.ObtenerIdUsuarioAdm(Convert.ToInt32(Session["UsuarioCoId"])); //AQUI HAY QUE EXTRAER EL USUARIO if (cantidad == 0) { Mo.Cantidad = CantidadCuotaPrestamo + Utilitario.PorcientoMora(CantidadCuotaPrestamo, UsuarioId); //AQUI SE MULTIPICA EL PORCIENTO DE LA MORA + LA CUOTA tbxAtraso.Text = Mo.Cantidad.ToString("N2"); } else { Mo.Cantidad = CantidadCuotaPrestamo + Utilitario.PorcientoMora(CantidadCuotaPrestamo, UsuarioId) * cantidad; //AQUI SE MULTIPICA EL PORCIENTO DE LA MORA + LA CUOTA X LA CANTIDAD DE TIEMPO DE CUOTA tbxAtraso.Text = Mo.Cantidad.ToString("N2"); } if (condicion == 0) { Mo.Insertar("MoraAcumulada"); } else { //ESTO ES PARA NO BORRAR LA FECHA DESDE CUANDO COMENZO A ACUMULAR MORA dt2 = Utilitario.Lista(" Fecha ", " from MoraAcumulada ", " where PrestamoId = " + tbxPrestamo.Text); if (Utilitario.ValidarTabla(dt2)) { Mo.Fecha = Utilitario.FormatoFecha(dt2.Rows[0]["Fecha"].ToString()); Mo.Actualizar("MoraAcumulada"); } } }
private void Limpiar() { this.mora = new Mora(); this.DataContext = mora; }
private void btnSiguiente_Click(object sender, EventArgs e) { Clientes.ClientesE clientes = new Clientes.ClientesE(); Prestamo.PrestamoE prestamos = new Prestamo.PrestamoE(); HistorialClientes.HistorialE historial = new HistorialClientes.HistorialE(); Prestamo objPrestamo = new Prestamo(); Clientes objClientes = new Clientes(); HistorialClientes objHistorial = new HistorialClientes(); if (flag == -1) { Application.Exit(); } if (flag == 5) { tabControl1.TabPages.Add(TabResumen); tabControl1.SelectedTab = TabResumen; PagoxMes = (PrestamoSolicitado / MesesPlazo) * (1 + TasaInteres); lblHola.Text = "Hola " + Nombre + " " + Apellido; lblRPrestamo.Text = "Tu prestamo por US$" + PrestamoSolicitado.ToString("N2") + " durante " + MesesPlazo + " Meses"; lblCuota.Text = "Con una cuota mensual de US$" + PagoxMes.ToString("N2"); lblRComision.Text = "Comision: " + (Comision * 100).ToString("N2") + "%"; lblRTasaInteres.Text = "Tasa Interes: " + (TasaInteres * 100).ToString("N2") + "%"; lblRSeguro.Text = "Seguro: " + (Seguro * 100).ToString("N2") + "%"; lblRMora.Text = "Mora : US$" + Mora.ToString("N2"); flag = 6; return; } if (flag == 6) { //Cliente clientes.Nombre = Nombre; clientes.Apellidos = Apellido; clientes.Rango = Rango; clientes.RangoRiesgo = RangoRiesg; clientes.Telefono = Telefono; clientes.Email = Email; clientes.FechaNacimiento = FechaNac; clientes.Sexo = Sexo; clientes.Cedula = Cedula; clientes.PromedioSalario = Salario; clientes.CotizaINSS = INSS; clientes.NombreEmpresa = Empresa; clientes.MesesLaborando = MesesTrabajados; //Datos Historial Cliente clientes.HijosID = HijosID; clientes.VehiculoID = VehiculoID; clientes.CasadoID = CasadoID; clientes.CasaID = CasaID; objClientes.Guardar(clientes); //Prestamo prestamos.ClienteID = Convert.ToInt32(clientes.IDCliente); prestamos.Prestamo = PrestamoSolicitado; prestamos.Meses = MesesPlazo; prestamos.Comision = (Comision * PrestamoSolicitado); prestamos.PagoxMes = PagoxMes; objPrestamo.Insertar_Prestamo(prestamos); flag = -1; btnSiguiente.Text = "Salir"; lblCuota.Text = "¡Prestamo aplicado, correctamente!" + "\n" + "Clic en Salir para cerrar SEACF"; lblCuota.ForeColor = Color.Green; lblHola.Visible = false; label11.Visible = false; lblRPrestamo.Visible = false; lblRTasaInteres.Visible = false; lblRComision.Visible = false; lblRMora.Visible = false; lblRSeguro.Visible = false; return; } if (flag == 4) { if (Convert.ToDecimal(txtMontoPrestamo.Text) > PrestamosMaximo) { errorProvider1.SetError(txtMontoPrestamo, "El monto solicitado no puede ser mayor a " + "US$" + PrestamosMaximo); return; } else { errorProvider1.SetError(txtMontoPrestamo, ""); tabControl1.TabPages.Add(TabRango); tabControl1.SelectedTab = TabRango; PrestamoSolicitado = Convert.ToDecimal(txtMontoPrestamo.Text); lblCliente.Text = Nombre + " " + Apellido; RangoD obj = new RangoD(); RangoD.RangoE entidad = new RangoD.RangoE(); entidad.Prestamo = PrestamoSolicitado; obj.ObtenerRango(entidad); MesMin = entidad.MesMin; MesMax = entidad.MesMax; Rango = entidad.RangoID; TasaInteres = entidad.TasaInteres; Comision = entidad.Comision; Seguro = entidad.Seguro; Mora = entidad.Mora; for (int i = MesMin; i <= MesMax;) { GridView.Rows.Add(PrestamoSolicitado, i, Comision, TasaInteres, Mora, Seguro); i += 6; } } } if (flag == 1) { txtHijos.Visible = false; if (string.IsNullOrEmpty(txtNombres.Text)) { errorProvider1.SetError(txtNombres, "Ingrese el nombre"); return; } else { errorProvider1.SetError(txtNombres, ""); } if (string.IsNullOrEmpty(txtApellidos.Text)) { errorProvider1.SetError(txtApellidos, "Ingrese el Apellido"); return; } else { errorProvider1.SetError(txtApellidos, ""); } if (string.IsNullOrEmpty(txtTelefono.Text)) { errorProvider1.SetError(txtTelefono, "Ingrese el Telefono"); return; } else { errorProvider1.SetError(txtTelefono, ""); } if (string.IsNullOrEmpty(txtCedula.Text)) { errorProvider1.SetError(txtCedula, "Ingrese la Cedula"); return; } else { errorProvider1.SetError(txtCedula, ""); } if (string.IsNullOrEmpty(Convert.ToString(cbSexo.SelectedItem))) { errorProvider1.SetError(cbSexo, "Seleccione su Sexo"); return; } else { errorProvider1.SetError(cbSexo, ""); } tabControl1.TabPages.Add(TabInfoPersonal); tabControl1.SelectedTab = TabInfoPersonal; return; } if (flag == 2) { if (string.IsNullOrEmpty(Convert.ToString(cbVehiculo.SelectedItem))) { errorProvider1.SetError(cbVehiculo, "Seleccione si posee vehiculo"); return; } else { errorProvider1.SetError(cbVehiculo, ""); } if (string.IsNullOrEmpty(Convert.ToString(cbCasa.SelectedItem))) { errorProvider1.SetError(cbCasa, "Seleccione si posee casa"); return; } else { errorProvider1.SetError(cbCasa, ""); } tabControl1.TabPages.Add(TabInfoLaboral); tabControl1.SelectedTab = TabInfoLaboral; return; } if (flag == 3) { if (string.IsNullOrEmpty(txtNombreEmpresa.Text)) { errorProvider1.SetError(txtNombreEmpresa, "Ingrese el nombre de la empresa"); return; } else { errorProvider1.SetError(txtNombreEmpresa, ""); } if (string.IsNullOrEmpty(txtSalario.Text)) { errorProvider1.SetError(txtSalario, "Ingrese su salario"); return; } else { errorProvider1.SetError(txtSalario, ""); } if (string.IsNullOrEmpty(txtMesesLaborando.Text)) { errorProvider1.SetError(txtMesesLaborando, "Ingrese la cantidad de meses de laborar"); return; } else { errorProvider1.SetError(txtMesesLaborando, ""); } tabControl1.TabPages.Add(TabResultado); tabControl1.SelectedTab = TabResultado; if (cbHijos.Checked == true) { Hijos = Convert.ToInt32(txtHijos.Text); if (Hijos > 5) { Hijos = 5; } } else if (cbHijos.Checked == false) { Hijos = 0; } if (cbCasado.Checked == true) { Casado = true; } else if (cbCasado.Checked == false) { Casado = false; } if (cbVehiculo.Text == "Sí") { Vehiculo = "Si"; } else if (cbVehiculo.Text == "No") { Vehiculo = "No"; } else if (cbVehiculo.Text == "Si, Aún pagando") { Vehiculo = "Pagando"; } if (cbCasa.Text == "Casa Propia") { Casa = "Propia"; } else if (cbCasa.Text == "Alquilo Casa") { Casa = "Alquila"; } else if (cbCasa.Text == "Pagando Casa") { Casa = "Pagando"; } if (cbINSS.Checked == true) { INSS = true; } else if (cbINSS.Checked == false) { INSS = false; } MesesTrabajados = Convert.ToInt32(txtMesesLaborando.Text); Salario = Convert.ToDecimal(txtSalario.Text); Nombre = txtNombres.Text; Apellido = txtApellidos.Text; Telefono = Convert.ToInt32(txtTelefono.Text); Email = txtEmail.Text; FechaNac = Convert.ToDateTime(dtFechaNac.Value); Sexo = cbSexo.Text; Cedula = txtCedula.Text; INSS = cbINSS.Checked; MesesTrabajados = Convert.ToInt32(txtMesesLaborando.Text); Empresa = txtNombreEmpresa.Text; if ((Salario == 0) || (Salario < 200)) { lblResultado.Text = "Lo sentimos, usted no puede aplicar a un prestamo con nosotros"; lblResultado.Location = new Point(49, 44); lblResultado.ForeColor = Color.Red; flag = -1; btnSiguiente.Text = "Salir"; return; } BDExtRiesgo.BDExtRiesgoE BDEXTRiesgo = new BDExtRiesgo.BDExtRiesgoE(); BDExtRiesgo obj = new BDExtRiesgo(); BDEXTRiesgo.Cedula = txtCedula.Text; obj.ObtenerRangoRiesgo(BDEXTRiesgo); RangoRiesg = BDEXTRiesgo.RangoRiesgo; if (RangoRiesg == 5) { lblResultado.Text = "Lo sentimos, usted no puede aplicar a un prestamo con nosotros"; lblResultado.ForeColor = Color.Red; lblResultado.Location = new Point(49, 44); flag = -1; btnSiguiente.Text = "Salir"; } else if (MesesTrabajados < 6)//No cumple los meses { lblResultado.Text = "Lo sentimos, usted no puede aplicar a un prestamo con nosotros"; lblResultado.ForeColor = Color.Red; lblResultado.Location = new Point(49, 44); flag = -1; btnSiguiente.Text = "Salir"; } else // Aplica al Prestamo { prestamos.CantHijos = Hijos; prestamos.Casado = Casado; prestamos.Vehiculo = Vehiculo; prestamos.Casa = Casa; prestamos.IDRangoRiesgo = RangoRiesg; prestamos.INSS = INSS; prestamos.Salario = Salario; objPrestamo.ObtenerDatos_Prestamo(prestamos); PrestamosMaximo = prestamos.prestamoMaximo; HijosID = prestamos.HijosID; CasadoID = prestamos.CasadoID; CasaID = prestamos.CasaID; VehiculoID = prestamos.VehiculoID; lblResultado.Text = "Felicidades, cumple requisitos para " + "\n" + "un prestamo Maximo por: US$" + PrestamosMaximo; lblResultado.ForeColor = Color.Green; lblResultado.Location = new Point(195, 40); lblPrestamoMax.Visible = true; txtMontoPrestamo.Visible = true; } return; } }