Example #1
0
 public static boolean Actualizar(Usuario usuario) throws Exception {
   boolean eje = false;
   try {
     ArrayList<Parametro> lstP = new ArrayList<Parametro>();
     String sql = "select * from master_movilizacion.f_update_usuario(?,?,?,?,?,?,?,?,?,?,?,?,?)";
     lstP.add(new Parametro(1, usuario.getEstado()));
     lstP.add(new Parametro(2, usuario.getNick()));
     lstP.add(new Parametro(3, usuario.getClave()));
     lstP.add(new Parametro(4, usuario.getNombres()));
     lstP.add(new Parametro(5, usuario.getApellidos()));
     lstP.add(new Parametro(6, usuario.getMail()));
     lstP.add(new Parametro(7, usuario.getPrimer_acceso()));
     lstP.add(new Parametro(8, usuario.getUtimo_acceso()));
     lstP.add(new Parametro(9, usuario.getUltima_ip()));
     lstP.add(new Parametro(10, usuario.getFecha_modificacion()));
     lstP.add(new Parametro(11, usuario.getCodigo_salt()));
     lstP.add(new Parametro(12, usuario.isBool_imagen()));
     lstP.add(new Parametro(13, usuario.getCodigo()));
     ConjuntoResultado rs = AccesoDatos.ejecutaQuery(sql, lstP);
     while (rs.next()) {
       if (rs.getString(0).equals("true")) ;
       eje = true;
     }
   } catch (SQLException exConec) {
     throw new Exception(exConec.getMessage());
   }
   return eje;
 }
Example #2
0
 public static boolean Eliminar(long codigo) throws Exception {
   boolean eje = false;
   try {
     ArrayList<Parametro> lstP = new ArrayList<Parametro>();
     String sql = "select * from master_movilizacion.f_delete_usuario(?)";
     lstP.add(new Parametro(1, codigo));
     ConjuntoResultado rs = AccesoDatos.ejecutaQuery(sql, lstP);
     while (rs.next()) {
       if (rs.getString(0).equals("true")) ;
       eje = true;
     }
   } catch (SQLException exConec) {
     throw new Exception(exConec.getMessage());
   }
   return eje;
 }
Example #3
0
 public static boolean compararAperturaSubidaProformas(long fecha) throws Exception {
   boolean eje = false;
   try {
     ArrayList<Parametro> lstP = new ArrayList<Parametro>();
     String sql = "select * from master_movilizacion.f_comparar_apertura_subida_proformas(?)";
     lstP.add(new Parametro(1, (fecha)));
     ConjuntoResultado rs = AccesoDatos.ejecutaQuery(sql, lstP);
     while (rs.next()) {
       if (rs.getString(0).equals("true")) {
         eje = true;
       } else {
         eje = false;
       }
     }
   } catch (SQLException exConec) {
     throw new Exception(exConec.getMessage());
   }
   return eje;
 }
 public static boolean insertarAbastecimiento(Abastecimiento abastecimiento) throws Exception {
   boolean eje = false;
   try {
     ArrayList<Parametro> lstP = new ArrayList<Parametro>();
     String sql = "select * from subcentro_licto.f_insert_abastecimiento(?,?,?,?,?,?,?)";
     lstP.add(new Parametro(1, abastecimiento.getId_medicamento().getId_medicamento()));
     lstP.add(new Parametro(2, abastecimiento.getId_usuario().getCodigo()));
     lstP.add(new Parametro(3, abastecimiento.getFecha_abastecimiento()));
     lstP.add(new Parametro(4, abastecimiento.getCantidad_global()));
     lstP.add(new Parametro(5, abastecimiento.getUnidad_cantidad_global()));
     lstP.add(new Parametro(6, abastecimiento.getValores_unitarios()));
     lstP.add(new Parametro(7, abastecimiento.getUnidades()));
     ConjuntoResultado rs = AccesoDatos.ejecutaQuery(sql, lstP);
     while (rs.next()) {
       if (rs.getString(0).equals("true")) ;
       eje = true;
     }
   } catch (SQLException exConec) {
     throw new Exception(exConec.getMessage());
   }
   return eje;
 }
Example #5
0
  public static long Insertar(Usuario usuario, long codigoTitular) throws Exception {
    long eje = 0;
    boolean eje1 = false;
    boolean ejef = false;
    Conexion con = new Conexion();
    try {
      if (con.getCon().getAutoCommit()) {
        con.getCon().setAutoCommit(false);
      }
      ArrayList<Parametro> lstP = new ArrayList<Parametro>();
      String sql = "select * from master_movilizacion.f_insert_usuario(?,?,?,?,?,?,?,?,?,?,?,?)";
      lstP.add(new Parametro(1, usuario.getEstado()));
      lstP.add(new Parametro(2, usuario.getNick()));
      lstP.add(new Parametro(3, usuario.getClave()));
      lstP.add(new Parametro(4, usuario.getNombres()));
      lstP.add(new Parametro(5, usuario.getApellidos()));
      lstP.add(new Parametro(6, usuario.getMail()));
      lstP.add(new Parametro(7, usuario.getPrimer_acceso()));
      lstP.add(new Parametro(8, usuario.getUtimo_acceso()));
      lstP.add(new Parametro(9, usuario.getUltima_ip()));
      lstP.add(new Parametro(10, usuario.getFecha_modificacion()));
      lstP.add(new Parametro(11, usuario.getCodigo_salt()));
      lstP.add(new Parametro(12, usuario.isBool_imagen()));
      ConjuntoResultado rs = AccesoDatos.ejecutaQuery(sql, lstP);
      while (rs.next()) {
        if (rs.getLong(0) > 0) ;
        eje = rs.getLong(0);
      }

      ArrayList<Parametro> lstP1 = new ArrayList<Parametro>();
      String sql1 = "select * from master_movilizacion.f_insert_usuario_persona(?,?,?)";
      lstP1.add(new Parametro(1, codigoTitular));
      lstP1.add(new Parametro(2, eje));
      lstP1.add(new Parametro(3, 1));
      ConjuntoResultado rs1 = AccesoDatos.ejecutaQuery(sql1, lstP1);
      while (rs1.next()) {
        if (rs1.getString(0).equals("true")) ;
        eje1 = true;
      }

      if ((eje > 0) && (eje1 == true)) {
        ejef = true;
      } else {
        ejef = false;
      }
      con.getCon().commit();
    } catch (SQLException exConec) {
      con.getCon().rollback();
      throw new Exception(exConec.getMessage());
    }
    return eje;
  }
 public static ArrayList<Abastecimiento> llenarDatos(ConjuntoResultado rs) throws Exception {
   ArrayList<Abastecimiento> lst = new ArrayList<Abastecimiento>();
   Abastecimiento abastecimiento = null;
   try {
     while (rs.next()) {
       abastecimiento =
           new Abastecimiento(
               rs.getInt("pid_abastecimiento"),
               FMedicamento.obtenerMedicamentoDadoCodigo(rs.getInt("pid_medicamento")),
               FUsuario.ObtenerUsuarioDadoCodigo(rs.getInt("pid_usuario")),
               rs.getDate("pfecha_abastecimiento"),
               rs.getInt("pcantidad_global"),
               rs.getString("punidad_cantidad_global"),
               rs.getInt("pvalores_unitarios"),
               rs.getString("punidades"));
       lst.add(abastecimiento);
     }
   } catch (Exception e) {
     lst.clear();
     throw e;
   }
   return lst;
 }
Example #7
0
  public static List<Carta_Compromiso> consulta_carta_compro(String nombre_estudiante)
      throws IOException {
    List<Carta_Compromiso> datos = new LinkedList<Carta_Compromiso>();

    ArrayList<Parametro> parametro = new ArrayList<>();
    String sql =
        "SELECT cc_id, \n"
            + "   es_apellido||' '||es_nombre,\n"
            + "       'PEND',\n"
            + "       cc_lugar_suscripcion, \n"
            + "       to_char(cc_fecha_suscripcion,'dd/mm/yyyy'), \n"
            + "       cc_estado\n"
            + "  FROM \"MPP_CARTA_COMPROMISO\" CC,\n"
            + "       \"MPP_ESTUDIANTES\" ES\n"
            + " WHERE CC.es_id = ES.es_id\n"
            + "   AND (UPPER(es_nombre) LIKE UPPER('%' || ? || '%') \n"
            + "	OR UPPER(es_apellido) LIKE UPPER('%' || ? || '%'))";

    parametro.add(new Parametro(1, nombre_estudiante));
    parametro.add(new Parametro(2, nombre_estudiante));
    Carta_Compromiso carta_comp;
    try {
      ConjuntoResultado cres = AccesoDatos.ejecutaQuery(sql, parametro);

      while (cres.next()) {
        carta_comp = new Carta_Compromiso();
        carta_comp.setId_carta_compromiso(cres.getString(0).trim());
        carta_comp.setNomb_estudiante(cres.getString(1).trim());
        carta_comp.setNomb_empresa(cres.getString(2).trim());
        carta_comp.setLugar_suscripcion(cres.getString(3).trim());
        carta_comp.setFecha_suscripcion(cres.getString(4).trim());
        carta_comp.setEstado(cres.getString(5).trim());
        System.out.println("EST: " + cres.getString(1).trim());
        datos.add(carta_comp);
      }

      // out.println("</table>");
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    return datos;
  }
Example #8
0
 public static ArrayList<Usuario> llenarUsuarios(ConjuntoResultado rs) throws Exception {
   ArrayList<Usuario> lst = new ArrayList<Usuario>();
   Usuario usuario = null;
   try {
     while (rs.next()) {
       usuario =
           new Usuario(
               rs.getLong("pcodigo"),
               rs.getInt("pestado"),
               rs.getString("pnick"),
               rs.getString("pclave"),
               rs.getString("pnombres"),
               rs.getString("papellidos"),
               rs.getString("pmail"),
               rs.getLong("pprimer_acceso"),
               rs.getLong("putimo_acceso"),
               rs.getString("pultima_ip"),
               rs.getLong("pfecha_modificacion"),
               rs.getString("pcodigo_salt"),
               rs.getBoolean("pimagen"));
       lst.add(usuario);
     }
   } catch (Exception e) {
     lst.clear();
     throw e;
   }
   return lst;
 }