예제 #1
0
 public void addDivision() {
   try {
     logger.info("addDivision");
     Division model = new Division();
     model.setDivisionName(getDivisionName());
     model.setDivisionShortName(getDivisionShortname());
     if (getId() == 0) {
       divisionService.add(model);
     } else {
       model.setId(getId());
       divisionService.update(model);
     }
     this.setDivisionName("");
     this.setDivisionShortname("");
     FacesContext.getCurrentInstance()
         .addMessage(
             null,
             new FacesMessage(FacesMessage.SEVERITY_INFO, ParameterModel.STATUS_SAVE_SUCCESS, ""));
   } catch (Exception e) {
     e.printStackTrace();
     FacesContext.getCurrentInstance()
         .addMessage(
             null,
             new FacesMessage(FacesMessage.SEVERITY_ERROR, ParameterModel.STATUS_SAVE_FAIL, ""));
   }
 }
예제 #2
0
 public void deleteDiv(int id) {
   Division d = new Division();
   d.setId(id);
   divisionService.delete(d);
   divs = divisionService.getAll();
   FacesContext.getCurrentInstance()
       .addMessage(
           null,
           new FacesMessage(FacesMessage.SEVERITY_INFO, ParameterModel.STATUS_DELETE_SUCCESS, ""));
 }