Ejemplo n.º 1
0
  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;
    }
  }
Ejemplo n.º 2
0
  public String areaAddSuccessAction() {
    Area area = new Area();
    if ((areaSelectName == null) || (areaSelectName.equals(""))) {
      // superiorArea = 0;
      FacesContext context = FacesContext.getCurrentInstance();
      String bundleName = context.getApplication().getMessageBundle();
      ResourceBundle messageBundle =
          ResourceBundle.getBundle(
              bundleName,
              context.getViewRoot().getLocale(),
              Thread.currentThread().getContextClassLoader());
      String prompt = messageBundle.getString("selectSuperArea");

      FacesUtils.addErrorMessage(prompt);
      return null;
    } else {
      String condition = "name ='" + this.areaSelectName + "'";
      superiorArea =
          this.serviceLocator.getAreaService().queryAreaByCondition(condition).get(0).getAreaId();

      area.setSuperiorArea(superiorArea);
      area.setName(name);
      area.setIntro(intro);
      area.setPrincipal(principal);
      area.setTel(tel);
      area.setCoordinateX(coordinateX);
      area.setCoordinateY(coordinateY);
      this.serviceLocator.getAreaService().saveArea(area);
      return NavigationResults.AREAADDSUCCESSACTION;
    }
  }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
  public String areaEditAction() {
    String areaId_s = FacesUtils.getRequestParameter("areaId");

    Area area = this.serviceLocator.getAreaService().queryAreaById(Integer.parseInt(areaId_s));
    areaId = area.getAreaId();
    superiorArea = area.getSuperiorArea();
    if (superiorArea == 0) {
      name_edit = "";
    } else {
      // name_edit = this.serviceLocator.getAreaService().queryAreaById(
      //		superiorArea).getName();
      name_edit = "无锡";
    }
    name = area.getName();
    intro = area.getIntro();
    principal = area.getPrincipal();
    tel = area.getTel();
    coordinateX = area.getCoordinateX();
    coordinateY = area.getCoordinateY();
    return NavigationResults.AREAEDITACTION;
  }