LevelScoreDAL.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. namespace EMIS.DataLogic.ScoreManage
  10. {
  11. public class LevelScoreDAL
  12. {
  13. public ExaminationScoreRepository examinationScoreRepository { get; set; }
  14. public ExaminationBatchProjectRepository examinationBatchProjectRepository { get; set; }
  15. public ExaminationBatchRepository examinationBatchRepository { get; set; }
  16. public ExaminationProjectRepository examinationProjectRepository { get; set; }
  17. public ProjectScoreRepository projectScoreRepository { get; set; }
  18. public LevelSettingRepository levelSettingRepository { get; set; }
  19. public StudentRepository studentRepository { get; set; }
  20. public ClassmajorRepository classmajorRepository { get; set; }
  21. public GrademajorRepository grademajorRepository { get; set; }
  22. public FacultymajorRepository facultymajorRepository { get; set; }
  23. public CollegeRepository collegeRepository { get; set; }
  24. public ExaminationScoreDAL examinationScoreDAL { get; set; }
  25. public IQueryable<LevelScoreView> GetLevelScoreViewQueryable(Expression<Func<ER_ProjectScore, bool>> psexp)
  26. {
  27. //var examinationScoreList = examinationScoreDAL.GetExaminationScoreView(esexp, x => true, x => true, x => true, x => true, x => true, x => true, x => true).ToList();
  28. var query = from psr in projectScoreRepository.Entities.Where(psexp)
  29. from epr in examinationProjectRepository.Entities.Where(x => x.ExaminationProjectID == psr.ExaminationProjectID)
  30. from lsr in levelSettingRepository.Entities.Where(x => x.LevelSettingID == psr.LevelSettingID)
  31. from stu in studentRepository.Entities.Where(x => x.UserID == psr.UserID)
  32. from cla in classmajorRepository.Entities.Where(x => x.ClassmajorID == stu.ClassmajorID)
  33. from gra in grademajorRepository.Entities.Where(x => x.GrademajorID == cla.GrademajorID)
  34. from fac in facultymajorRepository.Entities.Where(x => x.FacultymajorID == gra.FacultymajorID)
  35. from col in collegeRepository.Entities.Where(x => x.CollegeID == fac.CollegeID)
  36. select new LevelScoreView
  37. {
  38. ProjectScoreID = psr.ProjectScoreID,
  39. ExaminationTypeID = epr.ExaminationTypeID,
  40. ExaminationTypeName = epr.EX_ExaminationType.Name,
  41. ExaminationProjectID = psr.ExaminationProjectID,
  42. ExaminationProjectName = epr.Name,
  43. LevelSettingID = psr.LevelSettingID,
  44. LevelName = lsr.LevelName,
  45. UserID = psr.UserID,
  46. IDNumber = stu.IDNumber,
  47. CollegeID = col.CollegeID,
  48. CollegeName = col.Name,
  49. StandardID = fac.StandardID,
  50. ClassmajorID = cla.ClassmajorID,
  51. ClassmajorName = cla.Name,
  52. StudentNo = stu.StudentCardNo,
  53. CertificatesType = stu.CertificatesType,
  54. };
  55. return query;
  56. }
  57. }
  58. }