Example #1
0
  @RequestMapping(value = "/getListeNoteEleveByAjax", method = RequestMethod.GET)
  @ResponseBody
  public String getListeNoteEleve(Model uiModel, HttpServletRequest httpServletRequest) {

    long inscription = Long.parseLong(httpServletRequest.getParameter("inscription"));

    long evaluation = Long.parseLong(httpServletRequest.getParameter("evaluation"));

    List<Notes> listeN =
        Notes.getListeNoteEleve(
                Inscription.findInscription(inscription), Evaluation.findEvaluation(evaluation))
            .getResultList();

    return Notes.toJsonArray(listeN);
  }
Example #2
0
  @RequestMapping(value = "/deleteNoteEleveByAjax", method = RequestMethod.GET)
  @ResponseBody
  public String deleteNoteEleveByAjax(
      @RequestParam(value = "idNote") long idNote,
      @RequestParam(value = "evaluation") long evaluation,
      @RequestParam(value = "inscription") long inscription,
      Model uiModel,
      HttpServletRequest httpServletRequest) {

    Notes.findNotes(idNote).remove();

    List<Notes> listeN =
        Notes.getListeNoteEleve(
                Inscription.findInscription(inscription), Evaluation.findEvaluation(evaluation))
            .getResultList();

    return Notes.toJsonArray(listeN);
  }
Example #3
0
  @RequestMapping(value = "/saveNoteEleveByAjax", method = RequestMethod.GET)
  @ResponseBody
  public String saveNoteEleveByAjax(
      @RequestParam(value = "matiere") long matiere,
      @RequestParam(value = "evaluation") long evaluation,
      @RequestParam(value = "inscription") long inscription,
      @RequestParam(value = "noteEtudiant") long value,
      Model uiModel,
      HttpServletRequest httpServletRequest) {

    Notes note;

    Matiere mat = Matiere.findMatiere(matiere);

    Evaluation ev = Evaluation.findEvaluation(evaluation);

    Inscription inscript = Inscription.findInscription(inscription);

    Eleve eleve = inscript.getEleve();

    note = Notes.findNote(mat, ev, inscript);

    if (value > 20) {

      return null;
    }

    if (note == null) {

      note = new Notes();

      note.setCoefficient(mat.getCoefficient());

      note.setMatiere(mat);

      note.setDateSaisie(new Date());

      note.setEleve(eleve);

      note.setInscripionEleve(inscript);

      note.setEvaluation(ev);

      note.setPourcentage(ev.getPourcentage());

      note.setValeur(value);

      note.setEtablissement(ev.getEtablissement());

      note.setAgentSaisie(SecurityUtil.getUserName());

      note.persist();

    } else {

      note.setCoefficient(mat.getCoefficient());

      note.setMatiere(mat);

      note.setEleve(eleve);

      note.setInscripionEleve(inscript);

      note.setEvaluation(ev);

      note.setPourcentage(ev.getPourcentage());

      note.setValeur(value);

      note.setEtablissement(ev.getEtablissement());

      note.setDateUpdate(new Date());

      note.setAgentUpdate(SecurityUtil.getUserName());

      note.merge();
    }

    List<Notes> listeN =
        Notes.getListeNoteEleve(
                Inscription.findInscription(inscription), Evaluation.findEvaluation(evaluation))
            .getResultList();

    return Notes.toJsonArray(listeN);
  }