protected void btn_InvokeWS_Click(object sender, EventArgs e) { locationBasedServices.Service1Client lsPxy = new locationBasedServices.Service1Client(); string zipcode = txtInput.Text.ToString(); try { string[][] response = lsPxy.weatherService(zipcode); lblWeatherForecast.Text += "<table>"; for (int i = 0; i < response.Length; i++) { lblWeatherForecast.Text += "<tr>"; for (int j = 0; j < response[i].Length; j++) { lblWeatherForecast.Text += " <td style=\"padding-right:15px\">"; lblWeatherForecast.Text += response[i][j]; lblWeatherForecast.Text += "</td> "; } lblWeatherForecast.Text += "</tr>"; } lblWeatherForecast.Text += "</table>"; } catch (Exception em) { lblWeatherForecast.Text = em.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { locationBasedServices.Service1Client lsPxy = new locationBasedServices.Service1Client(); string geocode = lsPxy.getLatLng(Session["Zipcode"].ToString()); string[] latLng = geocode.Split(','); Decimal lat = Convert.ToDecimal(latLng[0]); Decimal lng = Convert.ToDecimal(latLng[1]); Session["lat"] = lat; Session["lng"] = lng; }
protected void btn_InvokeGLLS_Click(object sender, EventArgs e) { try { locationBasedServices.Service1Client lsPxy = new locationBasedServices.Service1Client(); string zipcode = txtInputZipCode.Text; lblLatLong.Text = lsPxy.getLatLng(zipcode); } catch (Exception em) { lblLatLong.Text = em.Message.ToString(); } }
protected void btn_InvokeAQS_Click(object sender, EventArgs e) { try { locationBasedServices.Service1Client lsPxy = new locationBasedServices.Service1Client(); decimal lattitude = Convert.ToDecimal(txtInputLattitude.Text); decimal longitude = Convert.ToDecimal(txtInputLongitude.Text); lblAirQuality.Text = lsPxy.airQuality(lattitude, longitude); } catch (Exception em) { lblAirQuality.Text = em.Message.ToString(); } }
protected void airQuality_Click(object sender, EventArgs e) { output.Text = ""; try { locationBasedServices.Service1Client lPxy = new locationBasedServices.Service1Client(); decimal lat = Convert.ToDecimal(Session["lat"].ToString()); decimal lng = Convert.ToDecimal(Session["lng"].ToString()); string op = lPxy.airQuality(lat, lng); output.Text = "The Air Quality index and status is => " + op; } catch (Exception em) { output.Text = em.Message; } }
protected void weather_Click(object sender, EventArgs e) { output.Text = ""; try { locationBasedServices.Service1Client lPxy = new locationBasedServices.Service1Client(); string zip = Session["Zipcode"].ToString(); string[][] weather = lPxy.weatherService(zip); output.Text = "Today's weather is <br> "; for (int i = 0; i < weather[0].Length; i++) { output.Text += weather[0][i] + " : " + weather[1][i] + "<br>"; } } catch (Exception em) { output.Text = em.Message; } }
protected void submitSearch_Click(object sender, EventArgs e) { output.Text = ""; try { string searchTerm = yelpSearch.Text; string zip = Session["Zipcode"].ToString(); locationBasedServices.Service1Client lsPxy = new locationBasedServices.Service1Client(); string geocode = lsPxy.getLatLng(zip); string[] latLng = geocode.Split(','); Decimal lat = Convert.ToDecimal(latLng[0]); Decimal lng = Convert.ToDecimal(latLng[1]); Session["lat"] = lat; Session["lng"] = lng; WebClient webClient = new WebClient(); string address = webClient.DownloadString("http://webstrar61.fulton.asu.edu/page0/Service1.svc/findNearestStore3?latitude=" + lat + "&longitude=" + lng + "&storeName=" + searchTerm); output.Text = "Nearest " + searchTerm + " is at "; output.Text += address; } catch (Exception em) { output.Text = em.Message.ToString(); } }