ScoreDAL.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using EMIS.ViewModel.ScoreManage;
  7. using EMIS.Entities;
  8. using System.Linq.Expressions;
  9. using EMIS.ViewModel;
  10. using EMIS.DataLogic.ChargeManage.ArrearsSituation;
  11. namespace EMIS.DataLogic.ScoreManage
  12. {
  13. public class ScoreDAL
  14. {
  15. public FinalExaminationRepository finalExaminationRepository { get; set; }
  16. public FinalExaminationStudentRepository finalExaminationStudentRepository { get; set; }
  17. public ScoreRepository ScoreRepository { get; set; }
  18. public ScoreDetailRepository ScoreDetailRepository { get; set; }
  19. public UserRepository userRepository { get; set; }
  20. public FinallyScoreDetailRepository FinallyScoreDetailRepository { get; set; }
  21. public FinallyScoreRepository finallyScoreRepository { get; set; }
  22. public ResultTypeDetailRepository ResultTypeDetailRepository { get; set; }
  23. public SubmitedScoreRepository submitedScoreRepository { get; set; }
  24. public ScoreFormulaRepository scoreFormulaRepository { get; set; }
  25. public GradePointFormulaRepository gradePointFormulaRepository { get; set; }
  26. public CreditFormulaRepository creditFormulaRepository { get; set; }
  27. public Lazy<ExamsStateSettingDAL> ExamsStateSettingDAL { get; set; }
  28. public Lazy<ArrearsListDAL> ArrearsListDAL { get; set; }
  29. public ExaminationSuspensionRepository ExaminationSuspensionRepository { get; set; }
  30. public ExaminationExemptionRepository ExaminationExemptionRepository { get; set; }
  31. public MisconductRepository MisconductRepository { get; set; }
  32. public ScoreParameterCollegeSettingRepository ScoreParameterCollegeSettingRepository { get; set; }
  33. public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
  34. public EducationMissionRepository EducationMissionRepository { get; set; }
  35. public ScoreConvertByLevelScoreRepository scoreConvertByLevelScoreRepository { get; set; }
  36. public ScoreConvertByReplaceRepository scoreConvertByReplaceRepository { get; set; }
  37. public ScoreConvertByApplyRepository scoreConvertByApplyRepository { get; set; }
  38. /// <summary>
  39. ///
  40. /// </summary>
  41. /// <param name="exp"></param>
  42. /// <returns></returns>
  43. public IQueryable<FinalExaminationView> GetScoreViewQueryable(Expression<Func<ER_FinalExamination, bool>> exp)
  44. {
  45. var query = from a in finalExaminationRepository.GetList(exp)
  46. join b in userRepository.Entities on a.CreatorUserID equals b.UserID
  47. into gu
  48. from guser in gu.DefaultIfEmpty()
  49. select new FinalExaminationView
  50. {
  51. FinalExaminationID = a.FinalExaminationID,
  52. SchoolyearID = a.SchoolyearID,
  53. SchoolyearCode = a.CF_Schoolyear.Code,
  54. GradeYearID = a.GradeYearID,
  55. CourseCollegeID = a.CF_Department.CollegeID,
  56. CollegeID = a.CollegeID,
  57. CollegeName = a.CF_College.Name,
  58. DepartmentID = a.DepartmentID,
  59. DepartmentName = a.CF_Department.Name,
  60. ClassName = a.ClassName,
  61. CoursematerialID = a.CoursematerialID,
  62. CourseCode = a.EM_Coursematerial.CourseCode,
  63. CourseName = a.EM_Coursematerial.CourseName,
  64. CourseTypeID = a.CourseTypeID,
  65. ExamsCategoryID = a.ExamsCategoryID,
  66. ExaminationModeID = a.ExaminationModeID,
  67. Credit = a.Credit,
  68. ExamsDatetime = a.ExamsDatetime,
  69. ResultTypeID = a.ResultTypeID,
  70. CreatorUserID = a.CreatorUserID,
  71. CreatorUserNo = guser.LoginID,
  72. CreatorUserName = guser.Name,
  73. EntryDeadlineTime = a.EntryDeadlineTime,
  74. //IsEntry = a.ApprovalStatus == (int)EMIS.ViewModel.CF_ScoreState.Submitted || a.ApprovalStatus == (int)EMIS.ViewModel.CF_ScoreState.Approved || a.ApprovalStatus == 6 ? false : a.IsEntry ?? false,
  75. IsEntry = a.IsEntry ?? false,
  76. StudentCount = a.ER_FinalExaminationStudent.Count,
  77. SAPunlogStudentCount = a.ER_FinalExaminationStudent.Count - a.ER_Score.Count,
  78. ExaminationType = a.ExaminationType,
  79. ApprovalStatus = a.ApprovalStatus,
  80. Remarks = a.Remark,
  81. CreateTime = a.CreateTime,
  82. CreateUserID = a.CreateUserID,
  83. ScoreFormulaID = a.ScoreFormulaID,
  84. TotalHours = a.TotalHours,
  85. };
  86. return query;
  87. }
  88. /// <summary>
  89. ///
  90. /// </summary>
  91. /// <param name="finalExaminationID"></param>
  92. /// <param name="suspensionEndStatusID"></param>
  93. /// <param name="misconductEndStatusID"></param>
  94. /// <param name="exemptionEndStatusID"></param>
  95. /// <param name="chargeDelayEndStatusID"></param>
  96. /// <param name="isChargeControl"></param>
  97. /// <returns></returns>
  98. public IQueryable<StudentScoreInputView> GetStudentScoreInputViewQuqeryable(Guid? finalExaminationID, int? suspensionEndStatusID,
  99. int? misconductEndStatusID, int? exemptionEndStatusID, int? chargeDelayEndStatusID, bool isChargeControl, int? applyConvertEndStatus, int? replaceConvertEndStatus)
  100. {
  101. var normalExamsStateID = ExamsStateSettingDAL.Value.GetNormalID();
  102. var suspensionStateID = ExamsStateSettingDAL.Value.GetExaminationSuspensionID();
  103. var exemptionStateID = ExamsStateSettingDAL.Value.GetExaminationExemptionID();
  104. var query = from exam in finalExaminationRepository.GetList(x => x.FinalExaminationID == finalExaminationID)
  105. from student in exam.ER_FinalExaminationStudent
  106. join score in ScoreRepository.Entities
  107. on new { exam.FinalExaminationID, student.UserID }
  108. equals new { FinalExaminationID = (Guid)score.FinalExaminationID, score.UserID } into gs
  109. from score in gs.DefaultIfEmpty()
  110. join suspension in ExaminationSuspensionRepository.Entities.Where(x => x.RecordStatus == suspensionEndStatusID)
  111. on new { exam.SchoolyearID, exam.ExamsCategoryID, exam.CoursematerialID, student.UserID }
  112. equals new { suspension.SchoolyearID, suspension.ExamsCategoryID, suspension.CoursematerialID, suspension.UserID }
  113. into dsuspension
  114. from suspension in dsuspension.DefaultIfEmpty()
  115. join misconduct in MisconductRepository.Entities.Where(x => x.RecordStatus == misconductEndStatusID)
  116. on new { exam.SchoolyearID, exam.ExamsCategoryID, exam.CoursematerialID, student.UserID }
  117. equals new { misconduct.SchoolyearID, misconduct.ExamsCategoryID, misconduct.CoursematerialID, misconduct.UserID }
  118. into dmisconduct
  119. from misconduct in dmisconduct.DefaultIfEmpty()
  120. join exemption in ExaminationExemptionRepository.Entities.Where(x => x.RecordStatus == exemptionEndStatusID)
  121. on new { exam.SchoolyearID, exam.ExamsCategoryID, exam.CoursematerialID, student.UserID }
  122. equals new { exemption.SchoolyearID, exemption.ExamsCategoryID, exemption.CoursematerialID, exemption.UserID }
  123. into dexemption
  124. from exemption in dexemption.DefaultIfEmpty()
  125. //join level in scoreConvertByLevelScoreRepository.Entities.Where(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE)
  126. // on new { exam.SchoolyearID, exam.CoursematerialID, student.UserID }
  127. // equals new { level.SchoolyearID, level.CoursematerialID, level.ER_LevelScore.UserID}
  128. // into dlevel
  129. //from flevel in dlevel.DefaultIfEmpty()
  130. //join apply in scoreConvertByApplyRepository.Entities.Where(x => x.RecordStatus == applyConvertEndStatus)
  131. // on new { exam.SchoolyearID, exam.CoursematerialID, student.UserID }
  132. // equals new { apply.SchoolyearID, apply.CoursematerialID, apply.UserID }
  133. // into dapply
  134. //from fapply in dapply.DefaultIfEmpty()
  135. //join replace in scoreConvertByReplaceRepository.Entities.Where(x => x.RecordStatus == replaceConvertEndStatus)
  136. // on new { exam.SchoolyearID, CoursematerialID = exam.CoursematerialID, student.UserID }
  137. // equals new { replace.SchoolyearID, CoursematerialID = replace.TargetCoursematerialID, replace.UserID }
  138. // into dreplace
  139. //from freplace in dreplace.DefaultIfEmpty()
  140. join final in finallyScoreRepository.Entities //有问题,后续修复。。。
  141. on new { exam.SchoolyearID, CoursematerialID = exam.CoursematerialID, student.UserID }
  142. equals new { final.SchoolyearID, CoursematerialID = final.CoursematerialID, final.UserID }
  143. into dfianl
  144. from ffinal in dfianl.DefaultIfEmpty()
  145. select new StudentScoreInputView
  146. {
  147. ScoreID = score.ScoreID,
  148. CoursematerialID = exam.CoursematerialID,
  149. FinalExaminationID = exam.FinalExaminationID,
  150. UserID = student.UserID,
  151. LoginID = student.CF_Student.Sys_User.LoginID,
  152. UserName = student.CF_Student.Sys_User.Name,
  153. ExamsCategoryID = exam.ExamsCategoryID,
  154. ExamsStateID = score.ExamsStateID == null ?
  155. (misconduct.MisconductID != null ? misconduct.ExamsStateID :
  156. (exemption.ExaminationExemptionID != null ? exemptionStateID :
  157. ((suspension.ExaminationSuspensionID != null && exam.ExamsCategoryID == (int)CF_ExamsCategory.FinalExam) ? suspensionStateID : normalExamsStateID)
  158. )
  159. )
  160. : score.ExamsStateID,
  161. TotalScore = score.TotalScore,
  162. //成绩录入页面读取成绩时,如果是成绩认定得到的成绩,则取成绩认定的成绩,并且不可修改。如果有不止一种成绩认定,那么取时间最大(也就是最晚认定的)那一个的成绩
  163. //TotalScore = (flevel == null && fapply == null && freplace == null) ? score.TotalScore :
  164. //(
  165. //(flevel != null && fapply != null && freplace != null) ? (flevel.ModifyTime > fapply.ModifyTime && flevel.ModifyTime > freplace.ModifyTime ? flevel.TotalScore : (fapply.ModifyTime > freplace.ModifyTime ? fapply.TotalScore : freplace.TotalScore)) :
  166. //((flevel != null && fapply == null && freplace == null) ? flevel.TotalScore :
  167. // ((flevel != null && fapply != null && freplace == null) ? (flevel.ModifyTime > fapply.ModifyTime ? flevel.TotalScore : fapply.TotalScore):
  168. // ((flevel == null && fapply != null && freplace == null) ? fapply.TotalScore :
  169. // ((flevel == null && fapply != null && freplace != null) ? (fapply.ModifyTime > freplace.ModifyTime ? fapply.TotalScore : freplace.TotalScore):
  170. // ((flevel == null && fapply == null && freplace != null) ? freplace.TotalScore : score.TotalScore
  171. // )
  172. // )
  173. // )
  174. // )
  175. //)
  176. //),
  177. //flevel != null ? flevel.TotalScore : (fapply != null ? fapply.TotalScore : (freplace != null ? freplace.TotalScore : score.TotalScore)),
  178. //flevel != null ? (fapply != null ? (freplace != null ? ):):
  179. Credit = score.Credit,
  180. GradePoint = score.GradePoint,
  181. Remarks = score.Remark,
  182. StarttermID = student.StarttermID,
  183. RecordStatus = score.RecordStatus == null ? (int)SYS_STATUS.USABLE : score.RecordStatus,
  184. //这里是整条记录的可编辑状态,不是针对每个明细的,暂时只有一种情况整行都不可编辑,那就是重录时未涉及的学生
  185. //成绩认定的学生成绩也不可编辑
  186. IsCanEdit = (score.RecordStatus == null ? (int)EMIS.ViewModel.SYS_STATUS.USABLE : score.RecordStatus) > (int)SYS_STATUS.UNUSABLE,
  187. //IsConvert = flevel != null || fapply != null || freplace != null ? true : false
  188. };
  189. //如果有缴费控制的话,是否可编辑会受影响,是否直接获得学分、是否计算总分也会受影响
  190. if (isChargeControl)
  191. {
  192. query = (from score in query
  193. join arrear in ArrearsListDAL.Value
  194. .GetArrearListViewAble(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE,
  195. x => x.RecordStatus == chargeDelayEndStatusID)
  196. on score.UserID equals arrear.UserID
  197. into darrear
  198. from arrear in darrear.DefaultIfEmpty()
  199. select new StudentScoreInputView
  200. {
  201. ScoreID = score.ScoreID,
  202. CoursematerialID = score.CoursematerialID,
  203. FinalExaminationID = score.FinalExaminationID,
  204. UserID = score.UserID,
  205. LoginID = score.LoginID,
  206. UserName = score.UserName,
  207. ExamsCategoryID = score.ExamsCategoryID,
  208. ExamsStateID = score.ExamsStateID,
  209. TotalScore = score.TotalScore,
  210. Credit = score.Credit,
  211. GradePoint = score.GradePoint,
  212. Remarks = (arrear.UserID == null) ? score.Remarks : "该学生由于欠费,无法录入。",
  213. StarttermID = score.StarttermID,
  214. RecordStatus = score.RecordStatus,
  215. IsCanEdit = (arrear.UserID == null) ? score.IsCanEdit : false,
  216. //IsConvert = score.IsConvert,
  217. });
  218. }
  219. return query;
  220. }
  221. public IQueryable<StudentScoreInputDetailView> GetStudentScoreInputDetailViewQuqeryable(Guid? finalExaminationID)
  222. {
  223. var sql = (from detail in ScoreDetailRepository.Entities
  224. join score in ScoreRepository.GetList(x => x.FinalExaminationID == finalExaminationID)
  225. on detail.ScoreID equals score.ScoreID
  226. join exam in finalExaminationRepository.Entities on score.FinalExaminationID equals exam.FinalExaminationID
  227. join yearSetting in ScoreParameterCollegeSettingRepository.GetList(x => x.CollegeID == null)
  228. on new { Years = exam.GradeYearID, detail.ScoreTypeID }
  229. equals new { yearSetting.Years, yearSetting.ScoreTypeID } into dyearSetting
  230. from yearSetting in dyearSetting.DefaultIfEmpty()
  231. join detailSetting in ScoreParameterCollegeSettingRepository.Entities
  232. on new { Years = exam.GradeYearID, exam.CollegeID, detail.ScoreTypeID }
  233. equals new { detailSetting.Years, detailSetting.CollegeID, detailSetting.ScoreTypeID } into ddetailSetting
  234. from detailSetting in ddetailSetting.DefaultIfEmpty()
  235. select new StudentScoreInputDetailView
  236. {
  237. UserID = score.UserID,
  238. ScoreTypeID = detail.ScoreTypeID,
  239. Score = detail.Score,
  240. IsCanEdit = ((detailSetting.ScoreParameterCollegeSettingID == null && yearSetting.ScoreParameterCollegeSettingID == null) || exam.ExamsCategoryID != (int)CF_ExamsCategory.FinalExam),
  241. RecordStatus = score.RecordStatus
  242. });
  243. return sql;
  244. }
  245. public IQueryable<StudentScoreInputDetailView> GetLastPassedStudentScoreForResit(Guid? finalExaminationID)
  246. {
  247. var query = from resitStudent in finalExaminationStudentRepository.Entities.Where(x => x.FinalExaminationID == finalExaminationID)
  248. join resit in finalExaminationRepository.Entities on resitStudent.FinalExaminationID equals resit.FinalExaminationID
  249. join finaly in finallyScoreRepository.Entities //.Where(x => x.ExamsCategoryID == (int)CF_ExamsCategory.FinalExam)
  250. on new { resit.CoursematerialID, resitStudent.UserID, resitStudent.StarttermID, resitStudent.SchoolyearNumID }
  251. equals new { finaly.CoursematerialID, finaly.UserID, finaly.StarttermID, finaly.SchoolyearNumID }
  252. join finalyDetail in FinallyScoreDetailRepository.Entities on finaly.FinallyScoreID equals finalyDetail.FinallyScoreID
  253. where (finalyDetail.Score >= 60 || finalyDetail.ScoreTypeID == (int)CF_ScoreType.Peacetime)
  254. select new StudentScoreInputDetailView
  255. {
  256. UserID = resitStudent.UserID,
  257. ScoreTypeID = finalyDetail.ScoreTypeID,
  258. Score = finalyDetail.Score,
  259. IsCanEdit = true,
  260. RecordStatus = finalyDetail.RecordStatus
  261. };
  262. return query;
  263. }
  264. /// <summary>
  265. /// 删除已提交成绩的方法(所有涉及删除成绩的地方都是调用此方法)
  266. /// </summary>
  267. /// <param name="finalExaminationID"></param>
  268. /// <param name="listUserID"></param>
  269. /// <returns></returns>
  270. public IQueryable<StudentScoreView> GetDeleteSubmittedScore(Guid finalExaminationID, List<Guid?> listUserID)
  271. {
  272. var query = from score in submitedScoreRepository.GetList(x => x.FinalExaminationID == finalExaminationID)
  273. where listUserID.Contains(score.UserID)
  274. select new StudentScoreView
  275. {
  276. SubmitedScoreID = score.SubmitedScoreID,
  277. UserID = score.UserID,
  278. ExamsCategoryID = score.ExamsCategoryID,
  279. StarttermID = score.StarttermID
  280. };
  281. return query;
  282. }
  283. /// <summary>
  284. /// 删除已提交成绩的方法(所有涉及删除成绩的地方都是调用此方法)
  285. /// </summary>
  286. /// <param name="finalExaminationID"></param>
  287. /// <param name="listUserID"></param>
  288. /// <returns></returns>
  289. public IQueryable<StudentScoreView> GetDeleteSubmittedScore(List<Guid> finalExaminationIDList, List<Guid?> listUserID)
  290. {
  291. var query = from score in submitedScoreRepository.GetList(x => finalExaminationIDList.Contains(x.FinalExaminationID ?? Guid.Empty))
  292. where listUserID.Contains(score.UserID)
  293. select new StudentScoreView
  294. {
  295. SubmitedScoreID = score.SubmitedScoreID,
  296. UserID = score.UserID,
  297. ExamsCategoryID = score.ExamsCategoryID,
  298. StarttermID = score.StarttermID
  299. };
  300. return query;
  301. }
  302. /// <summary>
  303. /// 删除最终成绩表中的学生成绩
  304. /// </summary>
  305. /// <param name="finalExaminationID"></param>
  306. /// <param name="listUserID"></param>
  307. /// <returns></returns>
  308. public IQueryable<StudentScoreView> GetDeleteFinallyScore(Guid finalExaminationID, List<Guid?> listUserID)
  309. {
  310. var query = from final in finalExaminationRepository.GetList(x => x.FinalExaminationID == finalExaminationID)
  311. join stude in finalExaminationStudentRepository.GetList(x => listUserID.Contains(x.UserID)) on final.FinalExaminationID equals stude.FinalExaminationID
  312. join score in finallyScoreRepository.Entities on new { final.ExamsCategoryID, final.CoursematerialID, stude.StarttermID, stude.UserID }
  313. equals new { score.ExamsCategoryID, score.CoursematerialID, score.StarttermID, score.UserID }
  314. select new StudentScoreView
  315. {
  316. FinallyScoreID = score.FinallyScoreID,
  317. UserID = score.UserID,
  318. ExamsCategoryID = score.ExamsCategoryID,
  319. StarttermID = score.StarttermID
  320. };
  321. return query;
  322. }
  323. public IQueryable<ER_FinalExamination> GetFinalExaminationByExaminationSuspension(Expression<Func<ER_ExaminationSuspension, bool>> examinationSuspensionExp,
  324. Expression<Func<ER_FinalExamination, bool>> finalExmainationExp)
  325. {
  326. var query = (from suspension in ExaminationSuspensionRepository.GetList(examinationSuspensionExp)
  327. join finalExam in finalExaminationRepository.Entities.Where(finalExmainationExp)
  328. on new { suspension.SchoolyearID, suspension.CoursematerialID, suspension.ExamsCategoryID }
  329. equals new { finalExam.SchoolyearID, finalExam.CoursematerialID, finalExam.ExamsCategoryID }
  330. from examStudent in finalExam.ER_FinalExaminationStudent
  331. where suspension.UserID == examStudent.UserID
  332. select finalExam);
  333. return query;
  334. }
  335. public IQueryable<ER_Score> GetScoreByExaminationSuspension(Expression<Func<ER_ExaminationSuspension, bool>> examinationSuspensionExp)
  336. {
  337. var query = (from suspension in ExaminationSuspensionRepository.GetList(examinationSuspensionExp)
  338. join finalExam in finalExaminationRepository.Entities
  339. on new { suspension.SchoolyearID, suspension.CoursematerialID, suspension.ExamsCategoryID }
  340. equals new { finalExam.SchoolyearID, finalExam.CoursematerialID, finalExam.ExamsCategoryID }
  341. from score in finalExam.ER_Score
  342. where suspension.UserID == score.UserID
  343. select score);
  344. return query;
  345. }
  346. public IQueryable<ER_Score> GetScoreByExaminationExemption(Expression<Func<ER_ExaminationExemption, bool>> examinationExemptsionExp)
  347. {
  348. var query = (from exemption in ExaminationExemptionRepository.GetList(examinationExemptsionExp)
  349. join finalExam in finalExaminationRepository.Entities
  350. on new { exemption.SchoolyearID, exemption.CoursematerialID, exemption.ExamsCategoryID }
  351. equals new { finalExam.SchoolyearID, finalExam.CoursematerialID, finalExam.ExamsCategoryID }
  352. from score in finalExam.ER_Score
  353. where exemption.UserID == score.UserID
  354. select score);
  355. return query;
  356. }
  357. //获取来源于期末设定的免修申请信息
  358. //public IQueryable<FinalExaminationView> GetExaminationExemptionFromFinalExamination(Expression<Func<ER_ExaminationExemption, bool>> examinationExemptsionExp)
  359. //{
  360. // var query = from exemption in ExaminationExemptionRepository.GetList(examinationExemptsionExp)
  361. // join finalExam in finalExaminationRepository.Entities
  362. // on new { exemption.SchoolyearID, exemption.CoursematerialID, exemption.ExamsCategoryID }
  363. // equals new { finalExam.SchoolyearID, finalExam.CoursematerialID, finalExam.ExamsCategoryID }
  364. // from finalStu in finalExam.ER_FinalExaminationStudent
  365. // where exemption.UserID == finalStu.UserID
  366. // select new FinalExaminationView
  367. // {
  368. // CollegeID=finalStu.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID,
  369. // SchoolyearID=finalExam.SchoolyearID,
  370. // DepartmentID=finalExam.DepartmentID,
  371. // ClassName=finalExam.ClassName,
  372. // CoursematerialID=finalExam.CoursematerialID,
  373. // CourseTypeID=finalExam.CourseTypeID,
  374. // ExamsCategoryID=finalExam.ExamsCategoryID,
  375. // ExaminationModeID=finalExam.ExaminationModeID,
  376. // Credit=finalExam.Credit,
  377. // ExamsDatetime=finalExam.ExamsDatetime,
  378. // ResultTypeID=finalExam.ResultTypeID,
  379. // EntryDeadlineTime=finalExam.EntryDeadlineTime,
  380. // IsEntry=finalExam.IsEntry?? false,
  381. // ExaminationType=finalExam.ExaminationType,
  382. // FinalExaminationID = finalExam.FinalExaminationID,
  383. // UserID = exemption.UserID,
  384. // StarttermID = finalStu.StarttermID,
  385. // SchooolYearNumID=finalStu.SchoolyearNumID,
  386. // GradeYearID=finalExam.GradeYearID,
  387. // TotalHours=finalExam.TotalHours
  388. // };
  389. // return query;
  390. //}
  391. //获取来源于教学任务的免修申请信息
  392. public IQueryable<FinalExaminationView> GetExaminationExemptionFromEducationMission(Expression<Func<ER_ExaminationExemption, bool>> examinationExemptsionExp)
  393. {
  394. var query = from exemption in ExaminationExemptionRepository.GetList(examinationExemptsionExp)
  395. join emc in EducationMissionClassRepository.Entities
  396. on exemption.CoursematerialID equals emc.CoursematerialID
  397. join em in EducationMissionRepository.Entities
  398. on new { EducationMission =(Guid)emc.EducationMissionID, exemption.SchoolyearID } equals new { EducationMission=em.EducationMissionID, em.SchoolyearID }
  399. from esc in emc.EM_EducationSchedulingClass
  400. from esccs in esc.CF_Student
  401. from emcs in emc.EM_EducationMissionClassSettings
  402. where exemption.UserID == esccs.UserID
  403. select new FinalExaminationView
  404. {
  405. CollegeID = esccs.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID,
  406. SchoolyearID = em.SchoolyearID,
  407. DepartmentID = em.DepartmentID,
  408. ClassName = emc.Name,
  409. CoursematerialID = emc.CoursematerialID,
  410. CourseTypeID = emc.CourseTypeID,
  411. ExaminationModeID = emc.ExaminationModeID,
  412. Credit = emc.EM_EducationMissionClassTeachingSetting.Credit,
  413. ResultTypeID = emc.ResultTypeID,
  414. UserID = exemption.UserID,
  415. //StarttermID = finalStu.StarttermID,
  416. //SchooolYearNumID = finalStu.SchoolyearNumID,
  417. GradeYearID = esccs.CF_Classmajor.CF_Grademajor.GradeID,
  418. TotalHours = emc.EM_EducationMissionClassTeachingSetting.TheoryCourse + emc.EM_EducationMissionClassTeachingSetting.Practicehours + emc.EM_EducationMissionClassTeachingSetting.Trialhours
  419. };
  420. return query;
  421. }
  422. public IQueryable<ER_Score> GetScoreByMisconduct(Expression<Func<ER_Misconduct, bool>> misconductExp)
  423. {
  424. var query = (from exemption in MisconductRepository.GetList(misconductExp)
  425. join finalExam in finalExaminationRepository.Entities
  426. on new { exemption.SchoolyearID, exemption.CoursematerialID, exemption.ExamsCategoryID }
  427. equals new { finalExam.SchoolyearID, finalExam.CoursematerialID, finalExam.ExamsCategoryID }
  428. from score in finalExam.ER_Score
  429. where exemption.UserID == score.UserID
  430. select score);
  431. return query;
  432. }
  433. }
  434. }