public override XmlElement ToParamElement() { XmlElement fieldNode = XmlUtils.CreateRootElement("field"); if (StringUtil.IsEmpty(this.id)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30001, null); } if (StringUtil.IsEmpty(FieldTypeEnumHelper.ToType(this.type))) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30002, this.id); } fieldNode.SetAttribute("id", this.id); fieldNode.SetAttribute("name", this.name); fieldNode.SetAttribute("type", FieldTypeEnumHelper.ToType(this.type)); //sub-value XmlElement complexValuesNode = XmlUtils.AppendElement(fieldNode, "complex-values"); ComplexValue cValue = this.complexValue; foreach (string keyFieldId in cValue.GetFieldKeySet()) { Field field = cValue.GetValueField(keyFieldId); XmlElement valueNode = field.ToParamElement(); XmlUtils.AppendElement(complexValuesNode, valueNode); } return(fieldNode); }
public override XmlElement ToElement() { XmlElement fieldNode = XmlUtils.CreateRootElement("field"); if (StringUtil.IsEmpty(this.id)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30001, null); } if (StringUtil.IsEmpty(FieldTypeEnumHelper.ToType(this.type))) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30002, this.id); } fieldNode.SetAttribute("id", this.id); fieldNode.SetAttribute("name", this.name); fieldNode.SetAttribute("type", FieldTypeEnumHelper.ToType(this.type)); if (this.rules != null && this.rules.Count > 0) { XmlElement rulesNode = XmlUtils.AppendElement(fieldNode, "rules"); foreach (Rule rule in this.rules) { XmlElement ruleNode = rule.ToElement(this.id); XmlUtils.AppendElement(rulesNode, ruleNode); } } if (this.options != null && this.options.Count > 0) { XmlElement optionsNode = XmlUtils.AppendElement(fieldNode, "options"); foreach (Option option in this.options) { XmlElement optionNode = option.ToElement(); XmlUtils.AppendElement(optionsNode, optionNode); } } if (defaultValueField != null) { XmlElement defaultValueEle = this.ToDefaultValueElement(); if (defaultValueEle != null) { XmlUtils.AppendElement(fieldNode, defaultValueEle); } } if (this.properties != null && this.properties.Count > 0) { XmlElement propertiesNode = XmlUtils.AppendElement(fieldNode, "properties"); foreach (Property.Property propertie in this.properties) { XmlElement propertyNode = XmlUtils.AppendElement(propertiesNode, "property"); propertyNode.SetAttribute("key", propertie.Key); propertyNode.SetAttribute("value", propertie.Value); } } return(fieldNode); }
public override XmlElement ToParamElement() { XmlElement fieldNode = XmlUtils.CreateRootElement("field"); if (StringUtil.IsEmpty(this.id)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30001, null); } if (StringUtil.IsEmpty(FieldTypeEnumHelper.ToType(this.type))) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30002, this.id); } fieldNode.SetAttribute("id", this.id); fieldNode.SetAttribute("name", this.name); fieldNode.SetAttribute("type", FieldTypeEnumHelper.ToType(this.type)); return(fieldNode); }
public override XmlElement ToParamElement() { XmlElement fieldNode = XmlUtils.CreateRootElement("field"); if (StringUtil.IsEmpty(this.id)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30001, null); } if (StringUtil.IsEmpty(FieldTypeEnumHelper.ToType(this.type))) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30002, this.id); } fieldNode.SetAttribute("id", this.id); fieldNode.SetAttribute("name", this.name); fieldNode.SetAttribute("type", FieldTypeEnumHelper.ToType(this.type)); XmlElement valuesNode = XmlUtils.AppendElement(fieldNode, "values"); foreach (Value value in values) { XmlElement valueNode = XmlUtils.AppendElement(valuesNode, "value"); valueNode.InnerText = value.PropertyValue; } return(fieldNode); }