public String adminAddSuccessAction() { if (areaSelectName == null) { FacesContext context = FacesContext.getCurrentInstance(); String bundleName = context.getApplication().getMessageBundle(); ResourceBundle messageBundle = ResourceBundle.getBundle( bundleName, context.getViewRoot().getLocale(), Thread.currentThread().getContextClassLoader()); String prompt = messageBundle.getString("selectArea"); FacesUtils.addErrorMessage(prompt); return null; } else { Administrator admin = new Administrator(); String condition = " name ='" + this.areaSelectName + "'"; area_admin = this.serviceLocator.getAreaService().queryAreaByCondition(condition).get(0); admin.setAdr(adr_admin); admin.setArea(area_admin); admin.setEmail(email_admin); admin.setName(name_admin); admin.setTel(tel_admin); this.serviceLocator.getAdminService().saveAdministrator(admin); return NavigationResults.ADMINADDSUCCESSACTION; } }
public String adminEditAction() { administratorId = Integer.parseInt(FacesUtils.getRequestParameter("adminId")); Administrator admin = this.serviceLocator.getAdminService().queryAdministratorById(administratorId); area_admin = admin.getArea(); areaSelectName = area_admin.getName(); name_admin = admin.getName(); tel_admin = admin.getTel(); adr_admin = admin.getAdr(); email_admin = admin.getEmail(); return NavigationResults.ADMINEDITACTION; }
public String adminEditSuccessAction() { Administrator admin = this.serviceLocator.getAdminService().queryAdministratorById(administratorId); String condition = " name ='" + this.areaSelectName + "'"; area_admin = this.serviceLocator.getAreaService().queryAreaByCondition(condition).get(0); admin.setAdr(adr_admin); admin.setArea(area_admin); admin.setEmail(email_admin); admin.setName(name_admin); admin.setTel(tel_admin); this.serviceLocator.getAdminService().saveAdministrator(admin); return NavigationResults.ADMINEDITSUCCESSACTION; }