ControlItemDAL.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Data.Entity;
  5. using System.Text;
  6. using EMIS.DataLogic.Repositories;
  7. using EMIS.Entities;
  8. using System.Linq.Expressions;
  9. using EMIS.ViewModel;
  10. namespace EMIS.DataLogic.SystemSetting
  11. {
  12. public class ControlItemDAL
  13. {
  14. public ControlItemRepository ControlItemRepository { get; set; }
  15. public ControlItemDetailRepository ControlItemDetailRepository { get; set; }
  16. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  17. public IQueryable<Sys_ControlItem> GetControlItemList(Expression<Func<Sys_ControlItem, bool>> exp)
  18. {
  19. var query = (from ci in ControlItemRepository.GetList(exp)
  20. join dcit in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(SYS_ControlItemType).Name)
  21. on ci.ControlItemTypeID equals dcit.Value
  22. orderby dcit.OrderNo
  23. select ci).Include(x => x.Sys_ControlItemDetail);
  24. return query;
  25. }
  26. public IQueryable<Sys_ControlItemDetail> GetControlItemDetailList(Expression<Func<Sys_ControlItemDetail, bool>> exp)
  27. {
  28. var query = (from ci in ControlItemDetailRepository.GetList(exp)
  29. join dcit in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(SYS_ControlItemType).Name)
  30. on ci.Sys_ControlItem.ControlItemTypeID equals dcit.Value
  31. orderby dcit.OrderNo
  32. select ci).Include(x => x.Sys_ControlItem);
  33. return query;
  34. }
  35. }
  36. }