ChangeTypeSettingDAL.cs 4.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel;
  8. using EMIS.ViewModel.StudentManage.StudentChange;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.StudentManage.StudentChange
  11. {
  12. public class ChangeTypeSettingDAL
  13. {
  14. public DifferentDynamicTypeInOutSettingRepository ChangeTypeInOutSettingRepository { get; set; }
  15. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  16. public UserRepository UserRepository { get; set; }
  17. /// <summary>
  18. /// 查询对应的异动类型设定信息View(对应的字典表信息左连设定表)
  19. /// </summary>
  20. /// <param name="expDictionaryItem"></param>
  21. /// <param name="expChangeTypeInOutSetting"></param>
  22. /// <returns></returns>
  23. public IQueryable<ChangeTypeSettingView> GetChangeTypeSettingViewQueryable(Expression<Func<Sys_DictionaryItem, bool>> expDictionaryItem,
  24. Expression<Func<CF_DifferentDynamicTypeInOutSetting, bool>> expChangeTypeInOutSetting)
  25. {
  26. var query = from dicit in DictionaryItemRepository.GetList(expDictionaryItem)
  27. join set in ChangeTypeInOutSettingRepository.GetList(expChangeTypeInOutSetting)
  28. on dicit.Value equals set.ChangeTypeID into tempit
  29. from itset in tempit.DefaultIfEmpty()
  30. join usc in UserRepository.Entities
  31. on itset.CreateUserID equals usc.UserID into tempusc
  32. from uscu in tempusc.DefaultIfEmpty()
  33. join usm in UserRepository.Entities
  34. on itset.ModifyUserID equals usm.UserID into tempusm
  35. from usmu in tempusm.DefaultIfEmpty()
  36. select new ChangeTypeSettingView
  37. {
  38. ChangeTypeInOutSettingID = itset.ChangeTypeInOutSettingID == null ? Guid.Empty : itset.ChangeTypeInOutSettingID,
  39. ChangeTypeID = dicit.Value,
  40. ChangeTypeName = dicit.Name,
  41. IsIn = itset.IsIn == null ? false : itset.IsIn,
  42. IsOut = itset.IsOut == null ? false : itset.IsOut,
  43. IsDisplay = dicit.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
  44. RecordStatus = itset.RecordStatus,
  45. CreateUserID = itset.CreateUserID,
  46. CreateUserName = uscu.Name,
  47. CreateTime = itset.CreateTime,
  48. ModifyUserID = itset.ModifyUserID,
  49. ModifyUserName = usmu.Name,
  50. ModifyTime = itset.ModifyTime
  51. };
  52. return query;
  53. }
  54. /// <summary>
  55. /// 查询对应的异动类型设定信息View(设定表与对应的字典表信息内联)
  56. /// </summary>
  57. /// <param name="exp"></param>
  58. /// <returns></returns>
  59. public IQueryable<ChangeTypeSettingView> GetChangeTypeSettingViewQueryable(Expression<Func<CF_DifferentDynamicTypeInOutSetting, bool>> exp)
  60. {
  61. var query = from set in ChangeTypeInOutSettingRepository.GetList(exp)
  62. join dicit in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_ChangeType).Name)
  63. on set.ChangeTypeID equals dicit.Value
  64. join usc in UserRepository.Entities
  65. on set.CreateUserID equals usc.UserID into tempusc
  66. from uscu in tempusc.DefaultIfEmpty()
  67. join usm in UserRepository.Entities
  68. on set.ModifyUserID equals usm.UserID into tempusm
  69. from usmu in tempusm.DefaultIfEmpty()
  70. select new ChangeTypeSettingView
  71. {
  72. ChangeTypeInOutSettingID = set.ChangeTypeInOutSettingID,
  73. ChangeTypeID = dicit.Value,
  74. ChangeTypeName = dicit.Name,
  75. IsIn = set.IsIn == null ? false : set.IsIn,
  76. IsOut = set.IsOut == null ? false : set.IsOut,
  77. IsDisplay = dicit.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
  78. RecordStatus = set.RecordStatus,
  79. CreateUserID = set.CreateUserID,
  80. CreateUserName = uscu.Name,
  81. CreateTime = set.CreateTime,
  82. ModifyUserID = set.ModifyUserID,
  83. ModifyUserName = usmu.Name,
  84. ModifyTime = set.ModifyTime
  85. };
  86. return query;
  87. }
  88. }
  89. }