TeachTypeDAL.cs 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Text;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel;
  8. using EMIS.ViewModel.CultureplanManage.CourseMaterial;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.CultureplanManage.CourseMaterial
  11. {
  12. public class TeachTypeDAL
  13. {
  14. public ClassGroupingRepository ClassGroupingRepository { get; set; }
  15. public ClassGroupingSettingsRepository ClassGroupingSettingsRepository { get; set; }
  16. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  17. /// <summary>
  18. /// 查询对应的上课类型信息TeachTypeView
  19. /// </summary>
  20. /// <param name="exp"></param>
  21. /// <returns></returns>
  22. public IQueryable<TeachTypeView> GetTeachTypeViewQueryable(Expression<Func<EM_ClassGrouping, bool>> exp)
  23. {
  24. var query = from cg in ClassGroupingRepository.GetList(exp)
  25. select new TeachTypeView
  26. {
  27. ClassGroupingID = cg.ClassGroupingID,
  28. ClassName = cg.ClassName,
  29. TeachingModeIDList = cg.EM_ClassGroupingSettings.Select(x => x.TeachingModeID).ToList(),
  30. Remark = cg.Remark,
  31. RecordStatus = cg.RecordStatus,
  32. CreateUserID = cg.CreateUserID,
  33. CreateTime = cg.CreateTime,
  34. ModifyUserID = cg.ModifyUserID,
  35. ModifyTime = cg.ModifyTime
  36. };
  37. return query;
  38. }
  39. /// <summary>
  40. /// 查询对应的上课类型分班明细信息TeachTypeSettingView(根据主表)
  41. /// </summary>
  42. /// <param name="exp"></param>
  43. /// <returns></returns>
  44. public IQueryable<TeachTypeSettingView> GetTeachTypeSettingViewQueryable(Expression<Func<EM_ClassGrouping, bool>> exp)
  45. {
  46. var query = from dic in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
  47. join cgs in
  48. (
  49. from cg in ClassGroupingRepository.GetList(exp)
  50. join cgs in ClassGroupingSettingsRepository.Entities
  51. on cg.ClassGroupingID equals cgs.ClassGroupingID
  52. select new
  53. {
  54. ClassGroupingSettingsID = cgs.ClassGroupingSettingsID,
  55. ClassGroupingID = cgs.ClassGroupingID,
  56. ClassName = cg.ClassName,
  57. TeachingModeID = cgs.TeachingModeID,
  58. RecordStatus = cgs.RecordStatus
  59. }
  60. )
  61. on dic.Value equals cgs.TeachingModeID into tempcgs
  62. from diccgs in tempcgs.DefaultIfEmpty()
  63. select new TeachTypeSettingView
  64. {
  65. ClassGroupingSettingsID = diccgs.ClassGroupingSettingsID == null ? Guid.Empty : diccgs.ClassGroupingSettingsID,
  66. ClassGroupingID = diccgs.ClassGroupingID,
  67. ClassName = diccgs.ClassName,
  68. TeachingModeID = dic.Value,
  69. IsDivide = diccgs.ClassGroupingSettingsID == null ? false : true,
  70. IsDisplay = dic.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
  71. RecordStatus = diccgs.RecordStatus
  72. };
  73. return query;
  74. }
  75. }
  76. }