コード例 #1
0
  @Listen("onClick=#saveBtn")
  public void addCodeDb() {
    try {
      Map<String, String> map = new HashMap<String, String>();
      map = ZkUtils.getExecutionArgs();
      ErmCodeDb ermCodeDb = new ErmCodeDb();
      List<ErmCodeDb> codeDbList =
          ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService")).findAllCodeDb(webEmployee);
      String tempId = "OB";
      Long number = (long) codeDbList.size();
      number = number + 1;
      String dbId = tempId + RandomIDGenerator.fmtLong(number, 9);
      ermCodeDb.setDbId(dbId);
      aDbId = dbId;
      dbIdTxt.setValue(dbId);
      if (dbNameTxt.getValue() != null && !"".equals(dbNameTxt.getValue())) {
        ermCodeDb.setName(dbNameTxt.getValue());
      } else {
        ZkUtils.showExclamation(
            Labels.getLabel("webErwSource.nameZhTw") + " " + Labels.getLabel("cannottNull"),
            Labels.getLabel("warn"));
        dbNameTxt.focus();
        return;
      }
      if (resourcesIdTxt.getValue() != null) {
        ermCodeDb.setResourcesId(resourcesIdTxt.getValue());
      }
      ermCodeDb.setHistory("N");
      if (ezproxyRdo.getSelectedItem().getValue() != null) {
        ermCodeDb.setEzproxy(ezproxyRdo.getSelectedItem().getValue().toString());
      }
      if (urlTxt.getValue() != null && !"".equals(urlTxt.getValue())) {
        ermCodeDb.setUrl(urlTxt.getValue());
      }
      if (orderNoIbx.getValue() != null) {
        ermCodeDb.setOrderNo(orderNoIbx.getValue());
      }
      ermCodeDb.setIsDataEffid(1);
      ermCodeDb.setWebEmployee(webEmployee);
      ermCodeDb.setCreateDate(new Date());
      ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService")).saveCodeDb(ermCodeDb);

      ((WebSysLogService) SpringUtil.getBean("webSysLogService"))
          .insertLog(
              ZkUtils.getRemoteAddr(),
              ermCodeDb.getWebEmployee().getEmployeesn(),
              "codeDb_" + ermCodeDb.getDbId());
      ZkUtils.showInformation(Labels.getLabel("saveOK"), Labels.getLabel("info"));
      dbIdTxt.setValue(ermCodeDb.getDbId());
      addSuunitBtn.setDisabled(false);
      delSuunitBtn.setDisabled(false);
      String url = "ermCodeDb/ermCodeDb.zul";
      ZkUtils.refurbishMethod(url);

    } catch (WrongValueException e) {
      log.error("新增資料庫異常" + e);
    }
  }
コード例 #2
0
  @Listen("onClick=#editBtn")
  public void editCodeDb() {
    try {
      List<ErmCodeDb> codeDbList =
          ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService")).findAllCodeDb(webEmployee);
      String tempId = "OB";
      Long number = (long) codeDbList.size();
      number = number + 1;
      String dbId = tempId + RandomIDGenerator.fmtLong(number, 9);
      if (!aDbId.equals("") && aDbId != null) {
        codeDb.setDbId(aDbId);
      } else {
        codeDb.setDbId(dbId);
      }
      aDbId = dbId;
      dbIdTxt.setValue(dbId);
      if (dbNameTxt.getValue() != null && !"".equals(dbNameTxt.getValue())) {
        codeDb.setName(dbNameTxt.getValue());
      } else {
        ZkUtils.showExclamation(
            Labels.getLabel("webErwSource.nameZhTw") + " " + Labels.getLabel("cannottNull"),
            Labels.getLabel("warn"));
        dbNameTxt.focus();
        return;
      }
      if (resourcesIdTxt.getValue() != null) {
        codeDb.setResourcesId(resourcesIdTxt.getValue());
      }
      codeDb.setHistory("N");
      if (ezproxyRdo.getSelectedItem().getValue() != null) {
        codeDb.setEzproxy(ezproxyRdo.getSelectedItem().getValue().toString());
      }
      if (urlTxt.getValue() != null && !"".equals(urlTxt.getValue())) {
        codeDb.setUrl(urlTxt.getValue());
      }
      if (orderNoIbx.getValue() != null) {
        codeDb.setOrderNo(orderNoIbx.getValue());
      }
      codeDb.setIsDataEffid(1);
      codeDb.setLatelyChangedDate(new Date());
      codeDb.setLatelyChangedUser(webEmployee.getEmployeesn());
      ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService")).saveCodeDb(codeDb);
      ((WebSysLogService) SpringUtil.getBean("webSysLogService"))
          .editLog(
              ZkUtils.getRemoteAddr(),
              codeDb.getWebEmployee().getEmployeesn(),
              "codeDb_" + codeDb.getDbId());

      ZkUtils.showInformation(Labels.getLabel("saveOK"), Labels.getLabel("info"));
      Listbox resCodeDbLix =
          (Listbox) editErmResDataBaseWin.getParent().getFellowIfAny("resCodeDbLix");
      Textbox name = (Textbox) editErmResDataBaseWin.getParent().getFellowIfAny("nameTxt");
      Textbox dbIdParent = (Textbox) editErmResDataBaseWin.getParent().getFellowIfAny("dbIdTxt");
      List<ErmCodeDb> codeDbList1 =
          ((ErmCodeDbService) SpringUtil.getBean("ermCodeDbService"))
              .findPublisherList("", "", name.getValue(), dbIdParent.getValue(), webEmployee);
      ListModelList<ErmCodeDb> model = new ListModelList<ErmCodeDb>(codeDbList1);
      model.setMultiple(true);
      resCodeDbLix.setModel(model);
      resCodeDbLix.setActivePage(Integer.valueOf(currentPage));
      dbIdTxt.setValue(codeDb.getDbId());
      addSuunitBtn.setDisabled(false);
      delSuunitBtn.setDisabled(false);
      /*
       * String url = "ermCodeDb/ermCodeDb.zul";
       * ZkUtils.refurbishMethod(url);
       */

    } catch (WrongValueException e) {
      log.error("新增資料庫異常" + e);
    }
  }