CcsActionDeviceSourceCheckRepository.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using IMCS.CCS.Entitys;
  2. using IMCS.CCS.Repository;
  3. using IMCS_CCS.Entitys;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. namespace IMCS_CCS.Repository
  7. {
  8. public class CcsActionDeviceSourceCheckRepository : ICcsActionDeviceSourceCheckRepository
  9. {
  10. private readonly CcsContext _context;
  11. public CcsActionDeviceSourceCheckRepository(CcsContext context)
  12. {
  13. _context = context;
  14. }
  15. public List<CcsActionDeviceSourceCheck> GetList(CcsActionDeviceSourceCheck vo)
  16. {
  17. IQueryable<CcsActionDeviceSourceCheck> actions = _context.CcsActionDeviceSourceCheck;
  18. if (vo.Enable == null)
  19. {
  20. vo.Enable = 1;
  21. }
  22. actions = actions.Where(x => x.Enable == vo.Enable);
  23. if (vo.ActionId != null)
  24. {
  25. actions = actions.Where(x => x.ActionId == vo.ActionId);
  26. }
  27. if (!string.IsNullOrEmpty(vo.Type))
  28. {
  29. actions = actions.Where(x => x.Type == vo.Type);
  30. }
  31. if (!string.IsNullOrEmpty(vo.DeviceCode))
  32. {
  33. actions = actions.Where(x => x.DeviceCode == vo.DeviceCode);
  34. }
  35. if (!string.IsNullOrEmpty(vo.DeviceSource))
  36. {
  37. actions = actions.Where(x => x.DeviceSource == vo.DeviceSource);
  38. }
  39. List< CcsActionDeviceSourceCheck > aa = actions.OrderBy(x => x.CheckSort).ToList();
  40. return aa;
  41. }
  42. }
  43. }