コード例 #1
0
        protected void curencyButton_Click(object sender, EventArgs e)
        {
            RamakrishnaServiceReference1.ServiceClient serviceClient = new RamakrishnaServiceReference1.ServiceClient();
            double preliminaryValue;

            Double.TryParse(this.amountToConvertBox.Text, out preliminaryValue);
            try
            {
                // Get the converted currency
                double output = serviceClient.ConvertToLocalCurrency(preliminaryValue, this.countryBox.Text);
                if (output >= 0)
                {
                    WebClient channel = new WebClient();
                    // create a channel and parse out the currency code
                    string url          = "https://www.iban.com/currency-codes";
                    string abc          = channel.DownloadString(url);
                    string currencyCode = null;
                    for (int i = 0; i < abc.Length - this.countryBox.Text.Length; ++i)
                    {
                        if (abc.Substring(i, this.countryBox.Text.Length) == this.countryBox.Text.ToUpper())
                        {
                            for (int j = i + this.countryBox.Text.Length; j < abc.Length - 4; ++j)
                            {
                                if (abc.Substring(j, 4) == "<td>")
                                {
                                    for (int k = j + 4; k < abc.Length - 4; ++k)
                                    {
                                        if (abc.Substring(k, 4) == "<td>")
                                        {
                                            currencyCode = abc.Substring(k + 4, 3);
                                            break;
                                        }
                                    }
                                    break;
                                }
                            }
                            break;
                        }
                    }
                    // Display the results
                    this.currencyLabel.Text = output.ToString() + " " + currencyCode;
                }
                else
                {
                    this.currencyLabel.Text = "Error- Bad Input or Service Unavailable";
                }
            }
            catch (Exception y)
            {
                this.currencyLabel.Text = y.ToString();
            }
        }
コード例 #2
0
ファイル: Address.aspx.cs プロジェクト: ambui/RealEstateApp
 protected void homeButton_Click(object sender, EventArgs e)
 {
     RamakrishnaServiceReference1.ServiceClient serviceClient = new RamakrishnaServiceReference1.ServiceClient();
     string[] output = new string[3];
     try
     {
         // Call Pricing History Service
         output = serviceClient.GetPricingHistory(addressBox.Text, cityBox.Text, stateBox.Text);
         if (output[0] != null)
         {
             this.priceLabel.Text = "$" + output[0];
         }
         else
         {
             this.priceLabel.Text = "Error- Bad Input or Service Unavailable";
         }
         if (output[1] != null)
         {
             this.Image1.ImageUrl    = output[1];
             this.chartURLLabel.Text = output[1];
         }
         else
         {
             this.chartURLLabel.Text = "Error- Bad Input or Service Unavailable";
         }
         if (output[2] != null)
         {
             this.homeInfoURLLabel.Text = output[2];
         }
         else
         {
             this.homeInfoURLLabel.Text = "Error- Bad Input or Service Unavailable";
         }
         if (output[3] != null)
         {
             this.mapInfoURLLabel.Text = output[3];
         }
         else
         {
             this.mapInfoURLLabel.Text = "Error- Bad Input or Service Unavailable";
         }
     }
     catch (Exception f)
     {
         this.priceLabel.Text       = f.ToString();
         this.chartURLLabel.Text    = f.ToString();
         this.homeInfoURLLabel.Text = f.ToString();
         this.mapInfoURLLabel.Text  = f.ToString();
     }
 }
コード例 #3
0
ファイル: LatLong.aspx.cs プロジェクト: ambui/RealEstateApp
 protected void Button1_Click(object sender, EventArgs e)
 {
     RamakrishnaServiceReference1.ServiceClient client = new RamakrishnaServiceReference1.ServiceClient();
     try
     {
         // Call wind energy service and display
         double latIn, longIn;
         Double.TryParse(this.TextBox1.Text, out latIn);
         Double.TryParse(this.TextBox2.Text, out longIn);
         double output = client.SolarIntensity(latIn, longIn);
         if (output > -1)
         {
             this.Label1.Text = output.ToString() + " m/s";
         }
         else
         {
             this.Label1.Text = "Error- Bad Input or Service Unavailable";
         }
     }
     catch (Exception x)
     {
         this.Label1.Text = x.ToString();
     }
     try
     {
         // Call solar energy service and display
         double latIn, longIn;
         Double.TryParse(this.TextBox1.Text, out latIn);
         Double.TryParse(this.TextBox2.Text, out longIn);
         double output = client.GetWindPowerPotential(latIn, longIn);
         if (output != -1)
         {
             this.Label2.Text = output.ToString() + " kWh/m2/day";
         }
         else
         {
             this.Label2.Text = "Error- Bad Input or Service Unavailable";
         }
     }
     catch (Exception y)
     {
         this.Label2.Text = y.ToString();
     }
 }
コード例 #4
0
        protected void searchButton_Click(object sender, EventArgs e)
        {
            RamakrishnaServiceReference1.ServiceClient serviceClient = new RamakrishnaServiceReference1.ServiceClient();
            string        initialIn   = Convert.ToString(this.searchBox.Text);
            int           marker      = 0;
            List <string> initialList = new List <string>();

            // Parse keywwords into an array
            while (marker < initialIn.Length)
            {
                if (initialIn[marker] == ' ')
                {
                    marker++;
                }
                else
                {
                    for (int i = marker + 1; i < initialIn.Length; ++i)
                    {
                        if (initialIn[i] == ' ')
                        {
                            initialList.Add(initialIn.Substring(marker, i - marker));
                            marker = i + 1;
                            break;
                        }
                        else if (i == initialIn.Length - 1)
                        {
                            initialList.Add(initialIn.Substring(marker, i - marker + 1));
                            marker = i + 1;
                            break;
                        }
                    }
                }
            }
            string[] input = new string[initialList.Count];
            for (int i = 0; i < initialList.Count; ++i)
            {
                input[i] = initialList[i];
            }
            try
            {
                // Call NewsFocus service
                string[]      output  = serviceClient.NewsFocus(input);
                StringBuilder builder = new StringBuilder();
                // Format output
                for (int i = 0; i < output.Length; ++i)
                {
                    if (i == output.Length - 1)
                    {
                        builder.Append(output[i]);
                    }
                    else
                    {
                        builder.Append(output[i]);
                        builder.Append("\n\n");
                    }
                }
                labelOut.Text = builder.ToString();
            }
            catch (Exception ec)
            {
                labelOut.Text = ec.ToString();
            }
        }