Exemple #1
0
  @RequestMapping(method = RequestMethod.GET, value = "/showViewAllEvents")
  public String showAllEvents(WebRequest request) {

    eventsService = (EventsService) AppContext.APPCONTEXT.getBean(ContextIdNames.EVENT_SERVICE);
    eventsList = eventsService.getAll();
    activeEventsList = new ArrayList<Events>();
    for (Events evnt : eventsList) {
      if (evnt.getActive().equals(Short.parseShort("1"))) {
        activeEventsList.add(evnt);
      }
    }
    request.setAttribute("eventsList", activeEventsList, WebRequest.SCOPE_REQUEST);

    return "master/viewAllEvents";
  }
Exemple #2
0
  @RequestMapping(method = RequestMethod.GET, value = "/cancelEvent/{id}")
  public String cancelEvent(@PathVariable Long id, WebRequest request) {

    date = (Date) AppContext.APPCONTEXT.getBean(ContextIdNames.DATE);
    appUser = (AppUser) request.getAttribute("user", WebRequest.SCOPE_SESSION);
    eventsService = (EventsService) AppContext.APPCONTEXT.getBean(ContextIdNames.EVENT_SERVICE);
    Events events1 = eventsService.findById(id);
    events = (Events) AppContext.APPCONTEXT.getBean(ContextIdNames.EVENTS);
    events.setId(events1.getId());
    events.setGuid(events1.getGuid());
    events.setEventName(events1.getEventName());
    events.setEventLocation(events1.getEventLocation());
    events.setEventOn(events1.getEventOn());
    events.setEventTime(events1.getEventTime());
    events.setEventType(events1.getEventType());
    events.setAdditionalInfo(events1.getAdditionalInfo());
    events.setCreatedBy(events1.getCreatedBy());
    events.setCreatedOn(events1.getCreatedOn());
    events.setModifiedBy(appUser.getId());
    events.setModifiedOn(date);
    events.setActive(Short.parseShort("0"));
    eventsService.create(events);

    eventsList = eventsService.getAll();
    activeEventsList = new ArrayList<Events>();
    for (Events evnt : eventsList) {
      if (evnt.getActive().equals(Short.parseShort("1"))) {
        activeEventsList.add(evnt);
      }
    }
    request.setAttribute(
        "successCancelEvent",
        events1.getEventName() + " Is Successfully Canceled",
        WebRequest.SCOPE_REQUEST);
    request.setAttribute("eventsList", activeEventsList, WebRequest.SCOPE_REQUEST);

    return "master/viewAllEvents";
  }