EducationMissionClassStudentDAL.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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.EducationManage.EducationArrange;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.EducationManage.EducationArrange
  11. {
  12. public class EducationMissionClassStudentDAL
  13. {
  14. public EducationMissionRepository EducationMissionRepository { get; set; }
  15. public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
  16. public EducationMissionClassTeachingSettingRepository EducationMissionClassTeachingSettingRepository { get; set; }
  17. public EducationSchedulingClassRepository EducationSchedulingClassRepository { get; set; }
  18. public CourseProcessRepository CourseProcessRepository { get; set; }
  19. public SchoolyearRepository SchoolyearRepository { get; set; }
  20. public CoursematerialRepository CoursematerialRepository { get; set; }
  21. public StudentRepository StudentRepository { get; set; }
  22. public ClassmajorRepository ClassmajorRepository { get; set; }
  23. public GrademajorRepository GrademajorRepository { get; set; }
  24. public FacultymajorRepository FacultymajorRepository { get; set; }
  25. public DepartmentRepository DepartmentRepository { get; set; }
  26. public CollegeRepository CollegeRepository { get; set; }
  27. public CampusRepository CampusRepository { get; set; }
  28. public ClassroomRepository ClassroomRepository { get; set; }
  29. public UserRepository UserRepository { get; set; }
  30. /// <summary>
  31. /// 查询对应的教学任务班学生名单信息
  32. /// </summary>
  33. /// <param name="expEducationSchedulingClass"></param>
  34. /// <param name="expEducationMissionClass"></param>
  35. /// <param name="expEducationMission"></param>
  36. /// <param name="expStudent"></param>
  37. /// <returns></returns>
  38. public IQueryable<EducationMissionClassStudentView> GetEducationMissionClassStudentViewQueryable(Expression<Func<EM_EducationSchedulingClass, bool>> expEducationSchedulingClass,
  39. Expression<Func<EM_EducationMissionClass, bool>> expEducationMissionClass, Expression<Func<EM_EducationMission, bool>> expEducationMission, Expression<Func<CF_Student, bool>> expStudent)
  40. {
  41. var query = from esc in EducationSchedulingClassRepository.GetList(expEducationSchedulingClass)
  42. join emc in EducationMissionClassRepository.GetList(expEducationMissionClass)
  43. on esc.EducationMissionClassID equals emc.EducationMissionClassID
  44. from cou in CoursematerialRepository.Entities.Where(x => x.CoursematerialID == emc.CoursematerialID)
  45. join em in EducationMissionRepository.GetList(expEducationMission)
  46. on emc.EducationMissionID equals em.EducationMissionID
  47. from sy in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == em.SchoolyearID)
  48. from dep in DepartmentRepository.Entities.Where(x => x.DepartmentID == em.DepartmentID).DefaultIfEmpty()
  49. from coucol in CollegeRepository.Entities.Where(x => x.CollegeID == dep.CollegeID).DefaultIfEmpty()
  50. from emcst in EducationMissionClassTeachingSettingRepository.Entities.Where(x => x.EducationMissionClassID == emc.EducationMissionClassID).DefaultIfEmpty()
  51. from stu in esc.CF_Student.AsQueryable().Where(expStudent)
  52. from cl in ClassmajorRepository.Entities.Where(x => x.ClassmajorID == stu.ClassmajorID)
  53. from gr in GrademajorRepository.Entities.Where(x => x.GrademajorID == cl.GrademajorID)
  54. from fa in FacultymajorRepository.Entities.Where(x => x.FacultymajorID == gr.FacultymajorID)
  55. from col in CollegeRepository.Entities.Where(x => x.CollegeID == fa.CollegeID)
  56. from cam in CampusRepository.Entities.Where(x => x.CampusID == col.CampusID)
  57. from us in UserRepository.Entities.Where(x => x.UserID == stu.UserID)
  58. join mscl in ClassmajorRepository.Entities
  59. on emc.MainScheduleClassID equals mscl.ClassmajorID into tempmscl
  60. from emcmscl in tempmscl.DefaultIfEmpty()
  61. join cp in
  62. (
  63. from coupr in CourseProcessRepository.Entities
  64. group coupr by coupr.EducationMissionClassID into g
  65. select new
  66. {
  67. EducationMissionClassID = g.Key,
  68. ExecHours = g.Sum(x => x.Times ?? 0)
  69. }
  70. ) on emc.EducationMissionClassID equals cp.EducationMissionClassID into tempcp
  71. from emccp in tempcp.DefaultIfEmpty()
  72. from emccr in ClassroomRepository.Entities.Where(x => x.ClassroomID == emc.ClassroomID).DefaultIfEmpty()
  73. select new EducationMissionClassStudentView
  74. {
  75. EducationSchedulingClassID = esc.EducationSchedulingClassID,
  76. SchedulingClassName = esc.TaskGroupName,
  77. UserID = stu.UserID,
  78. StudentNo = us.LoginID,
  79. Name = us.Name,
  80. SexID = stu.SexID,
  81. BirthDate = stu.BirthDate,
  82. NationID = stu.NationID,
  83. PoliticsID = stu.PoliticsID,
  84. InSchoolStatusID = stu.InSchoolStatusID,
  85. StudentStatus = stu.StudentStatus,
  86. StandardID = fa.StandardID,
  87. EducationID = fa.EducationID,
  88. LearningformID = fa.LearningformID,
  89. LearnSystem = fa.LearnSystem,
  90. ClassmajorID = stu.ClassmajorID,
  91. ClassmajorNo = cl.No,
  92. ClassmajorName = cl.Name,
  93. ClassNum = cl.ClassNum,
  94. GradeID = gr.GradeID,
  95. GrademajorID = cl.GrademajorID,
  96. GrademajorCode = gr.Code,
  97. GrademajorName = gr.Name,
  98. FacultymajorID = gr.FacultymajorID,
  99. FacultymajorCode = fa.Code,
  100. FacultymajorName = fa.Name,
  101. CollegeID = fa.CollegeID,
  102. CollegeCode = col.No,
  103. CollegeName = col.Name,
  104. CampusID = col.CampusID,
  105. CampusNo = cam.No,
  106. CampusName = cam.Name,
  107. EducationMissionClassID = esc.EducationMissionClassID,
  108. EducationMissionID = emc.EducationMissionID,
  109. MissionName = em.ClassName,
  110. SchoolyearID = em.SchoolyearID,
  111. SchoolyearCode = sy.Code,
  112. Value = sy.Value,
  113. MainScheduleClassID = emc.MainScheduleClassID,
  114. MainScheduleClassNo = emcmscl.No,
  115. MainScheduleClassName = emcmscl.Name,
  116. MissionSourceID = emc.MissionSourceTypeID,
  117. MissionTypeID = emc.OptionalCourseTypeID,
  118. OrderNo = emc.OrderNo,
  119. MissionClassName = emc.Name,
  120. CoursematerialID = emc.CoursematerialID,
  121. CourseCode = cou.CourseCode,
  122. CourseName = cou.CourseName,
  123. DepartmentID = em.DepartmentID,
  124. DepartmentCode = dep.No,
  125. DepartmentName = dep.Name,
  126. CourseCollegeID = dep.CollegeID,
  127. CourseCollegeCode = coucol.No,
  128. CourseCollegeName = coucol.Name,
  129. CourseStructureID = emc.CourseStructureID,
  130. CourseCategoryID = emc.CourseCategoryID,
  131. CourseTypeID = emc.CourseTypeID,
  132. CourseQualityID = emc.CourseQualityID,
  133. Credit = emcst.Credit ?? 0,
  134. TheoryCourse = emcst.TheoryCourse ?? 0,
  135. Practicehours = emcst.Practicehours ?? 0,
  136. Trialhours = emcst.Trialhours ?? 0,
  137. Totalhours = (emcst.TheoryCourse ?? 0) + (emcst.Practicehours ?? 0),
  138. ExecHours = emccp.ExecHours == null ? 0 : emccp.ExecHours,
  139. TheoryWeeklyNum = emcst.TheoryWeeklyNum ?? 0,
  140. PracticeWeeklyNum = emcst.PracticeWeeklyNum ?? 0,
  141. TrialWeeklyNum = emcst.TrialWeeklyNum ?? 0,
  142. SchoolweeksNum = (emcst.TheoryWeeklyNum ?? 0) + (emcst.PracticeWeeklyNum ?? 0),
  143. WeeklyHours = emcst.WeeklyHours ?? 0,
  144. WeeklyNum = emcst.WeeklyNum ?? 0,
  145. StartWeeklyNum = emcst.StartWeeklyNum ?? 0,
  146. EndWeeklyNum = emcst.EndWeeklyNum ?? 0,
  147. StartEndWeeklyNum = (emcst.StartWeeklyNum ?? 0) + "-" + (emcst.EndWeeklyNum ?? 0),
  148. ExecWeeklyNum = emc.EM_EducationMissionClassSettings.Min(x => x.WeeklyNum)
  149. + "-" + emc.EM_EducationMissionClassSettings.Max(x => x.WeeklyNum),
  150. ClassroomTypeID = emc.ClassroomTypeID,
  151. ClassroomID = emc.ClassroomID,
  152. ClassroomCode = emccr.Code,
  153. ClassroomName = emccr.Name,
  154. IsNeedMaterial = emc.IsNeedMaterial ?? false,
  155. TeachinglanguageID = emc.TeachinglanguageID,
  156. ExaminationModeID = emc.ExaminationModeID,
  157. ResultTypeID = emc.ResultTypeID,
  158. HandleModeID = emc.HandleModeID,
  159. TeachingModeID = emc.TeachingModeID,
  160. ApprovalStatus = emc.RecordStatus,
  161. Remark = emc.Remark
  162. };
  163. return query;
  164. }
  165. }
  166. }