本文整理汇总了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);
}