GraduationPreliminaryDAL.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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;
  8. using EMIS.ViewModel.ScoreManage;
  9. namespace EMIS.ExtensionLogic.DataLogic.GraduationManage
  10. {
  11. public class GraduationPreliminaryDAL : EMIS.DataLogic.GraduationManage.GraduationManage.GraduationPreliminaryDAL
  12. {
  13. /// <summary>
  14. /// 查询对应的毕业预审学生最终成绩信息StudentScoreView(根据相应的学生信息、毕业学期并且匹配执行计划)
  15. /// 注:学生最终成绩以执行计划为准(左连),未修习成绩默认为0分
  16. /// 注:匹配规则(以学生信息、课程信息为准,广中医个性化配置)
  17. /// </summary>
  18. /// <param name="expStudent"></param>
  19. /// <param name="expSchoolyear"></param>
  20. /// <returns></returns>
  21. public override IQueryable<StudentScoreView> GetGraPreStuFinScoreExecutablePlanViewQueryable(Expression<Func<CF_Student, bool>> expStudent,
  22. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear)
  23. {
  24. var graPreStudentList = from gpstu in this.GetGraPreStudentQueryable(expStudent, expSchoolyear)
  25. select gpstu;
  26. var graPreStuFinScoreList = from finsco in FinallyScoreRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE)
  27. join stu in graPreStudentList
  28. on finsco.UserID equals stu.UserID
  29. select new
  30. {
  31. FinallyScoreID = finsco.FinallyScoreID,
  32. SchoolyearID = finsco.SchoolyearID,
  33. UserID = finsco.UserID,
  34. CoursematerialID = finsco.CoursematerialID,
  35. CourseTypeID = finsco.CourseTypeID,
  36. SchoolyearNumID = finsco.SchoolyearNumID,
  37. StarttermID = finsco.StarttermID,
  38. ResultTypeID = finsco.ResultTypeID,
  39. CreateUserID = finsco.CreateUserID,
  40. Credit = finsco.Credit,
  41. TotalHours = finsco.TotalHours,
  42. ExamsCategoryID = finsco.ExamsCategoryID,
  43. ExamsStateID = finsco.ExamsStateID,
  44. TotalScore = finsco.TotalScore,
  45. ScoreCredit = finsco.ScoreCredit,
  46. GradePoint = finsco.GradePoint,
  47. CreateTime = finsco.CreateTime
  48. };
  49. var query = from stuep in this.GetGraPreStudentExecutablePlanViewQueryable(expStudent, expSchoolyear)
  50. join finsco in graPreStuFinScoreList
  51. on
  52. new { UserID = stuep.UserID, CoursematerialID = stuep.CoursematerialID }
  53. equals
  54. new { UserID = finsco.UserID.Value, CoursematerialID = finsco.CoursematerialID }
  55. into tempepfinsco
  56. from epfinsco in tempepfinsco.DefaultIfEmpty()
  57. select new StudentScoreView
  58. {
  59. SchoolyearID = stuep.SchoolyearID,
  60. SchoolyearCode = stuep.SchoolyearCode,
  61. UserID = stuep.UserID,
  62. CoursematerialID = stuep.CoursematerialID,
  63. CourseCode = stuep.CourseCode,
  64. CourseName = stuep.CourseName,
  65. CourseTypeID = stuep.CourseTypeID,
  66. SchoolyearNumID = stuep.SchoolyearNumID,
  67. StarttermID = stuep.StarttermID,
  68. ResultTypeID = stuep.ResultTypeID,
  69. Credit = stuep.Credit,
  70. //TotalHours = stuep.Totalhours,(执行计划总学时类型不对,暂时不处理)
  71. ExamsCategoryID = epfinsco.ExamsCategoryID,
  72. ExamsStateID = epfinsco.ExamsStateID,
  73. TotalScore = epfinsco.TotalScore ?? 0,
  74. ScoreCredit = epfinsco.ScoreCredit ?? 0
  75. };
  76. return query;
  77. }
  78. }
  79. }