CourseEaxmDAL.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Bowin.Common.Linq;
  6. using EMISOnline.Entities;
  7. using EMISOnline.DataLogic.Repositories;
  8. using EMISOnline.ViewModel.SystemView;
  9. using System.Linq.Expressions;
  10. using EMISOnline.ViewModel.Student;
  11. namespace EMISOnline.DataLogic.Student
  12. {
  13. public class CourseEaxmDAL
  14. {
  15. public onlinetestRepository onlinetestRepository { get; set; }
  16. /// <summary>
  17. /// 获取学生计划表
  18. /// </summary>
  19. /// <param name="SchoolcodeID"></param>
  20. /// <returns></returns>
  21. public IQueryable<CourseExamView> getStudentEaxmListbySchoolyear(Guid UserID, Guid SchoolcodeID)
  22. {
  23. var sql = from semc in onlinetestRepository.UnitOfWork.V_StudentEducationMissionClass.Where(w => w.UserID == UserID && w.SchoolyearID == SchoolcodeID)
  24. join t in onlinetestRepository.Entities on semc.EducationMissionClassID equals t.EducationMissionClassID
  25. join e in onlinetestRepository.UnitOfWork.ExamResult on t.onlinetest_id equals e.onlinetest_id into me
  26. from ee in me.DefaultIfEmpty()
  27. select new CourseExamView
  28. {
  29. CoursematerialID = semc.CoursematerialID,
  30. CourseName = semc.CourseName,
  31. test_name = t.test_name,
  32. ExamStatus = ee==null?2:ee.state,
  33. ExamScore = ee==null?0:ee.score,
  34. ExamStatusName = "",
  35. PassRate = t.PassRate,
  36. limited_minutes = t.limited_minutes,
  37. test_begin_date=t.test_begin_date, test_end_date=t.test_end_date};
  38. return sql;
  39. }
  40. }
  41. }