EvaluationStudentSettingDAL.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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.EvaluationManage.StudentEvaluation;
  8. using EMIS.ViewModel.EducationManage.EducationArrange;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.EvaluationManage.StudentEvaluation
  11. {
  12. public class EvaluationStudentSettingDAL
  13. {
  14. public EvaluationStudentSettingRepository EvaluationStudentSettingRepository { get; set; }
  15. public EducationMissionRepository EducationMissionRepository { get; set; }
  16. public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
  17. public ClassmajorRepository ClassmajorRepository { get; set; }
  18. public GrademajorRepository GrademajorRepository { get; set; }
  19. public FacultymajorRepository FacultymajorRepository { get; set; }
  20. public EducationSchedulingClassRepository EducationSchedulingClassRepository { get; set; }
  21. public StudentRepository StudentRepository { get; set; }
  22. public MissionClassTeacherRepository MissionClassTeacherRepository { get; set; }
  23. public SchoolyearRepository SchoolyearRepository { get; set; }
  24. public DepartmentRepository DepartmentRepository { get; set; }
  25. public CollegeRepository CollegeRepository { get; set; }
  26. public CampusRepository CampusRepository { get; set; }
  27. public CoursematerialRepository CoursematerialRepository { get; set; }
  28. public EvaluationTableRepository EvaluationTableRepository { get; set; }
  29. public EvaluationParticipateTypeRepository EvaluationParticipateTypeRepository { get; set; }
  30. public EvaluationIntTypeRepository EvaluationIntTypeRepository { get; set; }
  31. public StaffRepository StaffRepository { get; set; }
  32. public UserRepository UserRepository { get; set; }
  33. public EvaluationStudentRepository EvaluationStudentRepository { get; set; }
  34. /// <summary>
  35. /// 查询对应的学评设定信息EvaluationStudentSettingView
  36. /// </summary>
  37. /// <param name="expEvaluationStudentSetting"></param>
  38. /// <returns></returns>
  39. public IQueryable<EvaluationStudentSettingView> GetEvaluationStudentSettingViewQueryable(Expression<Func<EM_EvaluationStudentSetting, bool>> expEvaluationStudentSetting)
  40. {
  41. var query = from evstust in EvaluationStudentSettingRepository.GetList(expEvaluationStudentSetting)
  42. join educl in EducationMissionClassRepository.Entities
  43. on evstust.EducationMissionClassID equals educl.EducationMissionClassID
  44. join edu in EducationMissionRepository.Entities
  45. on educl.EducationMissionID equals edu.EducationMissionID
  46. join sy in SchoolyearRepository.Entities
  47. on edu.SchoolyearID equals sy.SchoolyearID
  48. join dep in DepartmentRepository.Entities
  49. on edu.DepartmentID equals dep.DepartmentID
  50. join col in CollegeRepository.Entities
  51. on edu.CollegeID equals col.CollegeID
  52. join cam in CampusRepository.Entities
  53. on col.CampusID equals cam.CampusID
  54. join cou in CoursematerialRepository.Entities
  55. on educl.CoursematerialID equals cou.CoursematerialID
  56. join evtb in EvaluationTableRepository.Entities
  57. on evstust.EvaluationTableID equals evtb.EvaluationTableID
  58. join evpt in EvaluationParticipateTypeRepository.Entities
  59. on evtb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
  60. join evtp in EvaluationIntTypeRepository.Entities
  61. on evtb.EvaluationIntTypeID equals evtp.EvaluationIntTypeID
  62. join sf in StaffRepository.Entities
  63. on evstust.UserID equals sf.UserID
  64. join us in UserRepository.Entities
  65. on sf.UserID equals us.UserID
  66. select new EvaluationStudentSettingView
  67. {
  68. EvaluationStudentSettingID = evstust.EvaluationStudentSettingID,
  69. EducationMissionClassID = evstust.EducationMissionClassID,
  70. EducationMissionID = educl.EducationMissionID,
  71. SchoolyearID = edu.SchoolyearID,
  72. SchoolyearValue = sy.Value,
  73. SchoolyearCode = sy.Code,
  74. MissionName = edu.ClassName,
  75. MissionClassName = educl.Name,
  76. CollegeID = edu.CollegeID,
  77. CollegeNo = col.No,
  78. CollegeName = col.Name,
  79. CampusID = col.CampusID,
  80. CampusNo = cam.No,
  81. CampusName = cam.Name,
  82. CoursematerialID = educl.CoursematerialID,
  83. CourseCode = cou.CourseCode,
  84. CourseName = cou.CourseName,
  85. CourseStructureID = educl.CourseStructureID,
  86. CourseCategoryID = educl.CourseCategoryID,
  87. CourseTypeID = educl.CourseTypeID,
  88. CourseQualityID = educl.CourseQualityID,
  89. Credit = educl.EM_EducationMissionClassTeachingSetting.Credit ?? 0,
  90. DepartmentID = edu.DepartmentID,
  91. DepartmentNo = dep.No,
  92. DepartmentName = dep.Name,
  93. HandleModeID = educl.HandleModeID,
  94. TeachingModeID = educl.TeachingModeID,
  95. MissionClassStatus = educl.RecordStatus,
  96. EvaluationTableID = evstust.EvaluationTableID,
  97. EvaluationTableCode = evtb.Code,
  98. EvaluationTableName = evtb.Name,
  99. EvaluationParticipateTypeID = evtb.EvaluationParticipateTypeID,
  100. ParticipateTypeID = evpt.ParticipateTypeID,
  101. EvaluationTypeID = evtb.EvaluationIntTypeID,
  102. EvaluationTypeCode = evtp.Code,
  103. EvaluationTypeName = evtp.Name,
  104. UserID = evstust.UserID,
  105. StaffCode = us.LoginID,
  106. StaffName = us.Name,
  107. TitleID = sf.TitleID,
  108. TeachingMethodID = evstust.TeachingMethodID,
  109. ParticipateCount = evstust.CF_Student.Count(),
  110. NoParticipateCount = evstust.CF_Student.Count() - evstust.EM_EvaluationStudent.Count(),
  111. ValidityParticipateCount = evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count(),
  112. ValidityParticipateRate = evstust.CF_Student.Count() == 0 ? 0 : Math.Round((decimal)((decimal?)evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count() * (decimal?)1.00 / (decimal?)evstust.CF_Student.Count() * (decimal?)100.0), 1),
  113. OpenState = evstust.OpenState.Value,
  114. Remark = evstust.Remark,
  115. RecordStatus = evstust.RecordStatus,
  116. CreateUserID = evstust.CreateUserID,
  117. CreateTime = evstust.CreateTime,
  118. ModifyUserID = evstust.ModifyUserID,
  119. ModifyTime = evstust.ModifyTime
  120. };
  121. return query;
  122. }
  123. /// <summary>
  124. /// 查询对应的学评设定信息EvaluationStudentSettingView
  125. /// </summary>
  126. /// <param name="expEvaluationStudentSetting"></param>
  127. /// <param name="expEducationMissionClass"></param>
  128. /// <param name="expEducationMission"></param>
  129. /// <returns></returns>
  130. public IQueryable<EvaluationStudentSettingView> GetEvaluationStudentSettingViewQueryable(Expression<Func<EM_EvaluationStudentSetting, bool>> expEvaluationStudentSetting,
  131. Expression<Func<EM_EducationMissionClass, bool>> expEducationMissionClass, Expression<Func<EM_EducationMission, bool>> expEducationMission)
  132. {
  133. var query = from evstust in EvaluationStudentSettingRepository.GetList(expEvaluationStudentSetting)
  134. join educl in EducationMissionClassRepository.GetList(expEducationMissionClass)
  135. on evstust.EducationMissionClassID equals educl.EducationMissionClassID
  136. join edu in EducationMissionRepository.GetList(expEducationMission)
  137. on educl.EducationMissionID equals edu.EducationMissionID
  138. join sy in SchoolyearRepository.Entities
  139. on edu.SchoolyearID equals sy.SchoolyearID
  140. join dep in DepartmentRepository.Entities
  141. on edu.DepartmentID equals dep.DepartmentID
  142. join col in CollegeRepository.Entities
  143. on edu.CollegeID equals col.CollegeID
  144. join cam in CampusRepository.Entities
  145. on col.CampusID equals cam.CampusID
  146. join cou in CoursematerialRepository.Entities
  147. on educl.CoursematerialID equals cou.CoursematerialID
  148. join evtb in EvaluationTableRepository.Entities
  149. on evstust.EvaluationTableID equals evtb.EvaluationTableID
  150. join evpt in EvaluationParticipateTypeRepository.Entities
  151. on evtb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
  152. join evtp in EvaluationIntTypeRepository.Entities
  153. on evtb.EvaluationIntTypeID equals evtp.EvaluationIntTypeID
  154. join sf in StaffRepository.Entities
  155. on evstust.UserID equals sf.UserID
  156. join us in UserRepository.Entities
  157. on sf.UserID equals us.UserID
  158. select new EvaluationStudentSettingView
  159. {
  160. EvaluationStudentSettingID = evstust.EvaluationStudentSettingID,
  161. EducationMissionClassID = evstust.EducationMissionClassID,
  162. EducationMissionID = educl.EducationMissionID,
  163. SchoolyearID = edu.SchoolyearID,
  164. SchoolyearValue = sy.Value,
  165. SchoolyearCode = sy.Code,
  166. MissionName = edu.ClassName,
  167. MissionClassName = educl.Name,
  168. CollegeID = edu.CollegeID,
  169. CollegeNo = col.No,
  170. CollegeName = col.Name,
  171. CampusID = col.CampusID,
  172. CampusNo = cam.No,
  173. CampusName = cam.Name,
  174. CoursematerialID = educl.CoursematerialID,
  175. CourseCode = cou.CourseCode,
  176. CourseName = cou.CourseName,
  177. CourseStructureID = educl.CourseStructureID,
  178. CourseCategoryID = educl.CourseCategoryID,
  179. CourseTypeID = educl.CourseTypeID,
  180. CourseQualityID = educl.CourseQualityID,
  181. Credit = educl.EM_EducationMissionClassTeachingSetting.Credit ?? 0,
  182. DepartmentID = edu.DepartmentID,
  183. DepartmentNo = dep.No,
  184. DepartmentName = dep.Name,
  185. HandleModeID = educl.HandleModeID,
  186. TeachingModeID = educl.TeachingModeID,
  187. MissionClassStatus = educl.RecordStatus,
  188. EvaluationTableID = evstust.EvaluationTableID,
  189. EvaluationTableCode = evtb.Code,
  190. EvaluationTableName = evtb.Name,
  191. EvaluationParticipateTypeID = evtb.EvaluationParticipateTypeID,
  192. ParticipateTypeID = evpt.ParticipateTypeID,
  193. EvaluationTypeID = evtb.EvaluationIntTypeID,
  194. EvaluationTypeCode = evtp.Code,
  195. EvaluationTypeName = evtp.Name,
  196. UserID = evstust.UserID,
  197. StaffCode = us.LoginID,
  198. StaffName = us.Name,
  199. TitleID = sf.TitleID,
  200. TeachingMethodID = evstust.TeachingMethodID,
  201. ParticipateCount = evstust.CF_Student.Count(),
  202. NoParticipateCount = evstust.CF_Student.Count() - evstust.EM_EvaluationStudent.Count(),
  203. ValidityParticipateCount = evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count(),
  204. ValidityParticipateRate = evstust.CF_Student.Count() == 0 ? 0 : Math.Round((decimal)((decimal?)evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count() * (decimal?)1.00 / (decimal?)evstust.CF_Student.Count() * (decimal?)100.0), 1),
  205. OpenState = evstust.OpenState.Value,
  206. Remark = evstust.Remark,
  207. RecordStatus = evstust.RecordStatus,
  208. CreateUserID = evstust.CreateUserID,
  209. CreateTime = evstust.CreateTime,
  210. ModifyUserID = evstust.ModifyUserID,
  211. ModifyTime = evstust.ModifyTime
  212. };
  213. return query;
  214. }
  215. /// <summary>
  216. /// 查询学评设定中对应的学生名单信息CF_Student
  217. /// </summary>
  218. /// <param name="exp"></param>
  219. /// <returns></returns>
  220. public IQueryable<CF_Student> GetEvaluationStudentSettingStudentQueryable(Expression<Func<EM_EvaluationStudentSetting, bool>> exp)
  221. {
  222. var query = from evstust in EvaluationStudentSettingRepository.GetList(exp)
  223. from stu in evstust.CF_Student
  224. select stu;
  225. return query;
  226. }
  227. /// <summary>
  228. /// 查询教学任务班中对应的学生名单信息CF_Student
  229. /// </summary>
  230. /// <param name="exp"></param>
  231. /// <returns></returns>
  232. public IQueryable<CF_Student> GetEducationMissionClassStudentQueryable(Expression<Func<EM_EducationMissionClass, bool>> exp)
  233. {
  234. var query = from educl in EducationMissionClassRepository.GetList(exp)
  235. join edusccl in EducationSchedulingClassRepository.Entities
  236. on educl.EducationMissionClassID equals edusccl.EducationMissionClassID
  237. from stu in edusccl.CF_Student
  238. select stu;
  239. return query;
  240. }
  241. /// <summary>
  242. /// 查询对应的评价任务教师信息EvaluationMissionStaffView
  243. /// </summary>
  244. /// <param name="exp"></param>
  245. /// <returns></returns>
  246. public IQueryable<EvaluationMissionStaffView> GetEvaluationMissionStaffViewQueryable(Expression<Func<EM_EducationMissionClass, bool>> exp)
  247. {
  248. var query = from edu in EducationMissionRepository.Entities
  249. join educl in EducationMissionClassRepository.GetList(exp)
  250. on edu.EducationMissionID equals educl.EducationMissionID
  251. join mctea in MissionClassTeacherRepository.Entities
  252. on educl.EducationMissionClassID equals mctea.MissionClassID
  253. join sy in SchoolyearRepository.Entities
  254. on edu.SchoolyearID equals sy.SchoolyearID
  255. join sf in StaffRepository.Entities
  256. on mctea.UserID equals sf.UserID
  257. join dep in DepartmentRepository.Entities
  258. on edu.DepartmentID equals dep.DepartmentID
  259. join col in CollegeRepository.Entities
  260. on dep.CollegeID equals col.CollegeID
  261. join cam in CampusRepository.Entities
  262. on col.CampusID equals cam.CampusID
  263. select new EvaluationMissionStaffView
  264. {
  265. SchoolyearID = edu.SchoolyearID,
  266. SchoolyearValue = sy.Value,
  267. UserID = mctea.UserID,
  268. CoursematerialID = educl.CoursematerialID,
  269. DepartmentID = edu.DepartmentID,
  270. CollegeID = dep.CollegeID,
  271. CampusID = col.CampusID
  272. };
  273. return query;
  274. }
  275. /// <summary>
  276. /// 查询对应的学评任务教师信息EvaluationMissionStaffView
  277. /// </summary>
  278. /// <param name="exp"></param>
  279. /// <returns></returns>
  280. public IQueryable<EvaluationMissionStaffView> GetEvaluationStudentMissionStaffViewQueryable(Expression<Func<EM_EducationMissionClass, bool>> exp)
  281. {
  282. var query = from evstust in EvaluationStudentSettingRepository.Entities
  283. join educl in EducationMissionClassRepository.GetList(exp)
  284. on evstust.EducationMissionClassID equals educl.EducationMissionClassID
  285. join edu in EducationMissionRepository.Entities
  286. on educl.EducationMissionID equals edu.EducationMissionID
  287. join sy in SchoolyearRepository.Entities
  288. on edu.SchoolyearID equals sy.SchoolyearID
  289. join sf in StaffRepository.Entities
  290. on evstust.UserID equals sf.UserID
  291. join dep in DepartmentRepository.Entities
  292. on edu.DepartmentID equals dep.DepartmentID
  293. join col in CollegeRepository.Entities
  294. on dep.CollegeID equals col.CollegeID
  295. join cam in CampusRepository.Entities
  296. on col.CampusID equals cam.CampusID
  297. select new EvaluationMissionStaffView
  298. {
  299. SchoolyearID = edu.SchoolyearID,
  300. SchoolyearValue = sy.Value,
  301. UserID = evstust.UserID,
  302. CoursematerialID = educl.CoursematerialID,
  303. DepartmentID = edu.DepartmentID,
  304. CollegeID = dep.CollegeID,
  305. CampusID = col.CampusID
  306. };
  307. return query;
  308. }
  309. /// <summary>
  310. /// 查询对应的教学任务班信息EducationMissionClassView
  311. /// </summary>
  312. /// <param name="exp"></param>
  313. /// <returns></returns>
  314. public IQueryable<EducationMissionClassView> GetEducationMissionClassViewQueryable(Expression<Func<EM_EducationMissionClass, bool>> exp)
  315. {
  316. var query = from educl in EducationMissionClassRepository.GetList(exp)
  317. join edu in EducationMissionRepository.Entities
  318. on educl.EducationMissionID equals edu.EducationMissionID
  319. join mctea in MissionClassTeacherRepository.Entities
  320. on educl.EducationMissionClassID equals mctea.MissionClassID
  321. join sf in StaffRepository.Entities
  322. on mctea.UserID equals sf.UserID
  323. select new EducationMissionClassView
  324. {
  325. EducationMissionClassID = educl.EducationMissionClassID,
  326. EducationMissionID = educl.EducationMissionID,
  327. SchoolyearID = edu.SchoolyearID,
  328. MissionName = edu.ClassName,
  329. MissionClassName = educl.Name,
  330. CollegeID = edu.CollegeID,
  331. CoursematerialID = educl.CoursematerialID,
  332. CourseStructureID = educl.CourseStructureID,
  333. CourseCategoryID = educl.CourseCategoryID,
  334. CourseTypeID = educl.CourseTypeID,
  335. CourseQualityID = educl.CourseQualityID,
  336. DepartmentID = edu.DepartmentID,
  337. HandleModeID = educl.HandleModeID,
  338. TeachingModeID = educl.TeachingModeID,
  339. UserID = mctea.UserID,
  340. TitleID = sf.TitleID,
  341. TeachingMethodID = mctea.TeachType,
  342. MissionClassStatus = educl.RecordStatus,
  343. Remark = educl.Remark,
  344. RecordStatus = educl.RecordStatus,
  345. CreateUserID = educl.CreateUserID,
  346. CreateTime = educl.CreateTime,
  347. ModifyUserID = educl.ModifyUserID,
  348. ModifyTime = educl.ModifyTime
  349. };
  350. return query;
  351. }
  352. /// <summary>
  353. /// 查询教学任务班中未新增学生评价信息EducationMissionClassView
  354. /// </summary>
  355. /// <param name="expEducationMission"></param>
  356. /// <param name="expEducationMissionClass"></param>
  357. /// <returns></returns>
  358. public IQueryable<EducationMissionClassView> GetEducationMissionClassViewNoAddQueryable(Expression<Func<EM_EducationMission, bool>> expEducationMission, Expression<Func<EM_EducationMissionClass, bool>> expEducationMissionClass)
  359. {
  360. var query = from educl in EducationMissionClassRepository.GetList(expEducationMissionClass)
  361. join edu in EducationMissionRepository.GetList(expEducationMission)
  362. on educl.EducationMissionID equals edu.EducationMissionID
  363. join sy in SchoolyearRepository.Entities
  364. on edu.SchoolyearID equals sy.SchoolyearID
  365. join dep in DepartmentRepository.Entities
  366. on edu.DepartmentID equals dep.DepartmentID
  367. join col in CollegeRepository.Entities
  368. on edu.CollegeID equals col.CollegeID
  369. join cam in CampusRepository.Entities
  370. on col.CampusID equals cam.CampusID
  371. join cou in CoursematerialRepository.Entities
  372. on educl.CoursematerialID equals cou.CoursematerialID
  373. join mctea in MissionClassTeacherRepository.Entities
  374. on educl.EducationMissionClassID equals mctea.MissionClassID
  375. join sf in StaffRepository.Entities
  376. on mctea.UserID equals sf.UserID
  377. join us in UserRepository.Entities
  378. on sf.UserID equals us.UserID
  379. from escl in
  380. (
  381. from edusccl in EducationSchedulingClassRepository.Entities
  382. group edusccl by edusccl.EducationMissionClassID into gescl
  383. select new
  384. {
  385. EducationMissionClassID = gescl.Key,
  386. StudentCount = gescl.Sum(x => x.CF_Student.Count())
  387. }
  388. ).Where(x => x.EducationMissionClassID == educl.EducationMissionClassID).DefaultIfEmpty()
  389. join est in EvaluationStudentSettingRepository.Entities
  390. on new { EducationMissionClassID = educl.EducationMissionClassID, mctea.UserID }
  391. equals new { EducationMissionClassID = est.EducationMissionClassID.Value, est.UserID } into tempest
  392. from evstust in tempest.DefaultIfEmpty()
  393. where evstust.EvaluationStudentSettingID == null
  394. select new EducationMissionClassView
  395. {
  396. EducationMissionClassID = educl.EducationMissionClassID,
  397. EducationMissionID = educl.EducationMissionID,
  398. SchoolyearID = edu.SchoolyearID,
  399. SchoolyearValue = sy.Value,
  400. SchoolyearCode = sy.Code,
  401. MissionName = edu.ClassName,
  402. MissionClassName = educl.Name,
  403. CollegeID = edu.CollegeID,
  404. CollegeNo = col.No,
  405. CollegeName = col.Name,
  406. CampusID = col.CampusID,
  407. CampusNo = cam.No,
  408. CampusName = cam.Name,
  409. CoursematerialID = educl.CoursematerialID,
  410. CourseCode = cou.CourseCode,
  411. CourseName = cou.CourseName,
  412. CourseStructureID = educl.CourseStructureID,
  413. CourseCategoryID = educl.CourseCategoryID,
  414. CourseTypeID = educl.CourseTypeID,
  415. CourseQualityID = educl.CourseQualityID,
  416. Credit = educl.EM_EducationMissionClassTeachingSetting.Credit ?? 0,
  417. DepartmentID = edu.DepartmentID,
  418. DepartmentNo = dep.No,
  419. DepartmentName = dep.Name,
  420. HandleModeID = educl.HandleModeID,
  421. TeachingModeID = educl.TeachingModeID,
  422. UserID = mctea.UserID,
  423. StaffCode = us.LoginID,
  424. StaffName = us.Name,
  425. TitleID = sf.TitleID,
  426. TeachingMethodID = mctea.TeachType,
  427. MissionClassStatus = educl.RecordStatus,
  428. StudentCount = escl.EducationMissionClassID == null ? 0 : escl.StudentCount,
  429. Remark = educl.Remark,
  430. RecordStatus = educl.RecordStatus,
  431. CreateUserID = educl.CreateUserID,
  432. CreateTime = educl.CreateTime,
  433. ModifyUserID = educl.ModifyUserID,
  434. ModifyTime = educl.ModifyTime
  435. };
  436. return query;
  437. }
  438. /// <summary>
  439. /// 查询学评设定中对应的学生名单信息EvaluationStudentSettingDetailView
  440. /// </summary>
  441. /// <param name="expEvaluationStudentSetting"></param>
  442. /// <param name="expStudent"></param>
  443. /// <returns></returns>
  444. public IQueryable<EvaluationStudentSettingDetailView> GetEvaluationStudentSettingDetailViewQueryable(Expression<Func<EM_EvaluationStudentSetting, bool>> expEvaluationStudentSetting,
  445. Expression<Func<EM_EducationMissionClass, bool>> expEducationMissionClass, Expression<Func<EM_EducationMission, bool>> expEducationMission, Expression<Func<CF_Student, bool>> expStudent)
  446. {
  447. var query = from evstust in EvaluationStudentSettingRepository.GetList(expEvaluationStudentSetting)
  448. join educl in EducationMissionClassRepository.GetList(expEducationMissionClass)
  449. on evstust.EducationMissionClassID equals educl.EducationMissionClassID
  450. join edu in EducationMissionRepository.GetList(expEducationMission)
  451. on educl.EducationMissionID equals edu.EducationMissionID
  452. from stu in evstust.CF_Student.AsQueryable().Where(expStudent)
  453. join sy in SchoolyearRepository.Entities
  454. on edu.SchoolyearID equals sy.SchoolyearID
  455. join cou in CoursematerialRepository.Entities
  456. on educl.CoursematerialID equals cou.CoursematerialID
  457. from dep in DepartmentRepository.Entities.Where(x => x.DepartmentID == edu.DepartmentID)
  458. join evtb in EvaluationTableRepository.Entities
  459. on evstust.EvaluationTableID equals evtb.EvaluationTableID
  460. join evpt in EvaluationParticipateTypeRepository.Entities
  461. on evtb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
  462. join evtp in EvaluationIntTypeRepository.Entities
  463. on evtb.EvaluationIntTypeID equals evtp.EvaluationIntTypeID
  464. join sf in StaffRepository.Entities
  465. on evstust.UserID equals sf.UserID
  466. from cl in ClassmajorRepository.Entities.Where(x => x.ClassmajorID == stu.ClassmajorID)
  467. from gr in GrademajorRepository.Entities.Where(x => x.GrademajorID == cl.GrademajorID)
  468. from fa in FacultymajorRepository.Entities.Where(x => x.FacultymajorID == gr.FacultymajorID)
  469. from col in CollegeRepository.Entities.Where(x => x.CollegeID == fa.CollegeID)
  470. from cam in CampusRepository.Entities.Where(x => x.CampusID == col.CampusID)
  471. from sfus in UserRepository.Entities.Where(x => x.UserID == sf.UserID)
  472. from stuus in UserRepository.Entities.Where(x => x.UserID == stu.UserID)
  473. from evstu in evstust.EM_EvaluationStudent.Where(x => x.UserID == stu.UserID).DefaultIfEmpty()
  474. select new EvaluationStudentSettingDetailView
  475. {
  476. EvaluationStudentSettingID = evstust.EvaluationStudentSettingID,
  477. UserID = stu.UserID,
  478. StudentNo = stuus.LoginID,
  479. Name = stuus.Name,
  480. SexID = stu.SexID,
  481. BirthDate = stu.BirthDate,
  482. NationID = stu.NationID,
  483. PoliticsID = stu.PoliticsID,
  484. InSchoolStatusID = stu.InSchoolStatusID,
  485. StudentStatus = stu.StudentStatus,
  486. StandardID = fa.StandardID,
  487. EducationID = fa.EducationID,
  488. LearningformID = fa.LearningformID,
  489. LearnSystem = fa.LearnSystem,
  490. ClassmajorID = stu.ClassmajorID,
  491. ClassmajorNo = cl.No,
  492. ClassmajorName = cl.Name,
  493. ClassNum = cl.ClassNum,
  494. GradeID = gr.GradeID,
  495. GrademajorID = cl.GrademajorID,
  496. GrademajorCode = gr.Code,
  497. GrademajorName = gr.Name,
  498. FacultymajorID = gr.FacultymajorID,
  499. FacultymajorCode = fa.Code,
  500. FacultymajorName = fa.Name,
  501. CollegeID = fa.CollegeID,
  502. CollegeNo = col.No,
  503. CollegeName = col.Name,
  504. CampusID = col.CampusID,
  505. CampusNo = cam.No,
  506. CampusName = cam.Name,
  507. EducationMissionClassID = evstust.EducationMissionClassID,
  508. EducationMissionID = educl.EducationMissionID,
  509. SchoolyearID = edu.SchoolyearID,
  510. SchoolyearValue = sy.Value,
  511. SchoolyearCode = sy.Code,
  512. MissionName = edu.ClassName,
  513. MissionClassName = educl.Name,
  514. CoursematerialID = educl.CoursematerialID,
  515. CourseCode = cou.CourseCode,
  516. CourseName = cou.CourseName,
  517. CourseStructureID = educl.CourseStructureID,
  518. CourseCategoryID = educl.CourseCategoryID,
  519. CourseTypeID = educl.CourseTypeID,
  520. CourseQualityID = educl.CourseQualityID,
  521. Credit = educl.EM_EducationMissionClassTeachingSetting.Credit ?? 0,
  522. DepartmentID = edu.DepartmentID,
  523. DepartmentNo = dep.No,
  524. DepartmentName = dep.Name,
  525. HandleModeID = educl.HandleModeID,
  526. TeachingModeID = educl.TeachingModeID,
  527. MissionClassStatus = educl.RecordStatus,
  528. EvaluationTableID = evstust.EvaluationTableID,
  529. EvaluationTableCode = evtb.Code,
  530. EvaluationTableName = evtb.Name,
  531. EvaluationParticipateTypeID = evtb.EvaluationParticipateTypeID,
  532. ParticipateTypeID = evpt.ParticipateTypeID,
  533. EvaluationTypeID = evtb.EvaluationIntTypeID,
  534. EvaluationTypeCode = evtp.Code,
  535. EvaluationTypeName = evtp.Name,
  536. StaffUserID = evstust.UserID,
  537. StaffCode = sfus.LoginID,
  538. StaffName = sfus.Name,
  539. TitleID = sf.TitleID,
  540. TeachingMethodID = evstust.TeachingMethodID,
  541. OpenState = evstust.OpenState.Value,
  542. IsEvaluation = evstu.EvaluationStudentID == null ? false : true
  543. };
  544. return query;
  545. }
  546. }
  547. }