Beispiel #1
0
 /// <summary>
 /// Get stocks by words start with the name and exchange Id.
 /// </summary>
 /// <param name="name">The words start with name</param>
 /// <param name="exchangeId">exchange Id
 /// possible value:
 ///		1.ASX
 ///		2.NYSE
 ///		3.NASDAQ
 ///		4.AMSE
 /// </param>
 /// <param name="count">set the count of the items</param>
 /// <returns></returns>
 public static IList <Stock> GetStockSymbols(string name, int exchangeId, int count)
 {
     using (WijMarket.Models.EntityClass.StockContext context = new EntityClass.StockContext())
     {
         var caseInfo = from info in context.StockEntitys
                        where (info.StockCode.StartsWith(name) || info.StockName.Contains(name)) &&
                        info.ExchangeId == exchangeId
                        orderby info.StockCode
                        select new Stock
         {
             Name   = info.StockName,
             Symbol = info.StockCode
         };
         return(caseInfo.Take(count).ToList <Stock>());
     }
 }
Beispiel #2
0
		/// <summary>
		/// Get stocks by words start with the name and exchange Id.
		/// </summary>
		/// <param name="name">The words start with name</param>
		/// <param name="exchangeId">exchange Id
		/// possible value: 
		///		1.ASX
		///		2.NYSE
		///		3.NASDAQ
		///		4.AMSE
		/// </param>
		/// <param name="count">set the count of the items</param>
		/// <returns></returns>
		public static IList<Stock> GetStockSymbols(string name, int exchangeId, int count)
		{
			using (WijMarket.Models.EntityClass.StockContext context = new EntityClass.StockContext())
			{
				var caseInfo = from info in context.StockEntitys
							   where (info.StockCode.StartsWith(name) || info.StockName.Contains(name)) 
							   && info.ExchangeId == exchangeId
							   orderby info.StockCode
							   select new Stock
							   {
								   Name = info.StockName,
								   Symbol = info.StockCode
							   };
				return caseInfo.Take(count).ToList<Stock>();
			}
		}