Beispiel #1
0
  @RequestMapping(method = RequestMethod.GET, params = "deleteAttendances=Y")
  public String deletCurrentAttendances(Model model, HttpServletRequest request) {
    Child child = childManager.findChild(Integer.parseInt(request.getParameter("childId")));

    model.addAttribute(
        "attendancesDeleted", attendanceManager.deleteAttendancesForCurrentTerm(child));

    return showForm(model, request);
  }
Beispiel #2
0
  public ModelAndView printRegister(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    List<RegisterReportBean> datasource = new ArrayList<RegisterReportBean>();
    int daysToPrint = Integer.parseInt(request.getParameter("daysToPrint"));
    Date weekStart = MyDateUtils.getDateFromString(request.getParameter("day"), "dd MMM yyyy");
    for (int i = 0; i < daysToPrint; i++) {
      for (String roomId : request.getParameter("roomIds").split(",")) {
        RegisterReportBean bean = new RegisterReportBean();
        bean.setRoom(roomManager.find(Integer.parseInt(roomId)));
        bean.setDay(MyDateUtils.incrementByDays(weekStart, i));
        bean.setAttendances(
            attendanceManager.findAttendancesForDayAndRoom(bean.getRoom().getId(), bean.getDay()));
        if (!CollectionUtils.isEmpty(bean.getAttendances())) {
          datasource.add(bean);
        }
      }
    }

    Map<String, Object> model = new HashMap<String, Object>();
    model.put("dataSource", datasource);

    return new ModelAndView("RegisterCompile", model);
  }