public ArrayList<ComentarioBean> getAllporusuario(
     int id_usuario,
     ArrayList<FilterBeanHelper> alFilter,
     HashMap<String, String> hmOrder,
     Integer expand)
     throws Exception {
   strSQL =
       "SELECT comentario.* from comentario, amistad where comentario.id_amistad= amistad.id and amistad.id_usuario2="
           + id_usuario;
   strSQL += SqlBuilder.buildSqlOrder(hmOrder);
   ArrayList<ComentarioBean> arrComentario = new ArrayList<>();
   try {
     ResultSet oResultSet = oMysql.getAllSql(strSQL);
     if (oResultSet != null) {
       while (oResultSet.next()) {
         ComentarioBean oComentarioBean = new ComentarioBean();
         arrComentario.add(oComentarioBean.fill(oResultSet, oConnection, expand));
       }
     }
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
   }
   return arrComentario;
 }
Пример #2
0
 @Override
 public ArrayList<TareaBean> getPage(
     int intRegsPerPag,
     int intPage,
     ArrayList<FilterBeanHelper> hmFilter,
     HashMap<String, String> hmOrder,
     Integer expand)
     throws Exception {
   strSQL += SqlBuilder.buildSqlWhere(hmFilter);
   strSQL += SqlBuilder.buildSqlOrder(hmOrder);
   strSQL += SqlBuilder.buildSqlLimit(oMysql.getCount(strSQL), intRegsPerPag, intPage);
   ArrayList<TareaBean> arrTarea = new ArrayList<>();
   try {
     ResultSet oResultSet = oMysql.getAllSql(strSQL);
     if (oResultSet != null) {
       while (oResultSet.next()) {
         TareaBean oTareaBean = new TareaBean();
         arrTarea.add(oTareaBean.fill(oResultSet, oConnection, expand));
       }
     }
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
   }
   return arrTarea;
 }
 public ArrayList<ComentarioBean> getPagexidusuario(
     int id_usuario,
     int intRegsPerPag,
     int intPage,
     ArrayList<FilterBeanHelper> hmFilter,
     HashMap<String, String> hmOrder,
     Integer expand)
     throws Exception {
   // strSQL += SqlBuilder.buildSqlWhere(hmFilter);
   // strSQL += SqlBuilder.buildSqlOrder(hmOrder);
   strSQL =
       "select comentario.id, comentario.texto, comentario.fecha, comentario.id_amistad from comentario, amistad, usuario where ( usuario.id= amistad.id_usuario2) AND amistad.id = comentario.id_amistad AND usuario.id="
           + id_usuario;
   strSQL += SqlBuilder.buildSqlLimit(oMysql.getCount(strSQL), intRegsPerPag, intPage);
   ArrayList<ComentarioBean> arrComentario = new ArrayList<>();
   try {
     ResultSet oResultSet = oMysql.getAllSql(strSQL);
     if (oResultSet != null) {
       while (oResultSet.next()) {
         ComentarioBean oComentarioBean = new ComentarioBean();
         arrComentario.add(oComentarioBean.fill(oResultSet, oConnection, expand));
       }
     }
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
   }
   return arrComentario;
 }
Пример #4
0
 public ArrayList<TareaBean> getAllTareaXCurso(Integer intTarea, Integer expand) throws Exception {
   strSQL += " AND tarea.id_asignaturaevaluacion = " + intTarea;
   ArrayList<TareaBean> arrTarea = new ArrayList<>();
   try {
     ResultSet oResultSet = oMysql.getAllSql(strSQL);
     if (oResultSet != null) {
       while (oResultSet.next()) {
         TareaBean oTareaBean = new TareaBean();
         arrTarea.add(oTareaBean.fill(oResultSet, oConnection, expand));
       }
     }
   } catch (Exception ex) {
     ExceptionBooster.boost(
         new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
   }
   return arrTarea;
 }
Пример #5
0
 @Override
 public TareaBean get(TareaBean oTareaBean, Integer expand) throws Exception {
   if (oTareaBean.getId() > 0) {
     try {
       ResultSet oResultSet = oMysql.getAllSql(strSQL + " And id= " + oTareaBean.getId() + " ");
       if (oResultSet != null) {
         while (oResultSet.next()) {
           oTareaBean = oTareaBean.fill(oResultSet, oConnection, expand);
         }
       }
     } catch (Exception ex) {
       ExceptionBooster.boost(
           new Exception(this.getClass().getName() + ":get ERROR: " + ex.getMessage()));
     }
   } else {
     oTareaBean.setId(0);
   }
   return oTareaBean;
 }
  public int getAmistad(int id_usuario, int id_usuario2) throws Exception {
    int num = 0;

    String consulta =
        "select * from amistad where (id_usuario="
            + id_usuario
            + " and id_usuario2="
            + id_usuario2
            + ")";

    ResultSet oResultSet = oMysql.getAllSql(consulta);

    if (oResultSet != null) {
      while (oResultSet.next()) {
        num = oResultSet.getInt("id");
      }
    }
    return num;
  }
  public int getmensajesnuevos(int id_usuario) throws Exception {

    int num = 0;

    strSQL =
        "select count(*) as total from comentario, amistad, usuario where usuario.id= amistad.id_usuario AND amistad.id = comentario.id_amistad AND amistad.id_usuario2="
            + id_usuario
            + " and comentario.leido=0";
    try {
      ResultSet oResultSet = oMysql.getAllSql(strSQL);
      if (oResultSet != null) {
        while (oResultSet.next()) {
          num = oResultSet.getInt("total");
        }
      }
    } catch (Exception ex) {
      ExceptionBooster.boost(
          new Exception(this.getClass().getName() + ":getPage ERROR: " + ex.getMessage()));
    }
    return num;
  }