/// <summary> /// Event handler /// Invokes the weather service /// Sends a string - zipcode as input to the service /// Gets Backe a 2d string array consisting of 5 day weather forecast /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_InvokeWS_Click(object sender, EventArgs e) { lblWeatherForecast.Text = ""; 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(); } }
/// <summary> /// Event handler /// Invokes the getLatLngService /// Sends a string - zipcode to the service /// Gets back a string - "lattitude,longitude" /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> 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(); } }
/// <summary> /// Event Handler /// Invokes the AirQualityService /// Sends 2 input parameters - Decimal lattitude, Decimal Longitude /// Receives - a string "{Air Quality Index},{Pollution level}" /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_InvokeAQ_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(); } }