Ejemplo n.º 1
0
 /// <summary>
 /// Converts from service data contract model class to a UI Model class for quick HTML display in ASPX pages.
 /// </summary>
 private Trade.StockTraderWebApplicationModelClasses.MarketSummaryDataUI convertMarketSummaryDataToUI(MarketSummaryDataModelWS data)
 {
     List<QuoteDataUI> quoteGainers = new List<QuoteDataUI>();
     List<QuoteDataUI> quoteLosers = new List<QuoteDataUI>();
     for (int i = 0; i < data.topGainers.Count; i++)
     {
         QuoteDataModel quote = (QuoteDataModel)data.topGainers[i];
         quoteGainers.Add((convertQuoteToUI(quote)));
     }
     for (int i = 0; i < data.topLosers.Count; i++)
     {
         QuoteDataModel quote = (QuoteDataModel)data.topLosers[i];
         quoteLosers.Add((convertQuoteToUI(quote)));
     }
     return new MarketSummaryDataUI(data.TSIA, data.openTSIA, data.volume, quoteGainers, quoteLosers, data.summaryDate);
 }
Ejemplo n.º 2
0
 public MarketSummaryDataModelWS getMarketSummaryData()
 {
     try
     {
         decimal TSIA = (decimal)SQLHelper.ExecuteScalarNoParm(_internalConnection,_internalADOTransaction, CommandType.Text,SQL_SELECT_MARKETSUMMARY_TSIA);
         decimal openTSIA = (decimal)SQLHelper.ExecuteScalarNoParm(_internalConnection,_internalADOTransaction,CommandType.Text,SQL_SELECT_MARKETSUMMARY_OPENTSIA);
         double totalVolume = (double)SQLHelper.ExecuteScalarNoParm(_internalConnection,_internalADOTransaction,CommandType.Text,SQL_SELECT_MARKETSUMMARY_VOLUME);
         SqlDataReader rdr = SQLHelper.ExecuteReaderNoParm(_internalConnection,_internalADOTransaction,CommandType.Text,SQL_SELECT_MARKETSUMMARY_GAINERS);
         List<QuoteDataModel> topgainers = new List<QuoteDataModel>();
         List<QuoteDataModel> toplosers = new List<QuoteDataModel>();
         int i = 0;
         while (rdr.Read() && i++<5)
         {
             QuoteDataModel quote = new QuoteDataModel(rdr.GetString(0), rdr.GetString(1), rdr.GetDouble(2), rdr.GetDecimal(3), rdr.GetDecimal(4), rdr.GetDecimal(5), rdr.GetDecimal(6), rdr.GetDouble(7));
             topgainers.Add(quote);
         }
         rdr.Close();
         rdr = SQLHelper.ExecuteReaderNoParm(_internalConnection,_internalADOTransaction,CommandType.Text,SQL_SELECT_MARKETSUMMARY_LOSERS);
         i = 0;
         while (rdr.Read() && i++ < 5)
         {
             QuoteDataModel quote = new QuoteDataModel(rdr.GetString(0), rdr.GetString(1), rdr.GetDouble(2), rdr.GetDecimal(3), rdr.GetDecimal(4), rdr.GetDecimal(5), rdr.GetDecimal(6), rdr.GetDouble(7));
             toplosers.Add(quote);
         }
         rdr.Close();
         MarketSummaryDataModelWS marketSummaryData = new MarketSummaryDataModelWS(TSIA, openTSIA, totalVolume, topgainers, toplosers);
         return marketSummaryData;
     }
     catch
     {
         throw;
     }
 }