Exemplo n.º 1
0
        protected void ButtonWeatherData_Click(object sender, EventArgs e)
        {
            ListBoxWeatherData.Items.Clear();
            WeatherServiceClient client = new WeatherServiceClient();
            string zipcode = validateAndReturnZipCode();

            if (zipcode != null)
            {
                ListBoxWeatherData.Items.Add("Max_Temp   |    Min_Temp");
                try
                {
                    String[] maxTemp = client.get_maxTempData(zipcode).Split(':');
                    String[] minTemp = client.get_minTempData(zipcode).Split(':');
                    for (int i = 0; i < maxTemp.Length; i++)
                    {
                        if (maxTemp[i].Equals("-273"))
                        {
                            maxTemp[i] = "NA";
                        }
                        if (minTemp[i].Equals("-273"))
                        {
                            minTemp[i] = "NA";
                        }
                        ListBoxWeatherData.Items.Add(maxTemp[i] + "------------------------" + minTemp[i]);
                    }
                }
                catch (Exception ex)
                {
                    String output = ex.Message;
                    ListBoxWeatherData.Items.Add(output);
                }
            }
        }