protected void button1_Click(object sender, EventArgs e)
 {
     try {
         NewsReference.Service1Client test = new NewsReference.Service1Client();
         string userLength = textInput.Text;
         int    len        = int.Parse(textInput.Text); // To check whether input is an integer
         if (len <= 0 || len > 10)
         {
             Label1.Visible = true;
             Label1.Text    = "Length should be less be less than or equal to 10 and greater than 0(Zero)";
         }
         else
         {
             Session["userLength"] = userLength;    // Saving the user length in sessionvariable userLength, required by imageProcess.aspx
             string mystr = test.GetVerifierString(userLength);
             Session["generatedString"] = mystr;    // Saving the random string  in sessionvariable generatedString, required by imageProcess.aspx
             button1.Text   = "Show me another image";
             Image1.Visible = true;
         }
     }
     catch (Exception e1)
     {
         Label1.Visible = true;
         Label1.Text    = e1.Message;
     }
 }
示例#2
0
    public void button1_Click(object sender, EventArgs e)
    {
        NewsReference.Service1Client myClient = new NewsReference.Service1Client();  // Create a client proxy
        SolarResult.Visible = true;

        try
        {
            // convert whether latitude and longitude values to int
            int latitude  = Convert.ToInt32(LatitudeInput.Text);
            int longitude = Convert.ToInt32(LongitudeInput.Text);

            // Verify latitude and longitude values
            if (latitude < -90 || latitude > 89)
            {
                if (longitude < -180 || longitude > 179)
                {
                    SolarResult.Text = "Both Latitude and logitude are invalid";
                }
                else
                {
                    SolarResult.Text = "Latitude is invalid";
                }
            }

            else if (longitude < -180 || longitude > 179)
            {
                SolarResult.Text   = "Longitude is invalid";
                LatitudeInput.Text = latitude.ToString();
            }
            else
            {
                double res = myClient.SolarIntensity(latitude, longitude);  // Call the solarIntensity method
                // Validate
                if (res.Equals(-101.00))
                {
                    SolarResult.Text = "Error in processing";
                }
                else
                {
                    SolarResult.Text = "Solar Intensity is " + res.ToString() + " !!!";
                }
            }
        }
        catch (Exception e1)
        {
            SolarResult.Text = e1.Message.ToString();
        }
    }
示例#3
0
    public void button3_Click(object sender, EventArgs e)
    {
        NewsReference.Service1Client myClient = new NewsReference.Service1Client();  // Create a client proxy

        try
        {
            string[] answer = myClient.GetCountryInfo(Country.Text);  // Call the GetCountryInfo method

            if (answer[0].Equals("error"))
            {
                Error1.Visible     = true;
                Alpha2Code.Visible = false;
                Alpha3Code.Visible = false;

                CurrencyCode.Visible   = false;
                CurrencyName.Visible   = false;
                Region.Visible         = false;
                SubRegion.Visible      = false;
                Latitude.Visible       = false;
                Longitude.Visible      = false;
                NativeLanguage.Visible = false;
                Flag.Visible           = false;
                // FlagPng.Visible = false;

                Error1.Text = answer[1];
            }
            else
            {
                Error1.Visible         = false;
                Alpha2Code.Visible     = true;
                Alpha3Code.Visible     = true;
                CurrencyCode.Visible   = true;
                CurrencyName.Visible   = true;
                Region.Visible         = true;
                SubRegion.Visible      = true;
                Latitude.Visible       = true;
                Longitude.Visible      = true;
                NativeLanguage.Visible = true;
                Flag.Visible           = true;
                //FlagPng.Visible = true;


                Alpha2Code.Text = answer[0];
                Alpha3Code.Text = answer[1];
                Region.Text     = answer[2];
                SubRegion.Text  = answer[3];
                Latitude.Text   = answer[4];
                Longitude.Text  = answer[5];


                NativeLanguage.Text = answer[7];
                CurrencyCode.Text   = answer[8];
                CurrencyName.Text   = answer[9];

                Flag.Text = answer[10];
                //  FlagPng.Text = answer[11];
            }
        }
        catch (Exception e1)
        {
            Error1.Visible     = true;
            Alpha2Code.Visible = false;
            Alpha3Code.Visible = false;

            CurrencyCode.Visible   = false;
            CurrencyName.Visible   = false;
            Region.Visible         = false;
            SubRegion.Visible      = false;
            Latitude.Visible       = false;
            Longitude.Visible      = false;
            NativeLanguage.Visible = false;
            Flag.Visible           = false;
            //  FlagPng.Visible = false;

            Error1.Text = e1.Message.ToString();
        }
    }
示例#4
0
    public void button6_Click(object sender, EventArgs e)
    {
        // Label 7 to 12
        NewsReference.Service1Client myClient1 = new NewsReference.Service1Client(); // Connect to the service

        try
        {
            string[] res1 = myClient1.WeatherInfo(CityInput.Text);  // Call the weatherInfo method
                                                                    // Validate
            if (res1[0].Equals("error"))
            {
                Label7.Visible  = false;
                Label8.Visible  = false;
                Label9.Visible  = false;
                Label10.Visible = false;
                Label11.Visible = false;
                Label12.Visible = false;

                location.Visible    = false;
                skytext.Visible     = false;
                temperature.Visible = false;
                humidity.Visible    = false;
                wind.Visible        = false;
                DayDate.Visible     = false;

                Error0.Visible = true;
                Error0.Text    = "Information not found. Please provide correct input(City/State/Country Name)!";
            }
            else
            {
                Error0.Visible  = false;
                Label7.Visible  = true;
                Label8.Visible  = true;
                Label9.Visible  = true;
                Label10.Visible = true;
                Label11.Visible = true;
                Label12.Visible = true;

                location.Visible    = true;
                skytext.Visible     = true;
                temperature.Visible = true;
                humidity.Visible    = true;
                wind.Visible        = true;
                DayDate.Visible     = true;

                location.Text    = res1[0];
                skytext.Text     = res1[1];
                temperature.Text = res1[2];
                humidity.Text    = res1[3];
                wind.Text        = res1[4];
                DayDate.Text     = res1[5];
            }
        }

        catch (Exception e1)
        {
            Label7.Visible  = false;
            Label8.Visible  = false;
            Label9.Visible  = false;
            Label10.Visible = false;
            Label11.Visible = false;
            Label12.Visible = false;

            location.Visible    = false;
            skytext.Visible     = false;
            temperature.Visible = false;
            humidity.Visible    = false;
            wind.Visible        = false;
            DayDate.Visible     = false;

            Error0.Visible = true;
            Error0.Text    = e1.Message.ToString();
        }
    }
示例#5
0
    public void button5_Click(object sender, EventArgs e)
    {
        NewsReference.Service1Client myClient = new NewsReference.Service1Client();  // Create a client prox
        try
        {
            //Label 1 to 6
            // Convert to int and check whether zipcode is 5 digits
            int zip = Convert.ToInt32(ZipCodeInput.Text);
            if (zip < 9999 || zip >= 100000)
            {
                Label1.Visible = false;
                Label2.Visible = false;
                Label3.Visible = false;
                Label4.Visible = false;
                Label5.Visible = false;
                Label6.Visible = false;

                city.Visible  = false;
                state.Visible = false;
                Timezoneidentifier.Visible = false;
                timezone_abbr.Visible      = false;
                utc_offset_sec.Visible     = false;
                is_dst.Visible             = false;

                Error.Visible = true;
                Error.Text    = "ZipCode is invalid";
            }
            else
            {
                string[] res = myClient.TimeZoneInfo(zip);  // Call the crimedata method
                // Validate
                if (res[0].Equals("error"))
                {
                    Label1.Visible = false;
                    Label2.Visible = false;
                    Label3.Visible = false;
                    Label4.Visible = false;
                    Label5.Visible = false;
                    Label6.Visible = false;

                    city.Visible  = false;
                    state.Visible = false;
                    Timezoneidentifier.Visible = false;
                    timezone_abbr.Visible      = false;
                    utc_offset_sec.Visible     = false;
                    is_dst.Visible             = false;

                    Error.Visible = true;

                    Error.Text = "Information not found. Please check whether zipcode is correct!";
                }
                else
                {
                    Error.Visible  = false;
                    Label1.Visible = true;
                    Label2.Visible = true;
                    Label3.Visible = true;
                    Label4.Visible = true;
                    Label5.Visible = true;
                    Label6.Visible = true;

                    city.Visible  = true;
                    state.Visible = true;
                    Timezoneidentifier.Visible = true;
                    timezone_abbr.Visible      = true;
                    utc_offset_sec.Visible     = true;
                    is_dst.Visible             = true;

                    city.Text  = res[0];
                    state.Text = res[1];
                    Timezoneidentifier.Text = res[2];
                    timezone_abbr.Text      = res[3];
                    utc_offset_sec.Text     = res[4];
                    is_dst.Text             = res[5];
                }
            }
        }
        catch (Exception e1)
        {
            Label5.Visible = false;
            Label6.Visible = false;
            Label4.Visible = false;
            Label2.Visible = false;
            Label1.Visible = false;
            Label3.Visible = false;

            city.Visible  = false;
            state.Visible = false;
            Timezoneidentifier.Visible = false;
            timezone_abbr.Visible      = false;
            utc_offset_sec.Visible     = false;
            is_dst.Visible             = false;

            Error.Visible = true;
            Error.Text    = e1.Message.ToString();
        }
    }