FinalExaminationDAL.cs 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.ScoreManage;
  6. using EMIS.ViewModel;
  7. namespace EMIS.ExtensionLogic.DataLogic.ScoreManage
  8. {
  9. public class FinalExaminationDAL : EMIS.DataLogic.ScoreManage.FinalExaminationDAL
  10. {
  11. /// <summary>
  12. /// 补考设定,加上学时
  13. /// </summary>
  14. /// <param name="schoolyearID"></param>
  15. /// <returns></returns>
  16. public override IQueryable<ResitStudentView> GetNotPassStudent(Guid? schoolyearID)
  17. {
  18. List<int?> resitStatus = ExamsStateSettingDAL.Value.GetResitIDList();
  19. var query = from fs in FinallyScoreRepository.GetList(x => (x.TotalScore == null || x.TotalScore < 60) && x.SchoolyearID == schoolyearID && x.ExamsCategoryID == (int)CF_ExamsCategory.FinalExam && resitStatus.Contains(x.ExamsStateID))
  20. from s in studentRepository.Entities.Where(x => fs.UserID == x.UserID)
  21. join iss in InSchoolSettingRepository.GetList(x => x.IsSelected == true)
  22. on s.InSchoolStatusID equals iss.InSchoolStatusID
  23. join exam in ExamsStateSettingRepository.Entities
  24. on fs.ExamsStateID equals exam.ExamsStateID
  25. from fe in finalExaminationRepository.Entities.Where(x => x.SchoolyearID == schoolyearID && x.CoursematerialID == fs.CoursematerialID
  26. && x.ExamsCategoryID == fs.ExamsCategoryID)
  27. from fesr in FinalExaminationStudentRepository.Entities.Where(x => x.FinalExaminationID == fe.FinalExaminationID
  28. && x.UserID == fs.UserID && x.StarttermID == fs.StarttermID)
  29. //join final in finalExaminationRepository.GetList(x => x.SchoolyearID == schoolyearID)
  30. // on fesr.FinalExaminationID equals final.FinalExaminationID
  31. // into dfianl
  32. //from final in dfianl.DefaultIfEmpty()
  33. from erfes in (
  34. from student in FinalExaminationStudentRepository.Entities
  35. from final in finalExaminationRepository.Entities.Where(x => x.FinalExaminationID == student.FinalExaminationID)
  36. where final.CoursematerialID == fs.CoursematerialID && student.UserID == fs.UserID && student.StarttermID == fs.StarttermID
  37. && final.ExamsCategoryID == exam.ResitCategory && student.CreateTime > fs.CreateTime
  38. select student
  39. ).DefaultIfEmpty()
  40. where erfes.FinalExaminationStudentID == null
  41. select new ResitStudentView
  42. {
  43. UserID = fs.CF_Student.UserID,
  44. FinalExaminationID = fesr.FinalExaminationID,
  45. Year = fs.CF_Student.CF_Classmajor.CF_Grademajor.GradeID,
  46. CourseCollegeID = fs.CF_Department.CollegeID,
  47. CollegeID = fs.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID,
  48. StandardID = fs.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID,
  49. GrademajorID = fs.CF_Student.CF_Classmajor.GrademajorID,
  50. GrademajorName = fs.CF_Student.CF_Classmajor.CF_Grademajor.Name,
  51. CoursematerialID = fs.CoursematerialID,
  52. DepartmentID = fs.DepartmentID,
  53. CourseName = fs.EM_Coursematerial.CourseName,
  54. CourseTypeID = fs.CourseTypeID,
  55. ExaminationModeID = fs.ExaminationModeID,
  56. SchoolyearNumID = fs.SchoolyearNumID,
  57. StartTermID = fs.StarttermID,
  58. Credit = fs.Credit,
  59. //加上学时
  60. TotalHours = fs.TotalHours,
  61. ResultTypeID = fs.ResultTypeID,
  62. ClassmajorID = fs.CF_Student.CF_Classmajor.ClassmajorID,
  63. ExamsCategoryID = exam.ResitCategory,
  64. CreatorUserID = fs.CreatorUserID,
  65. };
  66. return query;
  67. }
  68. }
  69. }