home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / Remoting / MyStock / SmartQuote.aspx < prev    next >
Encoding:
ASP.NET Web Form  |  2000-06-23  |  3.7 KB  |  144 lines

  1. <%@ Page Language="C#" %>
  2. <%@ Assembly Name="StockNet" %>
  3. <%@ Assembly Name="System" %>
  4. <%@ Assembly Name="System.Net" %>
  5. <%@ Import Namespace="System.Runtime.Remoting" %>
  6. <%@ Import Namespace="System.Net" %>
  7. <%@ Import Namespace="System.Text" %>
  8. <%@ Import Namespace="System.IO" %>
  9. <%@ Import Namespace="System.Collections" %>
  10. <%@ Import Namespace="StockNet" %>
  11.  
  12. <html>
  13.  
  14. <head>
  15.  
  16.     <script runat="server">
  17.      String[] Symbols = {"MSFT", "AOL", "SUNW", "AAPL", "ORCL", "INTC", "CPQ", "DELL"};
  18.  
  19.      void quotes_change(Object Source, EventArgs E)
  20.      {
  21.          StockNet.StockQuote s = new StockNet.StockQuote();
  22.          char[] sep = {';'};
  23.  
  24.          Symbols = symbol.Value.Split(sep);
  25.          StockNet.Quote[] quotes = s.GetQuotes(Symbols);
  26.      }
  27.      
  28.     </script>
  29.  
  30. </head>
  31.  
  32.  
  33. <body style="font: 10pt verdana">
  34.  
  35. <h3>SmartQuote </h3>
  36.  
  37. <form runat="server">
  38.  
  39.     <font face="Verdana">
  40.  
  41.     <b>Please Select A Stock : </b>
  42.  
  43.     <INPUT id="symbol" VALUE="" TYPE="TEXT" runat="server" OnServerChange = "quotes_change">
  44.  
  45.     <p>
  46.  
  47.     <table>
  48.         <tr>
  49.             <td><font face="Verdana" size="6">
  50.                 <span id="QuoteSym" runat="server"/>
  51.                 </font>                </td>
  52.             <td><font face="Verdana" size="6">
  53.                 <span id="CompanyName" runat="server"/>
  54.                 </font></td>
  55.             <td><font face="Verdana" size="6">
  56.                 <span id="QuoteVal" runat="server"/>
  57.                 </font></td>
  58.         </tr>
  59.     </table>
  60.  
  61.     </font>
  62.  
  63. </form>
  64.  
  65.  
  66.  
  67.  
  68. <table cellpadding="1" cellspacing="1" width="100%" style="COLOR:
  69. black;FONT: 8pt verdana, arial" border="0" >
  70.  
  71.     <tr bgcolor="ffffff">
  72.         <td style="padding-left:5" width="*" bgcolor="#b6cbeb"><b>Symbol</b></td>
  73.  
  74.         <td style="padding-left:5;padding-right:15" width="*" bgcolor="#b6cbeb"><b>LastTradePrice</b></td>
  75.  
  76.         <td style="padding-left:5;padding-right:15" width="*" bgcolor="#b6cbeb"><b>Company 
  77.         Name</b></td>
  78.  
  79.         <td style="padding-left:5;padding-right:15" width="*" bgcolor="#b6cbeb"><b>Partners</b></td>
  80.  
  81.         <td style="padding-left:5;padding-right:15" width="*" bgcolor="#b6cbeb"><b>Competitors</b></td>
  82.  
  83.  
  84.     </tr>
  85.  
  86.     <% String symbol = "MSFT"; %>
  87.     
  88.     <% /* String[] symbols = {"MSFT", "AOL", "SUNW", "AAPL", "ORCL", "INTC", "CPQ", "DELL"}; */ %>
  89.     
  90.     <% String[] symbols = Symbols; %>
  91.     
  92.     <% /* StockQuote stockQuote = new StockQuote(); */ %>
  93.     
  94.     <% StockQuote stockQuote = new StockQuote(); %>
  95.     
  96.     <% Quote[] quotes = new Quote[1]; %>
  97.     
  98.     <% /* quotes[0] = stockQuote.GetQuote(symbol); */ %>
  99.     
  100.     <% /* quotes = stockQuote.GetQuotes(symbols); */ %>
  101.  
  102.     
  103.     <%  quotes = stockQuote.GetQuotes(symbols); %>
  104.     
  105.     <% for (int index=0;index < quotes.Length;index++) { %>
  106.  
  107.     
  108.     <tr bgcolor="#eeeeee">
  109.  
  110.         <td style="padding-left:5"><%=quotes[index].Company.Symbol%></td>
  111.  
  112.         <td style="padding-left:5"><%=quotes[index].LastTradePrice%></td>
  113.  
  114.         <td style="padding-left:5"><%=quotes[index].Company.Name%></td>
  115.  
  116.         <td style="padding-left:5">
  117.  
  118.     <% Company company = quotes[index].Company; %>
  119.     
  120.     <% for (int indexPartners=0;indexPartners < company.Partners.Length;indexPartners++) { 
  121.         Company partner = company.Partners[indexPartners]; %>
  122.     <%=partner.Symbol%><br>
  123.     <% } %>
  124.  
  125.     </td>
  126.  
  127.         <td style="padding-left:5">
  128.     <% for (int indexCompetitors=0;indexCompetitors < company.Competitors.Length;indexCompetitors++) { 
  129.         Company competitor = company.Competitors[indexCompetitors]; %>
  130.     <%=competitor.Symbol%><br>
  131.     <% } %>
  132.     </td>
  133.  
  134.     </tr>
  135.    <% } %>
  136.    
  137.     <TD>
  138.  
  139. </table>
  140.  
  141.  
  142. </body>
  143. </html>
  144.