ScoreConvertByLevelDAL.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.ScoreManage;
  6. using System.Linq.Expressions;
  7. using EMIS.Entities;
  8. using EMIS.DataLogic.Repositories;
  9. namespace EMIS.DataLogic.ScoreManage
  10. {
  11. public class ScoreConvertByLevelDAL
  12. {
  13. public ScoreConvertByLevelScoreRepository ScoreConvertByLevelScoreRepository { get; set; }
  14. public UserRepository UserRepository { get; set; }
  15. public LevelScoreRepository LevelScoreRepository { get; set; }
  16. public StudentRepository StudentRepository { get; set; }
  17. public CollegeRepository CollegeRepository { get; set; }
  18. public FacultymajorRepository FacultymajorRepository { get; set; }
  19. public GrademajorRepository GrademajorRepository { get; set; }
  20. public ClassmajorRepository ClassmajorRepository { get; set; }
  21. public CoursematerialRepository CoursematerialRepository { get; set; }
  22. public ExaminationSubjectRepository ExaminationSubjectRepository { get; set; }
  23. public SchoolyearRepository SchoolyearRepository { get; set; }
  24. public IQueryable<ScoreConvertByLevelView> GetScoreConvertByLevelViewQueryable(Expression<Func<ER_ScoreConvertByLevelScore, bool>> exp)
  25. {
  26. var query = from convert in ScoreConvertByLevelScoreRepository.GetList(exp)
  27. from scy in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == convert.SchoolyearID)
  28. from ls in LevelScoreRepository.Entities.Where(x => x.LevelScoreID == convert.LevelScoreID)
  29. from es in ExaminationSubjectRepository.Entities.Where(x => x.ExaminationSubjectID == ls.ExaminationSubjectID)
  30. from user in UserRepository.Entities.Where(x => x.UserID == ls.UserID)
  31. from stu in StudentRepository.Entities.Where(x => x.UserID == user.UserID)
  32. from clas in ClassmajorRepository.Entities.Where(x => x.ClassmajorID == stu.ClassmajorID)
  33. from grade in GrademajorRepository.Entities.Where(x => x.GrademajorID == clas.GrademajorID)
  34. from faculty in FacultymajorRepository.Entities.Where(x => x.FacultymajorID == grade.FacultymajorID)
  35. from college in CollegeRepository.Entities.Where(x => x.CollegeID == faculty.CollegeID)
  36. from course in CoursematerialRepository.Entities.Where(x => convert.CoursematerialID == x.CoursematerialID)
  37. select new ScoreConvertByLevelView
  38. {
  39. ScoreConvertByLevelScoreID = convert.ScoreConvertByLevelScoreID,
  40. SchoolyearID = convert.SchoolyearID,
  41. SchoolyearCode = scy.Code,
  42. CollegeID = college.CollegeID,
  43. CollegeName = college.Name,
  44. Year = grade.GradeID,
  45. StandardID = faculty.StandardID,
  46. ClassmajorID = clas.ClassmajorID,
  47. ClassmajorName = clas.Name,
  48. LoginID = user.LoginID,
  49. UserID = user.UserID,
  50. UserName = user.Name,
  51. CourseCode = course.CourseCode,
  52. CoursematerialID = course.CoursematerialID,
  53. CourseName = course.CourseName,
  54. Score = convert.TotalScore,
  55. LevelScoreID = ls.LevelScoreID,
  56. LeveLScore = ls.TotalScore,
  57. ExaminationSubjectName = es.Name
  58. };
  59. return query;
  60. }
  61. }
  62. }