public static Operation.Filter.Group LoadGroupFilterFromXML(Node node, XmlElement root) { string colName; if (DebugUtility.TryGetMandatoryXmlAttribute(root, "column", out colName)) { var order = SortOrderString.StringToSortOrder(root.GetAttribute("order"), SortOrder.Ascending); Operation.Filter.Group g = new Operation.Filter.GroupByColumnName(colName, order); g.SubGroupFilter = LoadSubFilterFromXML(node, root); return(g); } return(null); }
public static Operation.Filter.Sort LoadSortFilterFromXML(Node node, XmlElement root) { Database.Operation.Filter.Sort f = new Operation.Filter.Sort(); // if the element has children, do not process it as a sort level. if (root.ChildNodes.Count == 0) { string colName; string strOrder; if (DebugUtility.TryGetMandatoryXmlAttribute(root, "column", out colName) && DebugUtility.TryGetMandatoryXmlAttribute(root, "order", out strOrder)) { SortOrder order = SortOrderString.StringToSortOrder(strOrder, SortOrder.Ascending); f.SortLevel.Add(new Operation.Filter.Sort.LevelByName(colName, order)); } } //Process children as sort level foreach (XmlNode xNode in root.ChildNodes) { if (xNode.NodeType == XmlNodeType.Element) { XmlElement e = (XmlElement)xNode; if (e.Name == "Level") { string colNameL; string strOrderL; if (DebugUtility.TryGetMandatoryXmlAttribute(e, "column", out colNameL) && DebugUtility.TryGetMandatoryXmlAttribute(e, "order", out strOrderL)) { var orderL = SortOrderString.StringToSortOrder(strOrderL, SortOrder.Ascending); f.SortLevel.Add(new Operation.Filter.Sort.LevelByName(colNameL, orderL)); } } else { //DebugUtility.LogInvalidXmlChild(root, e); } } } if (f.SortLevel.Count == 0) { return(null); } return(f); }