TrendChartItemCache.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using CB.Cache;
  6. using CB.Entity;
  7. namespace CB.Data
  8. {
  9. public partial class Caches
  10. {
  11. /// <summary>
  12. /// 走势图项配置
  13. /// </summary>
  14. /// <returns></returns>
  15. public static IList<TrendChartItemInfo> GetTrendChartItemList()
  16. {
  17. var cache = CBCache.GetCacheService();
  18. IList<TrendChartItemInfo> list = cache.GetObject(CacheKeys.TrendChartItemList) as IList<TrendChartItemInfo>;
  19. if (null == list)
  20. {
  21. list = TrendChartItemService.ToList();
  22. cache.AddObject(CacheKeys.TrendChartItemList, list);
  23. }
  24. return list;
  25. }
  26. /// <summary>
  27. /// 获取走势图项配置
  28. /// </summary>
  29. /// <param name="chartId"></param>
  30. /// <param name="chartType"></param>
  31. /// <returns></returns>
  32. public static IList<TrendChartItemInfo> GetTrendChartItemList(int chartId, TrendChartType chartType)
  33. {
  34. var list = GetTrendChartItemList();
  35. if (null == list || 0 >= list.Count)
  36. return null;
  37. IList<TrendChartItemInfo> r = new List<TrendChartItemInfo>();
  38. foreach (var item in list)
  39. {
  40. if (chartId == item.ChartId && chartType == item.ChartType)
  41. r.Add(item);
  42. }
  43. return r;
  44. }
  45. }
  46. }