public void SetSingleCheckFieldValue(string fieldId, Value value) { SingleCheckField field = new SingleCheckField(); field.Id = fieldId; field.SetValue(value); this.fieldMap[fieldId] = field; }
private static SingleCheckField ElementToSingleCheckField(XmlElement fieldElm, string fieldId, string fieldName) { if (fieldElm == null) { return(null); } SingleCheckField singleCheckField = (SingleCheckField)SchemaFactory.CreateField(FieldTypeEnum.SINGLECHECK); singleCheckField.Id = fieldId; singleCheckField.Name = fieldName; //rules XmlElement rulesEle = XmlUtils.GetChildElement(fieldElm, "rules"); if (rulesEle != null) { List <XmlElement> ruleEleList = XmlUtils.GetChildElements(rulesEle, "rule"); foreach (XmlElement ruleEle in ruleEleList) { Rule rule = ElementToRule(ruleEle, singleCheckField.Id); singleCheckField.Add(rule); } } //option XmlElement optionsEle = XmlUtils.GetChildElement(fieldElm, "options"); if (optionsEle != null) { List <XmlElement> optionEleList = XmlUtils.GetChildElements(optionsEle, "option"); foreach (XmlElement optionEleEle in optionEleList) { Option op = ElementToOption(optionEleEle, singleCheckField.Id); singleCheckField.Add(op); } } //property XmlElement propertiesEle = XmlUtils.GetChildElement(fieldElm, "properties"); if (propertiesEle != null) { List <XmlElement> propertyEleList = XmlUtils.GetChildElements(propertiesEle, "property"); foreach (XmlElement propertyEle in propertyEleList) { Property.Property property = ElementToProperty(propertyEle, singleCheckField.Id); singleCheckField.Add(property); } } //defaultValue XmlElement defaultValueEle = XmlUtils.GetChildElement(fieldElm, "default-value"); if (defaultValueEle != null) { Value value = new Value(); String dvalue = defaultValueEle.InnerText; value.PropertyValue = dvalue; singleCheckField.SetDefaultValueDO(value); } //value XmlElement valueEle = XmlUtils.GetChildElement(fieldElm, "value"); if (valueEle != null) { Value value = new Value(); value.PropertyValue = XmlUtils.GetElementValue(valueEle); singleCheckField.SetValue(value); } return(singleCheckField); }