扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected AWSECommerceService AmazonECS = new AWSECommerceService(); protected ItemSearch Search = new ItemSearch(); protected ItemSearchRequest SearchRequest = new ItemSearchRequest(); protected ItemSearchResponse SearchResponse; protected void submitSearch_Click(object sender, EventArgs e) { Search.AWSAccessKeyId = TxtBAccessKey.Text.ToString(); SearchRequest.SearchIndex = "Restaurants"; SearchRequest.Cuisine = ListBoxCuisine.SelectedValue; SearchRequest.City = listBoxCity.SelectedValue; SearchRequest.Neighborhood = TextBox3.Text.ToString(); SearchRequest.ResponseGroup = new String[] { "ItemAttributes" }; Search.Request = new ItemSearchRequest[1] { SearchRequest }; try { SearchResponse = AmazonECS.ItemSearch(Search); if (SearchResponse.Items == null) { labelError.Text = "A Server error has occured."; } else { Items responseItems = SearchResponse.Items[0]; Item[] response = responseItems.Item; if (response != null) { foreach (Item I in response) { NoResults.Text = ""; Label Results = new Label(); Label Sep = new Label(); Results.Text = "<strong>" + I.ItemAttributes.Title.ToUpper() + "</strong>" + "<br/>" + I.ItemAttributes.Address.Address1.ToString() + "<br/>" + I.ItemAttributes.Neighborhood + "<br/>" + "Tel:" + " " + I.ItemAttributes.PhoneNumber + "<br/>" + "Price Rating:" + " " + priceRating(I.ItemAttributes.PriceRating)+"<br/>"+"<br/>"; Sep.Text = "<br/>"; RP1.Controls.Add(Results); RP1.Controls.Add(Sep); } PriceRange.Text ="Price per person (based on entree, appetizer or salad, one non-alcoholic drink plus tax and tip)"; } else { NoResults.Text = "No search results found."; PriceRange.Text = ""; } } } catch (Exception ex) { labelError.Text = ex.Message.ToString(); } } private string priceRating(string str) { if (str=="1"){ return "under $15";} else if(str=="2"){ return "$15-30";} else if(str=="3"){ return "$30-45";} else if(str=="4"){ return "over $45";} else{return null;} } protected void listBoxCity_SelectedIndexChanged(object sender, EventArgs e) {} protected void ListBoxCuisine_SelectedIndexChanged(object sender, EventArgs e) {} } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者