public DependGroup AddDependGroup(string fieldId, string value) { DependGroup dependGroup = new DependGroup(); DependExpress dependExpress = dependGroup.AddDependExpress(); dependExpress.FieldId = fieldId; dependExpress.Value = value; this.SetDependGroup(dependGroup); return(dependGroup); }
/** * xml Element to DependGroup * @param dependGroupEle * @param fieldId * @return * @throws TopSchemaException */ private static DependGroup ElementToDependGroup(XmlElement dependGroupEle, string fieldId) { if (dependGroupEle == null) { return(null); } String dependGroupOperator = XmlUtils.GetAttributeValue(dependGroupEle, "operator"); if (StringUtil.IsEmpty(dependGroupOperator)) { dependGroupOperator = "and"; } DependGroup dg_result = new DependGroup(); dg_result.Operators = dependGroupOperator; List <XmlElement> deEleList = XmlUtils.GetChildElements(dependGroupEle, "depend-express"); foreach (XmlElement deEle in deEleList) { DependExpress de = new DependExpress(); String deFieldId = XmlUtils.GetAttributeValue(deEle, "fieldId"); String deValue = XmlUtils.GetAttributeValue(deEle, "value"); String deSymbol = XmlUtils.GetAttributeValue(deEle, "symbol"); de.FieldId = deFieldId; de.Value = deValue; de.Symbol = deSymbol; dg_result.Add(de); } List <XmlElement> dgEleList = XmlUtils.GetChildElements(dependGroupEle, "depend-group"); foreach (XmlElement dgSubEle in dgEleList) { DependGroup subGroup = new DependGroup(); subGroup = ElementToDependGroup(dgSubEle, fieldId); dg_result.Add(subGroup); } return(dg_result); }