using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using XdCxRhDW.Repostory.EFContext; using XdCxRhDW.Repostory.Model; namespace XdCxRhDW.App { public static class XlCache { public static IEnumerable GetAll() { try { DateTime now = DateTime.Now; IEnumerable xlInfos = null; for (int i = 0; i < 30; i++) { using (RHDWPartContext db = new RHDWPartContext(now.AddDays(-i))) { if (xlInfos == null) xlInfos = db.XlInfos.OrderBy(p => p.SatName).OrderByDescending(p => p.TimeBJ); else xlInfos = xlInfos.Concat(db.XlInfos.OrderBy(p => p.SatName).OrderByDescending(p => p.TimeBJ)); } } return xlInfos; } catch (Exception ex) { Serilog.Log.Error(ex, "加载星历信息异常"); return null; } } } }