NotPassStudentDAL.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.ScoreManage;
  6. using EMIS.DataLogic.Repositories;
  7. using EMIS.Entities;
  8. using System.Linq.Expressions;
  9. namespace EMIS.DataLogic.ScoreManage
  10. {
  11. public class NotPassStudentDAL
  12. {
  13. public FinallyScoreRepository finallyScoreRepository { get; set; }
  14. public UserRepository userRepository { get; set; }
  15. public IQueryable<NotPassStudentView> GetScoreViewQueryable(Expression<Func<Sys_User, bool>> exp)
  16. {
  17. var query = from score in finallyScoreRepository.Entities
  18. group score by score.UserID
  19. into a
  20. join user in userRepository.GetList(exp)
  21. on a.Key equals user.UserID
  22. select new NotPassStudentView
  23. {
  24. UserID = a.Key,
  25. UserName = user.Name,
  26. LoginID = user.LoginID,
  27. CampusID = user.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CF_College.CF_Campus.CampusID,
  28. CampusName = user.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CF_College.CF_Campus.Name,
  29. Years = user.CF_Student.CF_Classmajor.CF_Grademajor.CF_Schoolyear.Years,
  30. StandardID = user.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID,
  31. ClassMajorID = user.CF_Student.CF_Classmajor.ClassmajorID,
  32. ClassMajorName = user.CF_Student.CF_Classmajor.Name,
  33. NotPassCount = a.Count(x => x.TotalScore < 60),
  34. };
  35. return query;
  36. }
  37. }
  38. }