SchoolyearDAL.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. namespace EMISOnline.DataLogic.Student
  11. {
  12. public class SchoolyearDAL
  13. {
  14. public StudentRepository StudentRepository { get; set; }
  15. public SchoolyearRepository SchoolyearRepository { get; set; }
  16. public ExecutablePlanRepository ExecutablePlanRepository { get; set; }
  17. public ClassmajorRepository ClassmajorRepository { get; set; }
  18. public GrademajorRepository GrademajorRepository { get; set; }
  19. public IQueryable<CF_Schoolyear> GetSutdentSchoolyear(Expression<Func<CF_Student, bool>> stuExpression)
  20. {
  21. var query = from s in SchoolyearRepository.Entities
  22. join g in GrademajorRepository.Entities on s.Years equals g.SchoolyearID
  23. join c in ClassmajorRepository.Entities on g.GrademajorID equals c.GrademajorID
  24. join stu in StudentRepository.GetList(stuExpression) on c.ClassmajorID equals stu.ClassmajorID
  25. where s.SchoolcodeID == g.SchoolcodeID
  26. select s;
  27. return query;
  28. }
  29. /// <summary>
  30. /// 获取当前学校教学年
  31. /// </summary>
  32. /// <param name="stuExpression"></param>
  33. /// <returns></returns>
  34. public CF_Schoolyear GetCurSchoolyear()
  35. {
  36. var query = SchoolyearRepository.GetSingle(w=>w.IsCurrent);
  37. return query;
  38. }
  39. }
  40. }