MinorControlDAL.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.MinorManage.MinorSetting;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. namespace EMIS.DataLogic.MinorManage.MinorSetting
  10. {
  11. public class MinorControlDAL
  12. {
  13. public MinorControlRepository minorControlRepository { get; set; }
  14. public CollegeRepository collegeRepository { get; set; }
  15. public SchoolyearRepository schoolyearRepository { get; set; }
  16. public IQueryable<MinorControlView> GetMinorControlViewQueryable(Expression<Func<ER_MinorControl, bool>> exp)
  17. {
  18. var query = from mcr in minorControlRepository.GetList(exp)
  19. join cr in collegeRepository.Entities
  20. on mcr.CollegeID equals cr.CollegeID
  21. into gcr
  22. from gcrt in gcr.DefaultIfEmpty()
  23. join year in schoolyearRepository.Entities
  24. on mcr.SchoolyearID equals year.SchoolyearID
  25. select new MinorControlView
  26. {
  27. MinorControlID = mcr.MinorControlID,
  28. CollegeID = mcr.CollegeID,
  29. CollegeName = gcrt.Name,
  30. SchoolyearID = mcr.SchoolyearID,
  31. SchoolyearCode = year.Code,
  32. GradeYearID = mcr.GradeyearID,
  33. StartDate = mcr.StartDate,
  34. EndDate = mcr.EndDate
  35. };
  36. return query;
  37. }
  38. }
  39. }