123456789101112131415161718192021222324252627282930313233343536373839 |
- 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<XlInfo> GetAll()
- {
- try
- {
- DateTime now = DateTime.Now;
- IEnumerable<XlInfo> 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;
- }
- }
- }
- }
|