コード例 #1
0
        public List <BE.MatchResults> PullResults(string sportCode)
        {
            HttpWebRequest  request  = null;
            HttpWebResponse response = null;
            String          Xml;
            XmlDocument     doc = null;

            string uriTemplate = string.Format(@"http://xml2.tip-ex.com/feed/result/xml.php?ident=discoverytx&passwd=57t6y67&spid={0}&mgid=1002,1111&date=yesterday", sportCode);

            // Create the web request
            request = WebRequest.Create(uriTemplate) as HttpWebRequest;


            // Get response
            using (response = request.GetResponse() as HttpWebResponse)
            {
                // Get the response stream
                StreamReader reader = new StreamReader(response.GetResponseStream());

                Xml = reader.ReadToEnd();
                doc = new XmlDocument();
                doc.LoadXml(Xml);
            }


            //XmlNamespaceManager nmgr = new XmlNamespaceManager(doc.NameTable);
            //nmgr.AddNamespace("rest", "http://schemas.microsoft.com/search/local/ws/rest/v1");
            XmlNodeList matches = doc.SelectNodes("matches/match");

            var nodeList = new List <XmlNode>(matches.Cast <XmlNode>());
            List <BE.MatchResults> returnValue = new List <BE.MatchResults>();

            foreach (XmlNode match in nodeList)
            {
                XmlNode result = match.SelectSingleNode("results");

                if (result != null && !string.IsNullOrEmpty(result.InnerText) && result.SelectSingleNode("status").InnerText.ToUpper().Contains("FIN"))
                {
                    BE.MatchResults matchResult = new BE.MatchResults();
                    matchResult.MatchID = match.Attributes["id"].Value;
                    foreach (XmlNode singleResult in result.SelectNodes("result"))
                    {
                        if (matchResult.Results == null)
                        {
                            matchResult.Results = new Dictionary <string, string>();
                        }
                        matchResult.Results.Add(singleResult.Attributes["name"].Value, singleResult.Attributes["value"].Value);
                    }
                    returnValue.Add(matchResult);
                }
            }
            return(returnValue);
        }
コード例 #2
0
 public bool ValidateUserBet(MatchResults results, UserBet userBet)
 {
     return(false);
 }