CollegeDAL.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMISOnline.Entities;
  6. using EMISOnline.DataLogic.Repositories;
  7. using System.Linq.Expressions;
  8. using EMISOnline.ViewModel.Educational;
  9. namespace EMISOnline.DataLogic.Educational
  10. {
  11. public class CollegeDAL
  12. {
  13. public CollegeRepository CollegeRepository { get; set; }
  14. public CampusRepository CampusRepository { get; set; }
  15. public IQueryable<CollegeView> GetCollegeList(Expression<Func<CF_College, bool>> exp)
  16. {
  17. var query = from col in CollegeRepository.Entities.Where(exp)
  18. join cap in CampusRepository.Entities on col.CampusID equals cap.CampusID
  19. select new CollegeView
  20. {
  21. CollegeID = col.CollegeID,
  22. CampusID = col.CampusID,
  23. No = col.No,
  24. Name = col.Name,
  25. EnglishName = col.EnglishName,
  26. ParentCollegeID = col.ParentCollegeID,
  27. HierarchyID = col.HierarchyID,
  28. SimpleName = col.SimpleName,
  29. RecordStatus = col.RecordStatus,
  30. CreateUserID = col.CreateUserID,
  31. CreateTime = col.CreateTime,
  32. ModifyUserID = col.ModifyUserID,
  33. ModifyTime = col.ModifyTime,
  34. CampusName = cap.Name,
  35. };
  36. return query;
  37. }
  38. }
  39. }