public IEnumerable<IStockProfile> GetDataAll() { string filePath = PathHelper.StockProfileFile; List<StockProfileDataItem> result = new List<StockProfileDataItem>(); if (File.Exists(filePath)) { var file = new StockProfileFile(filePath); result.AddRange(file.ReadAll().Distinct()); } return result.Cast<IStockProfile>(); }
public IEnumerable<IStockProfile> GetData(IEnumerable<string> stockCodes) { string filePath = PathHelper.StockProfileFile; if (File.Exists(filePath)) { var file = new StockProfileFile(filePath); var lstSel = from it in file.ReadAll().Distinct() where stockCodes.Contains(it.CodeA) select it; return lstSel.Cast<IStockProfile>(); } return null; }
public IStockProfile GetData(string stockCode) { string filePath = PathHelper.StockProfileFile; if (File.Exists(filePath)) { var file = new StockProfileFile(filePath); var lstAll = file.ReadAll().Distinct(); var it = lstAll.SingleOrDefault(x => x.CodeA == stockCode); if (string.IsNullOrEmpty(it.CodeA.Trim())) return null; return it; } return null; }