Kjh_TdkBLL.cs 769 B

123456789101112131415161718192021222324252627282930
  1. using CP.Cache;
  2. using CP.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace CP.Business
  9. {
  10. public class Kjh_TdkBLL
  11. {
  12. /// 缓存
  13. /// </summary>
  14. static WMCache cache = WMCache.GetCacheService();
  15. public Kjh_Tdk GetList(int cid)
  16. {
  17. DataConnect dc = new DataConnect();
  18. string key = "Kjh_Tdk";
  19. List<Kjh_Tdk> list = cache.GetObject<List<Kjh_Tdk>>(key);
  20. if (list == null)
  21. {
  22. list = dc.db.Fetch<Kjh_Tdk>("");
  23. cache.AddObject(key, list, (int)CacheTime.System);
  24. }
  25. return list.Where(a=>a.cid==cid).FirstOrDefault();
  26. }
  27. }
  28. }