public IEnumerable<IStockBonus> GetData(string stockCode) { string filePath = string.Format(@"{0}\{1}.dat", PathHelper.StockBonusFolder, stockCode); List<StockBonusDataItem> result = new List<StockBonusDataItem>(); if (File.Exists(filePath)) { var file = new StockBonusFile(filePath); result.AddRange(file.ReadAll()); } return result.Cast<IStockBonus>(); }
public IEnumerable<IStockBonus> GetDataAll() { string fileFolder = PathHelper.StockBonusFolder; if (!Directory.Exists(fileFolder)) return null; List<StockBonusDataItem> result = new List<StockBonusDataItem>(); DirectoryInfo dir = new DirectoryInfo(fileFolder); foreach (var it in dir.GetFiles()) { var file = new StockBonusFile(it.FullName); result.AddRange(file.ReadAll()); } return result.Cast<IStockBonus>(); }
public IEnumerable<IStockBonus> GetData(IEnumerable<string> stockCodes) { string fileFolder = PathHelper.StockBonusFolder; if (!Directory.Exists(fileFolder)) return null; List<StockBonusDataItem> result = new List<StockBonusDataItem>(); foreach (var it in stockCodes) { string fileName = string.Format(@"{0}\{1}.dat", fileFolder, it); if (File.Exists(fileName)) { var file = new StockBonusFile(fileName); result.AddRange(file.ReadAll()); } } return result.Cast<IStockBonus>(); }