当前位置: 首页>>代码示例>>C#>>正文


C# ServiceReference1.Service1Client.getNearestStore方法代码示例

本文整理汇总了C#中ServiceReference1.Service1Client.getNearestStore方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceReference1.Service1Client.getNearestStore方法的具体用法?C# ServiceReference1.Service1Client.getNearestStore怎么用?C# ServiceReference1.Service1Client.getNearestStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServiceReference1.Service1Client的用法示例。


在下文中一共展示了ServiceReference1.Service1Client.getNearestStore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Button1_Click

        protected void Button1_Click(object sender, EventArgs e)
        {
            ServiceReference1.Service1Client client1 = new ServiceReference1.Service1Client();
            string output = client1.getNearestStore(TextBox1.Text,TextBox9.Text);
               // TextBox5.Text = output;
            var data = client1.getNearestStore(TextBox1.Text.ToString(), TextBox9.Text.ToString());

            JObject j = JObject.Parse(data);    //parsing the string
            JArray businesses = (JArray)j.GetValue("businesses");  //taking the array with label 'businesses' out.

            int i = 1;
            foreach (JObject o in businesses.Children<JObject>()) //for loop for displaying the names and contacts of the restaurants.
            {
                foreach (JProperty prop in o.Properties())
                {
                    string name = prop.Name;
                    string value = prop.Value.ToString();
                    if (name == "name")
                       TextBox5.Text += i++ + " : " + value + System.Environment.NewLine;
                    //if (name == "phone")
                    //  TextBox1.Text += name + " : " + value + System.Environment.NewLine;

                }
            }

            string input = TextBox1.Text;
            string url = @"http://localhost:14450/Service1.svc/CityStateToZipCodeMatcher/" + TextBox1.Text.ToString() + "/" + TextBox9.Text.ToString();
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            WebResponse response = request.GetResponse();
            Stream dataStream = response.GetResponseStream();
            StreamReader sreader = new StreamReader(dataStream);
            string responsereader = sreader.ReadToEnd();
            response.Close();
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.LoadXml(responsereader);
            XmlNodeList xnList = xmldoc.SelectNodes("/ArrayOfanyType");
            string anyType = "", s = "";
            foreach (XmlNode xn in xnList)
            {
                anyType = xn["anyType"].InnerText.ToString();
                s += anyType+"\t";
            }
            TextBox10.Text = s;

            HttpCookie myCookies = new HttpCookie("myCookieId");
            myCookies["cityName"] = TextBox1.Text;
            myCookies["stateName"] = TextBox9.Text;
            myCookies.Expires = DateTime.Now.AddMonths(6);
            Response.Cookies.Add(myCookies);
        }
开发者ID:amoldp,项目名称:DSOD-Project,代码行数:50,代码来源:Default.aspx.cs


注:本文中的ServiceReference1.Service1Client.getNearestStore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。