SupervisionCollegeDAL.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.SupervisionManage;
  6. using System.Linq.Expressions;
  7. using EMIS.Entities;
  8. using EMIS.DataLogic.Repositories;
  9. namespace EMIS.DataLogic.SupervisionManage
  10. {
  11. public class SupervisionCollegeDAL
  12. {
  13. public SupervisionCollegeRepository SupervisionCollegeRepository { get; set; }
  14. public CollegeRepository CollegeRepository { get; set; }
  15. public IQueryable<SupervisionCollegeView> GetSupervisionCollegeViewQuery(Expression<Func<SUP_SupervisionCollege, bool>> exp)
  16. {
  17. var sql = (from supervisionCollege in SupervisionCollegeRepository.GetList(exp)
  18. from college in CollegeRepository.Entities.Where(x => x.CollegeID == supervisionCollege.CollegeID).DefaultIfEmpty()
  19. select new SupervisionCollegeView
  20. {
  21. SupervisionCollegeID = supervisionCollege.SupervisionCollegeID,
  22. Name = supervisionCollege.Name,
  23. CollegeID = college.CollegeID,
  24. CollegeNo = college.No,
  25. CollegeName = college.Name
  26. });
  27. return sql;
  28. }
  29. }
  30. }