Esempio n. 1
0
 public void del() {
   String Codes = $V("Codes");
   if ((Codes.indexOf("\"") >= 0) || (Codes.indexOf("'") >= 0)) {
     this.response.setStatus(0);
     this.response.setMessage("传入ID时发生错误!");
     return;
   }
   Codes = XString.replaceEx(Codes, ",", "','");
   Transaction trans = new Transaction();
   ZDMemberFieldSchema field = new ZDMemberFieldSchema();
   ZDMemberFieldSet set =
       field.query(
           new QueryBuilder(
               "where SiteID = "
                   + ApplicationPage.getCurrentSiteID()
                   + " and Code in ('"
                   + Codes
                   + "')"));
   trans.add(set, OperateType.DELETE);
   if (trans.commit()) {
     this.response.setStatus(1);
     this.response.setMessage("删除成功!");
   } else {
     this.response.setStatus(0);
     this.response.setMessage("操作数据库时发生错误!");
   }
 }
Esempio n. 2
0
 public static ZDMemberSchema setPropValues(ZDMemberSchema member, Mapx map, String SiteID) {
   ZDMemberFieldSchema field = new ZDMemberFieldSchema();
   ZDMemberFieldSet set = field.query(new QueryBuilder(" where SiteID = ?", SiteID));
   for (int i = 0; i < set.size(); i++) {
     String Value = "";
     String RealField = "";
     String Code = "";
     field = new ZDMemberFieldSchema();
     field = set.get(i);
     Code = field.getCode();
     RealField = field.getRealField();
     Value = map.getString("_MC_" + Code);
     map.put(RealField, Value);
   }
   member.setValue(map);
   return member;
 }
Esempio n. 3
0
 public static Mapx initDialog(Mapx params) {
   String Code = params.getString("Code");
   if (XString.isEmpty(Code)) {
     params.put("VerifyType", HtmlUtil.mapxToOptions(VerifyTypeMap));
     params.put("InputType", HtmlUtil.mapxToOptions(InputTypeMap));
     params.put("IsMandatory", HtmlUtil.codeToRadios("IsMandatory", "YesOrNo", "N"));
     params.put("MaxLength", "100");
     params.put("Cols", "265");
     params.put("Rows", "90");
   } else {
     ZDMemberFieldSchema field = new ZDMemberFieldSchema();
     field.setCode(Code);
     field.setSiteID(ApplicationPage.getCurrentSiteID());
     field.fill();
     params = field.toMapx();
     params.put("VerifyType", HtmlUtil.mapxToOptions(VerifyTypeMap, field.getVerifyType()));
     params.put("InputType", HtmlUtil.mapxToOptions(InputTypeMap, field.getInputType()));
     params.put(
         "IsMandatory", HtmlUtil.codeToRadios("IsMandatory", "YesOrNo", field.getIsMandatory()));
   }
   return params;
 }
Esempio n. 4
0
  public void add() {
    String hCode = $V("hCode");
    boolean update = false;
    int FieldCount =
        new QueryBuilder(
                "select count(*) from ZDMemberField where SiteID = ?",
                ApplicationPage.getCurrentSiteID())
            .executeInt();
    ZDMemberFieldSchema field = new ZDMemberFieldSchema();
    field.setCode($V("Code").trim());
    field.setSiteID(ApplicationPage.getCurrentSiteID());
    if ((XString.isEmpty(hCode)) && (field.fill())) {
      this.response.setLogInfo(0, "已有相同字段");
      return;
    }
    if ((XString.isNotEmpty(hCode)) && (field.fill())) {
      update = true;
    }
    if (!update) {
      if (FieldCount < 20) {
        int index = 1;
        for (int i = 1; i <= 20; i++) {
          if (new QueryBuilder(
                      "select count(*) from ZDMemberField where SiteID = ? and RealField = 'Prop"
                          + i
                          + "'",
                      ApplicationPage.getCurrentSiteID())
                  .executeInt()
              == 0) {
            index = i;
            break;
          }
        }
        field.setRealField("Prop" + index);
      } else {
        this.response.setLogInfo(0, "达到扩展字段上限");
        return;
      }
    }
    field.setValue(this.request);
    field.setName($V("Name"));
    field.setCode($V("Code"));
    field.setAddUser(User.getUserName());
    field.setAddTime(new Date());

    String defaultValue = field.getDefaultValue();
    defaultValue = defaultValue.replaceAll("  ", ",");
    defaultValue = defaultValue.replaceAll(" ", ",");
    defaultValue = defaultValue.replaceAll("  ", ",");
    defaultValue = defaultValue.replaceAll(" ", ",");
    defaultValue = defaultValue.replaceAll(",,", ",");
    defaultValue = defaultValue.replaceAll(",,", ",");
    defaultValue = defaultValue.replaceAll(",", ",");
    if (XString.isEmpty(defaultValue)) {
      defaultValue = "";
    }
    field.setDefaultValue(defaultValue);

    if (Input.equals(field.getInputType())) {
      field.setColSize(null);
      field.setRowSize(null);
      field.setListOption("");
    } else if (Text.equals(field.getInputType())) {
      field.setListOption("");
    } else if (Selecter.equals(field.getInputType())) {
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setVerifyType(STRING);
    } else if (Radio.equals(field.getInputType())) {
      field.setIsMandatory("N");
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setVerifyType(STRING);
    } else if (Checkbox.equals(field.getInputType())) {
      field.setIsMandatory("N");
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setVerifyType(STRING);
    } else if ((DateInput.equals(field.getInputType()))
        || (TimeInput.equals(field.getInputType()))) {
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setListOption("");
      field.setVerifyType(STRING);
    } else if (HTMLInput.equals(field.getInputType())) {
      field.setIsMandatory("N");
      field.setColSize(null);
      field.setRowSize(null);
      field.setMaxLength(null);
      field.setListOption("");
      field.setVerifyType(STRING);
    }

    Transaction trans = new Transaction();
    if (update) trans.add(field, OperateType.UPDATE);
    else {
      trans.add(field, OperateType.INSERT);
    }
    if (trans.commit()) this.response.setLogInfo(1, "保存会员扩展字段成功!");
    else this.response.setLogInfo(0, "发生错误!");
  }