EducationMissionClassCheckDAL.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.EducationManage;
  6. using System.Linq.Expressions;
  7. using EMIS.Entities;
  8. using EMIS.DataLogic.Repositories;
  9. using EMIS.ViewModel.EducationManagement;
  10. namespace EMIS.DataLogic.EducationManage
  11. {
  12. public class EducationMissionClassCheckDAL
  13. {
  14. public EducationMissionClassCheckRepository educationMissionClassCheckRepository { get; set; }
  15. public EducationMissionClassRepository educationMissionClassRepository { get; set; }
  16. public EducationMissionRepository educationMissionRepository { get; set; }
  17. public EducationMissionClassTeachingSettingRepository educationMissionClassTeachingSettingRepository { get; set; }
  18. public EducationSchedulingRepository educationSchedulingRepository { get; set; }
  19. public EducationSchedulingClassRepository educationSchedulingClassRepository { get; set; }
  20. public EducationSchedulingWeekNumRepository educationSchedulingWeekNumRepository { get; set; }
  21. public CoursesTimeRepository coursesTimeRepository { get; set; }
  22. public ClassroomRepository classroomRepository { get; set; }
  23. public SchoolyearRepository schoolyearRepository { get; set; }
  24. public MissionClassTeacherRepository missionClassTeacherRepository { get; set; }
  25. public CoursematerialRepository coursematerialRepository { get; set; }
  26. public StaffRepository staffRepository { get; set; }
  27. public UserRepository userRepository { get; set; }
  28. public IQueryable<EducationMissionClassCheckView> GetEducationMissionClassCheckViewQueryble(Expression<Func<EM_EducationMissionClassCheck, bool>> emccexp, Expression<Func<EM_EducationMission, bool>> emexp,
  29. Expression<Func<ES_EducationScheduling, bool>> esexp, Expression<Func<EM_MissionClassTeacher, bool>> mctexp, Expression<Func<EM_EducationMissionClass, bool>> emcexp,
  30. Expression<Func<ES_EducationSchedulingWeekNum, bool>> eswnexp)
  31. {
  32. var query = from edmcc in educationMissionClassCheckRepository.GetList(emccexp)
  33. join eswnr in educationSchedulingWeekNumRepository.GetList(eswnexp)
  34. on edmcc.EducationSchedulingWeekNumID equals eswnr.EducationSchedulingWeekNumID
  35. join esr in educationSchedulingRepository.GetList(esexp)
  36. on eswnr.EducationSchedulingID equals esr.EducationSchedulingID
  37. join escr in educationSchedulingClassRepository.Entities
  38. on esr.EducationSchedulingClassID equals escr.EducationSchedulingClassID
  39. join emcr in educationMissionClassRepository.GetList(emcexp)
  40. on escr.EducationMissionClassID equals emcr.EducationMissionClassID
  41. join cou in coursematerialRepository.Entities
  42. on emcr.CoursematerialID equals cou.CoursematerialID
  43. join emr in educationMissionRepository.GetList(emexp)
  44. on emcr.EducationMissionID equals emr.EducationMissionID
  45. join sch in schoolyearRepository.Entities
  46. on emr.SchoolyearID equals sch.SchoolyearID
  47. join ctr in coursesTimeRepository.Entities
  48. on esr.CoursesTimeID equals ctr.CoursesTimeID
  49. join cr in classroomRepository.Entities
  50. on esr.ClassroomID equals cr.ClassroomID
  51. select new EducationMissionClassCheckView
  52. {
  53. EducationMissionClassCheckID = edmcc.EducationMissionClassCheckID,
  54. EducationSchedulingWeekNumID = edmcc.EducationSchedulingWeekNumID,
  55. EducationMissionClassID = emcr.EducationMissionClassID,
  56. EducationSchedulingID = esr.EducationSchedulingID,
  57. EducationMissionClassName = emcr.Name,
  58. CoursematerialID = cou.CoursematerialID,
  59. CourseName = cou.CourseName,
  60. CollegeID = emr.CollegeID,
  61. WeekNum = eswnr.WeekNum,
  62. Weekday = esr.Weekday,
  63. CoursesTimeID = esr.CoursesTimeID,
  64. StartTimes = ctr.StartTimes,
  65. EndTimes = ctr.EndTimes,
  66. ClassroomID = esr.ClassroomID,
  67. ClassroomName = cr.Name,
  68. ClassroomCode = cr.Code,
  69. SchoolyearID = emr.SchoolyearID,
  70. SchoolyearCode = sch.Code,
  71. StudentComment = edmcc.StudentComment,
  72. TeacherComment = edmcc.TeacherComment,
  73. DeviceComment = edmcc.DeviceComment,
  74. CheckWayID = edmcc.CheckWayID,
  75. OpinionID = edmcc.OpinionID,
  76. Sys_User = edmcc.Sys_User,
  77. Remark = edmcc.Remark
  78. };
  79. return query;
  80. }
  81. public EducationMissionClassCheckView GetEducationMissionClassCheckView(Guid? educationMissionClassCheckID)
  82. {
  83. var query = from edmcc in educationMissionClassCheckRepository.GetList(x => x.EducationMissionClassCheckID == educationMissionClassCheckID)
  84. join eswnr in educationSchedulingWeekNumRepository.Entities
  85. on edmcc.EducationSchedulingWeekNumID equals eswnr.EducationSchedulingWeekNumID
  86. join esr in educationSchedulingRepository.Entities
  87. on eswnr.EducationSchedulingID equals esr.EducationSchedulingID
  88. join escr in educationSchedulingClassRepository.Entities
  89. on esr.EducationSchedulingClassID equals escr.EducationSchedulingClassID
  90. join emcr in educationMissionClassRepository.Entities
  91. on escr.EducationMissionClassID equals emcr.EducationMissionClassID
  92. join mctr in missionClassTeacherRepository.Entities
  93. on emcr.EducationMissionClassID equals mctr.MissionClassID
  94. join emr in educationMissionRepository.Entities
  95. on emcr.EducationMissionID equals emr.EducationMissionID
  96. join sch in schoolyearRepository.Entities
  97. on emr.SchoolyearID equals sch.SchoolyearID
  98. join ctr in coursesTimeRepository.Entities
  99. on esr.CoursesTimeID equals ctr.CoursesTimeID
  100. join cr in classroomRepository.Entities
  101. on esr.ClassroomID equals cr.ClassroomID
  102. select new EducationMissionClassCheckView
  103. {
  104. EducationMissionClassCheckID = edmcc.EducationMissionClassCheckID,
  105. EducationSchedulingWeekNumID = edmcc.EducationSchedulingWeekNumID,
  106. EducationMissionClassID = emcr.EducationMissionClassID,
  107. EducationSchedulingID = esr.EducationSchedulingID,
  108. WeekNum = eswnr.WeekNum,
  109. Weekday = esr.Weekday,
  110. CoursesTimeID = esr.CoursesTimeID,
  111. StartTimes = ctr.StartTimes,
  112. EndTimes = ctr.EndTimes,
  113. ClassroomID = esr.ClassroomID,
  114. ClassroomName = cr.Name,
  115. ClassroomCode = cr.Code,
  116. SchoolyearID = emr.SchoolyearID,
  117. SchoolyearCode = sch.Code,
  118. StudentComment = edmcc.StudentComment,
  119. TeacherComment = edmcc.TeacherComment,
  120. DeviceComment = edmcc.DeviceComment,
  121. CheckWayID = edmcc.CheckWayID,
  122. OpinionID = edmcc.OpinionID,
  123. Remark = edmcc.Remark
  124. };
  125. return query.ToList().FirstOrDefault();
  126. }
  127. public List<MissionClassTeacherView> GetTeacherByEducationSchedulingID(Expression<Func<ES_EducationScheduling, bool>> exp)
  128. {
  129. var query = from ec in educationSchedulingRepository.GetList(exp)
  130. from tea in ec.ES_EducationSchedulingTeacher
  131. select new MissionClassTeacherView
  132. {
  133. UserID = tea.CF_Staff.UserID,
  134. EducationSchedulingID = ec.EducationSchedulingID,
  135. EducationMissionClassID = ec.EM_EducationSchedulingClass.EducationMissionClassID,
  136. Name = tea.CF_Staff.Sys_User.Name,
  137. TeachingMethod = tea.TeachingMethod
  138. };
  139. return query.OrderBy(x => x.TeachingMethod).ToList();
  140. }
  141. public List<MissionClassTeacherView> GetTeacherNameQuery(Expression<Func<ES_EducationScheduling, bool>> exp, Expression<Func<ES_EducationSchedulingWeekNum, bool>> eswnexp)
  142. {
  143. var query = from ec in educationSchedulingRepository.GetList(exp)
  144. join eswn in educationSchedulingWeekNumRepository.GetList(eswnexp)
  145. on ec.EducationSchedulingID equals eswn.EducationSchedulingID
  146. from tea in ec.ES_EducationSchedulingTeacher
  147. select new MissionClassTeacherView
  148. {
  149. UserID = tea.CF_Staff.UserID,
  150. EducationSchedulingID = ec.EducationSchedulingID,
  151. EducationMissionClassID = ec.EM_EducationSchedulingClass.EducationMissionClassID,
  152. Name = tea.CF_Staff.Sys_User.Name,
  153. TeachingMethod = tea.TeachingMethod
  154. };
  155. return query.OrderBy(x => x.TeachingMethod).ToList();
  156. }
  157. public List<MissionClassTeacherView> GetMissionClassTeacherQuery(Expression<Func<EM_EducationMissionClass, bool>> exp)
  158. {
  159. var query = (from emc in educationMissionClassRepository.GetList(exp)
  160. from tec in emc.EM_MissionClassTeacher
  161. select new MissionClassTeacherView
  162. {
  163. UserID = tec.CF_Staff.UserID,
  164. EducationMissionClassID = emc.EducationMissionClassID,
  165. Name = tec.CF_Staff.Sys_User.Name,
  166. TeachingMethod = tec.TeachType
  167. });
  168. return query.OrderBy(x => x.EducationMissionClassID).OrderBy(x => x.TeachingMethod).ToList();
  169. }
  170. public IQueryable<EducationMissionClassView> GetEducationMissionClassViewByConditionQueryble(Expression<Func<EM_EducationMissionClass, bool>> emcexp, Expression<Func<EM_EducationMission, bool>> emexp, Expression<Func<ES_EducationSchedulingWeekNum, bool>> eswnexp, Expression<Func<ES_EducationScheduling, bool>> esexp)
  171. {
  172. var query = from emsr in educationMissionClassRepository.GetList(emcexp)
  173. join emr in educationMissionRepository.GetList(emexp)
  174. on emsr.EducationMissionID equals emr.EducationMissionID
  175. join cour in coursematerialRepository.Entities
  176. on emsr.CoursematerialID equals cour.CoursematerialID
  177. join escr in educationSchedulingClassRepository.Entities
  178. on emsr.EducationMissionClassID equals escr.EducationMissionClassID
  179. join esr in educationSchedulingRepository.GetList(esexp)
  180. on escr.EducationSchedulingClassID equals esr.EducationSchedulingClassID
  181. join eswnr in educationSchedulingWeekNumRepository.GetList(eswnexp)
  182. on esr.EducationSchedulingID equals eswnr.EducationSchedulingID
  183. select new EducationMissionClassView
  184. {
  185. EducationMissionClassID = emsr.EducationMissionClassID,
  186. CoursematerialID = emsr.CoursematerialID,
  187. CourseName = cour.CourseName,
  188. Name = emsr.Name,
  189. };
  190. return query;
  191. }
  192. public Guid GetEducationSchedulingWeekNumID(int? weekNum, int? weekDay, Guid? coursesTimeID, Guid? classroomID, Guid educationMissionClassID)
  193. {
  194. var query = from escr in educationSchedulingClassRepository.GetList(x => x.EducationMissionClassID == educationMissionClassID)
  195. join esr in educationSchedulingRepository.GetList(x => x.CoursesTimeID == coursesTimeID && x.Weekday == weekDay && x.ClassroomID == classroomID)
  196. on escr.EducationSchedulingClassID equals esr.EducationSchedulingClassID
  197. join eswnr in educationSchedulingWeekNumRepository.GetList(x => x.WeekNum == weekNum)
  198. on esr.EducationSchedulingID equals eswnr.EducationSchedulingID
  199. select new
  200. {
  201. EducationSchedulingWeekNumID = eswnr.EducationSchedulingWeekNumID,
  202. };
  203. return query.Select(x => x.EducationSchedulingWeekNumID).FirstOrDefault();
  204. }
  205. /// <summary>
  206. /// 获取教学检查检查人员
  207. /// </summary>
  208. /// <param name="educationMissionClassID"></param>
  209. /// <returns></returns>
  210. public IQueryable<EducationMissionClassCheckTeacherView> GetEducationMissionClassCheckTeacherListViewQueryble(Guid educationMissionClassCheckID)
  211. {
  212. var query = from emcc in educationMissionClassCheckRepository.GetList(x => x.EducationMissionClassCheckID == educationMissionClassCheckID)
  213. from staff in emcc.Sys_User
  214. select new EducationMissionClassCheckTeacherView
  215. {
  216. CheckTeacherID = staff.UserID,
  217. EducationMissionClassCheckID = emcc.EducationMissionClassCheckID,
  218. UserID = staff.CF_Staff.UserID,
  219. LoginID = staff.CF_Staff.Sys_User.LoginID,
  220. Name = staff.CF_Staff.Sys_User.Name,
  221. CollegeID = staff.CF_Staff.CF_College.CollegeID,
  222. CollegeName = staff.CF_Staff.CF_College.Name,
  223. Sex = staff.CF_Staff.SexID,
  224. DepartmentID = staff.CF_Staff.DepartmentID,
  225. DepartmentName = staff.CF_Staff.CF_Department.Name,
  226. BirthDate = staff.CF_Staff.BirthDate,
  227. TeacherType = staff.CF_Staff.TeacherTypeID,
  228. IncumbencyState = staff.CF_Staff.IncumbencyState,
  229. Title = staff.CF_Staff.TitleID,
  230. };
  231. return query;
  232. }
  233. }
  234. }