DictionaryItemDAL.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using EMIS.DataLogic.Repositories;
  7. using EMIS.ViewModel.SystemView;
  8. using EMIS.Entities;
  9. using EMIS.ViewModel;
  10. namespace EMIS.DataLogic.SystemSetting
  11. {
  12. public class DictionaryItemDAL
  13. {
  14. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  15. public DictionaryRepository DictionaryRepository { get; set; }
  16. /// <summary>
  17. /// 查询对应的数据字典信息View
  18. /// </summary>
  19. /// <param name="exp"></param>
  20. /// <returns></returns>
  21. public IQueryable<DictionaryItemView> GetDictionaryItemViewQueryable(Expression<Func<Sys_DictionaryItem, bool>> exp)
  22. {
  23. var query = from dicitem in DictionaryItemRepository.GetList(exp)
  24. join dic in DictionaryRepository.Entities
  25. on dicitem.DictionaryCode equals dic.DictionaryCode
  26. select new DictionaryItemView
  27. {
  28. DictionaryItemID = dicitem.DictionaryItemID,
  29. DictionaryCode = dicitem.DictionaryCode,
  30. DictionaryName = dic.Name,
  31. OrderNo = dicitem.OrderNo,
  32. Code = dicitem.Code,
  33. Name = dicitem.Name,
  34. Value = dicitem.Value,
  35. IsEditable = dicitem.IsEditable == true ? true : false,
  36. IsVisible = dicitem.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
  37. RecordStatus = dicitem.RecordStatus
  38. };
  39. return query;
  40. }
  41. }
  42. }