ClubCourseDAL.cs 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.DataLogic.Repositories;
  8. using EMIS.ViewModel.Cultureplan;
  9. using EMIS.ViewModel.CultureplanManage.CourseMaterial;
  10. namespace EMIS.DataLogic.CultureplanManage.CourseMaterial
  11. {
  12. public class ClubCourseDAL
  13. {
  14. public ClubCourseRepository ClubCourseRepository { get; set; }
  15. public CoursematerialRepository CoursematerialRepository { get; set; }
  16. public ClassGroupingRepository ClassGroupingRepository { get; set; }
  17. /// <summary>
  18. /// 查询对应的俱乐部课程信息View
  19. /// </summary>
  20. /// <param name="exp"></param>
  21. /// <returns></returns>
  22. public IQueryable<ClubCourseView> GetClubCourseViewQueryable(Expression<Func<ER_ClubCourse, bool>> exp)
  23. {
  24. var query = from club in ClubCourseRepository.GetList(exp)
  25. join cou in CoursematerialRepository.Entities
  26. on club.CoursematerialID equals cou.CoursematerialID
  27. join cg in ClassGroupingRepository.Entities
  28. on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg
  29. from coucg in tempcg.DefaultIfEmpty()
  30. select new ClubCourseView
  31. {
  32. ClubCourseID = club.ClubCourseID,
  33. CoursematerialID = club.CoursematerialID,
  34. CourseCode = cou.CourseCode,
  35. CourseName = cou.CourseName,
  36. Abbreviation = cou.Abbreviation,
  37. CourseLevelID = cou.CourseLevelID,
  38. CourseScienceID = cou.CourseScienceID,
  39. ClassGroupingID = cou.ClassGroupingID,
  40. ClassName = coucg.ClassName,
  41. IsEnable = cou.IsEnable == true ? true : false,
  42. RecordStatus = club.RecordStatus,
  43. CreateUserID = club.CreateUserID,
  44. CreateTime = club.CreateTime,
  45. ModifyUserID = club.ModifyUserID,
  46. ModifyTime = club.ModifyTime
  47. };
  48. return query;
  49. }
  50. /// <summary>
  51. /// 查询对应的课程信息View(课程信息表左连俱乐部课程表,排除对应的俱乐部课程信息)
  52. /// </summary>
  53. /// <param name="exp"></param>
  54. /// <returns></returns>
  55. public IQueryable<CoursematerialView> GetCourseNoClubViewQueryable(Expression<Func<EM_Coursematerial, bool>> exp)
  56. {
  57. var query = from cou in CoursematerialRepository.GetList(exp)
  58. join cg in ClassGroupingRepository.Entities
  59. on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg
  60. from coucg in tempcg.DefaultIfEmpty()
  61. join club in ClubCourseRepository.Entities
  62. on cou.CoursematerialID equals club.CoursematerialID into tempclub
  63. from clubcou in tempclub.DefaultIfEmpty()
  64. where clubcou.CoursematerialID == null
  65. select new CoursematerialView
  66. {
  67. CoursematerialID = cou.CoursematerialID,
  68. CourseCode = cou.CourseCode,
  69. CourseName = cou.CourseName,
  70. Abbreviation = cou.Abbreviation,
  71. EnglishName = cou.EnglishName,
  72. StandardName = cou.StandardName,
  73. CourseEdition = cou.CourseEdition,
  74. CourseLevelID = cou.CourseLevelID,
  75. CourseScienceID = cou.CourseScienceID,
  76. ClassGroupingID = cou.ClassGroupingID,
  77. ClassName = coucg.ClassName,
  78. CourseSynopsis = cou.CourseSynopsis,
  79. CourseReserve = cou.CourseReserve,
  80. IsEnable = cou.IsEnable == true ? true : false,
  81. Remark = cou.Remark,
  82. RecordStatus = cou.RecordStatus,
  83. CreateUserID = cou.CreateUserID,
  84. CreateTime = cou.CreateTime,
  85. ModifyUserID = cou.ModifyUserID,
  86. ModifyTime = cou.ModifyTime
  87. };
  88. return query;
  89. }
  90. }
  91. }