public static string GetStaffList(Config config, out List<FBStaff> arrStaff, string oAuthConsumerKey, string oAuthSecret, int perPage, int page) { arrStaff = new List<FBStaff>(); Hashtable ht = new Hashtable(); if (perPage > 0) { ht.Add("per_page", perPage); } if (page > 0) { ht.Add("page", page); } XmlTextReader xmlReader = null; string result = FBRequest(config, "staff.list", ht, out xmlReader, oAuthConsumerKey, oAuthSecret, ""); if (result == "ok") { int pageNumber = 1; FBStaff fbStaff = new FBStaff(); while (xmlReader.Read()) { if (xmlReader.NodeType == XmlNodeType.Element) { switch (xmlReader.Name) { case "staff_members": pageNumber = GetPagesCount(xmlReader); break; case "member": fbStaff = new FBStaff(); break; case "staff_id": fbStaff.StaffID = GetXMLTextNodeValueInt(xmlReader); break; case "first_name": fbStaff.FirstName = GetXMLTextNodeValueStr(xmlReader); break; case "last_name": fbStaff.LastName = GetXMLTextNodeValueStr(xmlReader); break; case "email": fbStaff.Email = GetXMLTextNodeValueStr(xmlReader); break; } } else if (xmlReader.NodeType == XmlNodeType.EndElement && xmlReader.Name == "member") { arrStaff.Add(fbStaff); } } if (pageNumber > page) { arrStaff.Add(new FBStaff(-(page + 1), "More...")); } } return result; }
public static string GetStaffList(Config config, out List <FBStaff> arrStaff, string oAuthConsumerKey, string oAuthSecret, int perPage, int page) { arrStaff = new List <FBStaff>(); Hashtable ht = new Hashtable(); if (perPage > 0) { ht.Add("per_page", perPage); } if (page > 0) { ht.Add("page", page); } XmlTextReader xmlReader = null; string result = FBRequest(config, "staff.list", ht, out xmlReader, oAuthConsumerKey, oAuthSecret, ""); if (result == "ok") { int pageNumber = 1; FBStaff fbStaff = new FBStaff(); while (xmlReader.Read()) { if (xmlReader.NodeType == XmlNodeType.Element) { switch (xmlReader.Name) { case "staff_members": pageNumber = GetPagesCount(xmlReader); break; case "member": fbStaff = new FBStaff(); break; case "staff_id": fbStaff.StaffID = GetXMLTextNodeValueInt(xmlReader); break; case "first_name": fbStaff.FirstName = GetXMLTextNodeValueStr(xmlReader); break; case "last_name": fbStaff.LastName = GetXMLTextNodeValueStr(xmlReader); break; case "email": fbStaff.Email = GetXMLTextNodeValueStr(xmlReader); break; } } else if (xmlReader.NodeType == XmlNodeType.EndElement && xmlReader.Name == "member") { arrStaff.Add(fbStaff); } } if (pageNumber > page) { arrStaff.Add(new FBStaff(-(page + 1), "More...")); } } return(result); }