private static bool searchPeople(string url, string postData, int personThreshold, compareType type) { String result = prnsAPI.PostForm(url, postData); XmlDocument doc = new XmlDocument(); doc.LoadXml(result); XmlNodeList personList = doc.GetElementsByTagName("PersonList"); int totalCount = Convert.ToInt32(personList[0].Attributes["TotalCount"].Value); switch (type) { case compareType.lessThan: return totalCount < personThreshold; case compareType.lessEqual: return totalCount <= personThreshold; case compareType.equal: return totalCount == personThreshold; case compareType.greaterEqual: return totalCount >= personThreshold; case compareType.greaterThan: return totalCount > personThreshold; } return false; }
private static bool searchPeople(string url, string postData, int personThreshold, compareType type) { String result = PostForm(url, postData); XmlDocument doc = new XmlDocument(); doc.LoadXml(result); XmlNodeList matchesClassGroupsList = doc.GetElementsByTagName("prns:matchesClassGroup"); for (int i = 0; i < matchesClassGroupsList.Count; i++) { string label = ""; string number = ""; for (int j = 0; j < matchesClassGroupsList[i].ChildNodes.Count; j++) { switch (matchesClassGroupsList[i].ChildNodes[j].Name) { case "rdfs:label": label = matchesClassGroupsList[i].ChildNodes[j].InnerText; break; case "prns:numberOfConnections": number = matchesClassGroupsList[i].ChildNodes[j].InnerText; break; } //String label = matchesClassGroupsList[i].ChildNodes[j] } if (label.Equals("People")) { switch (type) { case compareType.lessThan: return Convert.ToInt32(number) < personThreshold; case compareType.lessEqual: return Convert.ToInt32(number) <= personThreshold; case compareType.equal: return Convert.ToInt32(number) == personThreshold; case compareType.greaterEqual: return Convert.ToInt32(number) >= personThreshold; case compareType.greaterThan: return Convert.ToInt32(number) > personThreshold; } } } return false; }