示例#1
0
 //TRYIT FOR REQUIRED SERVICE #1
 protected void GetTop10IndicesBtn_Click(object sender, EventArgs e)
 {
     StockRelatedWebServices.Service1Client proxy = new StockRelatedWebServices.Service1Client();
     // Use the 'client' variable to call operations on the service.
     Top10IndicesTextBox.Text = "Filename : " + proxy.GetTop10USIndices(STOCK_EXCHANGE_URL);
     // Always close the client.
     proxy.Close();
 }
示例#2
0
        //TRYIT FOR ELECTIVE SERVICE #1
        protected void SortTop10LowHighBtn_Click(object sender, EventArgs e)
        {
            //open the proxy
            StockRelatedWebServices.Service1Client proxy = new StockRelatedWebServices.Service1Client();
            SortedIndicesTextBox.Text = proxy.SortIndicesLowHigh();

            //close the client
            proxy.Close();
        }
示例#3
0
        //TRYIT FOR REQUIRED SERVICE #2
        protected void GetStockQuoteBtn_Click(object sender, EventArgs e)
        {
            StockRelatedWebServices.Service1Client proxy = new StockRelatedWebServices.Service1Client();
            string stockSymbol = StockSymbolTextInput.Value;

            // Use the 'client' variable to call operations on the service.
            DisplayStockPriceLbl.Text = String.Format("{0:C}", proxy.GetStockQuote(stockSymbol));
            // Always close the client.
            proxy.Close();
        }
示例#4
0
        //TRYIT FOR ELECTIVE SERVICE #2
        protected void GetTransactionPriceBtn_Click(object sender, EventArgs e)
        {
            //open the proxy
            StockRelatedWebServices.Service1Client proxy = new StockRelatedWebServices.Service1Client();
            //store variables
            string stockSymbol = TransactionInput1.Value;
            int    numShares   = Convert.ToInt32(TransactionInput2.Value);
            //calculate transaction price
            decimal transactionPrice = proxy.CalcTransactionPrice(stockSymbol, numShares);

            //display transaction price
            TransactionPriceTextBox.Text = string.Format("{0:C}", transactionPrice);
            //close the client
            proxy.Close();
        }
示例#5
0
        //TRYIT FOR ELECTIVE SERVICE #4
        protected void CalcNumSharesBtn_Click(object sender, EventArgs e)
        {
            //store variables for stockSymbol, monthlyInvestment, and numYears
            string  stockSymbol       = OwnedSharesInput1.Value;
            decimal monthlyInvestment = Convert.ToDecimal(OwnedSharesInput2.Value);
            int     numYears          = Convert.ToInt32(OwnedSharesInput3.Value);

            //open the proxy
            StockRelatedWebServices.Service1Client proxy = new StockRelatedWebServices.Service1Client();
            //calculate number of shares owned
            double numOwnedShares = proxy.GetNumSharesWithDollarCostAvg(stockSymbol, monthlyInvestment, numYears);

            //display result
            OwnedSharesTextBox.Text = string.Format("{0:f2}", numOwnedShares);

            proxy.Close();
        }