Beispiel #1
0
  @SuppressWarnings("unchecked")
  private List<StudentQuestion> getChildApplyQuestionCodes(Session session, String c_Code) {

    Query query =
        session.createQuery(
            "select q.studentCode,question "
                + "from StudentAndQuestion as q , QuestionBank as question"
                + " where q.guard = ? and q.studentCode = ? "
                + " and q.questionCode = question.code order by q.studentCode");
    query.setParameter(0, StudentQuestionStatus.ApplyAndNotApprove);
    query.setParameter(1, c_Code);
    List<Object[]> datas = query.list();
    List<StudentQuestion> result = new ArrayList<StudentQuestion>();
    StudentQuestion sq = new StudentQuestion(new Student(c_Code), null);
    result.add(sq);
    for (Object[] data : datas) {
      if (data.length >= 2) {
        Question q =
            QuestionManager.GetInstance().CreateQuestionByQuestionBank((QuestionBank) data[1]);
        result.get(0).getQuestions().add(q);
      }
    }

    return result;
  }
Beispiel #2
0
  public void ApprovedQuestion(String qCode) {
    if (!child.getClass().equals(Student.class)) {
      return;
    }

    Student s = (Student) child;
    QuestionManager.GetInstance().ApprovedQuestion(s.getCode(), qCode);
  }