public EventFilter(string XmlElement) { XPathNodeIterator iter = Util.GetXPathIterator("<root>" + XmlElement + "</root>", "/root/filter"); int counter = 0; while (iter.MoveNext()) { XPathNavigator Nav = iter.Current; this.package = Nav.GetAttribute("package", ""); this.Name = Nav.GetAttribute("name", ""); this.FriendlyName = Nav.GetAttribute("friendlyname", ""); this.IsNum = Convert.ToBoolean(Nav.GetAttribute("IsNum", "")); //this.EnabledSQLVersion = Convert.ToInt32(eventNav.GetAttribute("version", "")); XPathNodeIterator iterChoice = Util.GetXPathIterator("<root>" + Nav.OuterXml + "</root>", "//choice"); while (iterChoice.MoveNext()) { ChoiceList.Add(new FilterChoice(iterChoice.Current.OuterXml)); } counter++; } if (counter != 1) { throw new ArgumentException("The XML passed for EventFilter is not valid and should only contain one record"); } }
public FilterChoiceCollection GetFilterChoicesByVersion(string sqlver) { FilterChoiceCollection col = new FilterChoiceCollection(); foreach (FilterChoice ch in this) { if (ch.version == Convert.ToInt32(sqlver)) { col.Add(ch); } } return(col); }