public IEnumerable<IParticipation> GetData(string stockCode) { string filepath = string.Format(@"{0}\{1}.dat", PathHelper.ParticipationFolder, stockCode); List<ParticipationDataItem> result = new List<ParticipationDataItem>(); if (File.Exists(filepath)) { var file = new ParticipationFile(filepath); result.AddRange(file.ReadAll()); } return result.Cast<IParticipation>(); }
public IParticipation GetLatest(string stockCode) { string filepath = string.Format(@"{0}\{1}.dat", PathHelper.ParticipationFolder, stockCode); if (File.Exists(filepath)) { var file = new ParticipationFile(filepath); var result = from it in file.ReadAll() orderby it.Time descending select it; IParticipation fst = result.First(); if (fst != null) return fst; } return null; }