SpecialtyCourseDAL.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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.CultureplanManage;
  9. using EMIS.ViewModel.CultureplanManage.PlanManagement;
  10. using EMIS.DataLogic.Repositories;
  11. using EMIS.DataLogic.Common.Cultureplan;
  12. namespace EMIS.DataLogic.CultureplanManage.PlanManagement
  13. {
  14. public class SpecialtyCourseDAL
  15. {
  16. public SpecialtyCourseRepository SpecialtyCourseRepository { get; set; }
  17. public SpecialtyCourseTeachingSettingRepository SpecialtyCourseTeachingSettingRepository { get; set; }
  18. public TeachingModeTypeRepository TeachingModeTypeRepository { get; set; }
  19. public TeachingPlaceRepository TeachingPlaceRepository { get; set; }
  20. public SpecialtyRepository SpecialtyRepository { get; set; }
  21. public CoursematerialRepository CoursematerialRepository { get; set; }
  22. public DepartmentRepository DepartmentRepository { get; set; }
  23. public CollegeRepository CollegeRepository { get; set; }
  24. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  25. /// <summary>
  26. /// 查询对应的专业课程信息SpecialtyCourseView
  27. /// </summary>
  28. /// <param name="exp"></param>
  29. /// <returns></returns>
  30. public IQueryable<SpecialtyCourseView> GetSpecialtyCourseViewQueryable(Expression<Func<EM_SpecialtyCourse, bool>> exp)
  31. {
  32. var query = from sc in SpecialtyCourseRepository.GetList(exp)
  33. join spe in SpecialtyRepository.Entities
  34. on sc.SpecialtyID equals spe.SpecialtyID
  35. join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
  36. on spe.StandardID equals dicst.Value into tempst
  37. from spest in tempst.DefaultIfEmpty()
  38. join cou in CoursematerialRepository.Entities
  39. on sc.CoursematerialID equals cou.CoursematerialID
  40. join scts in SpecialtyCourseTeachingSettingRepository.Entities
  41. on sc.SpecialtyCourseID equals scts.SpecialtyCourseID into tempscts
  42. from scscts in tempscts.DefaultIfEmpty()
  43. join dep in DepartmentRepository.Entities
  44. on sc.DepartmentID equals dep.DepartmentID into tempdep
  45. from scdep in tempdep.DefaultIfEmpty()
  46. join col in CollegeRepository.Entities
  47. on scdep.CollegeID equals col.CollegeID into tempcol
  48. from sccol in tempcol.DefaultIfEmpty()
  49. select new SpecialtyCourseView
  50. {
  51. SpecialtyCourseID = sc.SpecialtyCourseID,
  52. SpecialtyID = sc.SpecialtyID,
  53. StandardID = spe.StandardID,
  54. StandardName = spest.Name,
  55. EducationID = spe.EducationID,
  56. LearningformID = spe.LearningformID,
  57. LearnSystem = spe.LearnSystem,
  58. StarttermID = sc.StarttermID,
  59. CoursematerialID = sc.CoursematerialID,
  60. CourseCode = cou.CourseCode,
  61. CourseName = cou.CourseName,
  62. CourseStructureID = sc.CourseStructureID,
  63. CourseCategoryID = sc.CourseCategoryID,
  64. CourseTypeID = sc.CourseTypeID,
  65. CourseQualityID = sc.CourseQualityID,
  66. Credit = scscts.Credit ?? 0,
  67. TheoryCourse = scscts.TheoryCourse ?? 0,
  68. Practicehours = scscts.Practicehours ?? 0,
  69. Trialhours = scscts.Trialhours ?? 0,
  70. Totalhours = (scscts.TheoryCourse ?? 0) + (scscts.Practicehours ?? 0),
  71. TheoryWeeklyNum = scscts.TheoryWeeklyNum ?? 0,
  72. PracticeWeeklyNum = scscts.PracticeWeeklyNum ?? 0,
  73. TrialWeeklyNum = scscts.TrialWeeklyNum ?? 0,
  74. SchoolweeksNum = (scscts.TheoryWeeklyNum ?? 0) + (scscts.PracticeWeeklyNum ?? 0),
  75. WeeklyHours = scscts.WeeklyHours ?? 0,
  76. WeeklyNum = scscts.WeeklyNum ?? 0,
  77. StartWeeklyNum = scscts.StartWeeklyNum ?? 0,
  78. EndWeeklyNum = scscts.EndWeeklyNum ?? 0,
  79. StartEndWeeklyNum = (scscts.StartWeeklyNum ?? 0) + "-" + (scscts.EndWeeklyNum ?? 0),
  80. DepartmentID = sc.DepartmentID,
  81. DepartmentCode = scdep.No,
  82. DepartmentName = scdep.Name,
  83. CollegeID = scdep.CollegeID,
  84. CollegeCode = sccol.No,
  85. CollegeName = sccol.Name,
  86. IsSpecialtycore = sc.IsSpecialtycore ?? false,
  87. IsCooperation = sc.IsCooperation ?? false,
  88. IsRequired = sc.IsRequired ?? false,
  89. IsElective = sc.IsElective ?? false,
  90. IsNetworkCourse = sc.IsNetworkCourse ?? false,
  91. IsMainCourse = sc.IsMainCourse ?? false,
  92. IsNeedMaterial = sc.IsNeedMaterial ?? false,
  93. CourseFineID = sc.CourseFineID,
  94. PracticeTypeID = sc.PracticeTypeID,
  95. TeachinglanguageID = sc.TeachinglanguageID,
  96. ExaminationModeID = sc.ExaminationModeID,
  97. ResultTypeID = sc.ResultTypeID,
  98. HandleModeID = sc.HandleModeID,
  99. TeachingModeIDList = sc.EM_TeachingModeType.Select(x => x.TeachingModeID).ToList(),
  100. TeachingPlaceIDList = sc.EM_TeachingPlace.Select(x => x.TeachingPlace).ToList(),
  101. IsEnable = sc.IsEnable ?? false,
  102. Remark = sc.Remark,
  103. RecordStatus = sc.RecordStatus,
  104. CreateUserID = sc.CreateUserID,
  105. CreateTime = sc.CreateTime,
  106. ModifyUserID = sc.ModifyUserID,
  107. ModifyTime = sc.ModifyTime
  108. };
  109. return query;
  110. }
  111. /// <summary>
  112. /// 查询专业课程信息对应的授课方式
  113. /// </summary>
  114. /// <param name="exp"></param>
  115. /// <returns></returns>
  116. public IQueryable<int?> GetTeachingModeTypeQueryble(Expression<Func<EM_SpecialtyCourse, bool>> exp)
  117. {
  118. var query = from sc in SpecialtyCourseRepository.GetList(exp)
  119. join tm in TeachingModeTypeRepository.Entities
  120. on sc.SpecialtyCourseID equals tm.SpecialtyCourseID
  121. join dictm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
  122. on tm.TeachingModeID equals dictm.Value
  123. select dictm.Value;
  124. return query;
  125. }
  126. /// <summary>
  127. /// 查询专业课程信息对应的授课地点
  128. /// </summary>
  129. /// <param name="exp"></param>
  130. /// <returns></returns>
  131. public IQueryable<int?> GetTeachingPlaceQueryble(Expression<Func<EM_SpecialtyCourse, bool>> exp)
  132. {
  133. var query = from sc in SpecialtyCourseRepository.GetList(exp)
  134. join tp in TeachingPlaceRepository.Entities
  135. on sc.SpecialtyCourseID equals tp.SpecialtyCourseID
  136. join dictp in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EMIS.ViewModel.EM_TeachingPlace).Name)
  137. on tp.TeachingPlace equals dictp.Value
  138. select dictp.Value;
  139. return query;
  140. }
  141. }
  142. }