コード例 #1
0
    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 += "&nbsp;<td style=\"padding-right:15px\">";
                    lblWeatherForecast.Text += response[i][j];
                    lblWeatherForecast.Text += "</td>&nbsp;";
                }
                lblWeatherForecast.Text += "</tr>";
            }
            lblWeatherForecast.Text += "</table>";
        }
        catch (Exception em)
        {
            lblWeatherForecast.Text = em.Message.ToString();
        }
    }
コード例 #2
0
    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;
    }
コード例 #3
0
 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();
     }
 }
コード例 #4
0
 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();
     }
 }
コード例 #5
0
 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;
     }
 }
コード例 #6
0
 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;
     }
 }
コード例 #7
0
 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();
     }
 }