From 79aa8098245eb15c868b1a66e9c2e858f8b9dfec Mon Sep 17 00:00:00 2001 From: JoseBaezx Date: Tue, 17 May 2022 12:10:43 -0400 Subject: [PATCH] Correccion filtro por aceptados --- src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java b/src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java index 1fe2cb3..8dc90a5 100644 --- a/src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java +++ b/src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java @@ -73,32 +73,19 @@ import java.util.List; } public static void update(int id, String valor) { - String v = valor; - if (v == "1") { + boolean v = valor.equals("0") ? false : true; + try { Connection con = DataBase.getConnection(); - PreparedStatement ps = con.prepareStatement("update postulante set aceptado= false " + - "where id=?"); - ps.setInt(1, id); + PreparedStatement ps = con.prepareStatement("update postulante set aceptado= ? where id=?"); + ps.setBoolean(1, v); + ps.setInt(2, id); ps.executeUpdate(); con.close(); } catch (Exception ex) { ex.printStackTrace(); } - } else { - try { - Connection con = DataBase.getConnection(); - PreparedStatement ps = con.prepareStatement("update postulante set aceptado= true " + - " where id=?"); - ps.setInt(1, id); - ps.executeUpdate(); - con.close(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - } -- libgit2 0.26.0