CampusDAL.cs 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. namespace EMIS.DataLogic.Common.AdministrativeOrgan
  10. {
  11. public class CampusDAL
  12. {
  13. public CampusRepository CampusRepository { get; set; }
  14. public CampusProfileRepository CampusProfileRepository { get; set; }
  15. public UserRepository UserRepository { get; set; }
  16. /// <summary>
  17. /// 查询对应的校区信息View
  18. /// </summary>
  19. /// <param name="expCampus"></param>
  20. /// <returns></returns>
  21. public IQueryable<CampusView> GetCampusViewQueryable(Expression<Func<CF_Campus, bool>> expCampus)
  22. {
  23. var query = from a in CampusRepository.GetList(expCampus)
  24. join c in UserRepository.Entities
  25. on a.CF_CampusProfile.Generalsuper equals c.UserID
  26. into gg
  27. from gGeneralsuper in gg.DefaultIfEmpty()
  28. join d in UserRepository.Entities
  29. on a.CF_CampusProfile.Recruitstudents equals d.UserID
  30. into gr
  31. from gRecruitstudents in gr.DefaultIfEmpty()
  32. join e in UserRepository.Entities
  33. on a.CF_CampusProfile.Placesuper equals e.UserID
  34. into gp
  35. from gPlacesuper in gp.DefaultIfEmpty()
  36. join f in UserRepository.Entities
  37. on a.CF_CampusProfile.Teachingsuper equals f.UserID
  38. into gt
  39. from gTeachingsuper in gt.DefaultIfEmpty()
  40. join g in UserRepository.Entities
  41. on a.CF_CampusProfile.Studentcharge equals g.UserID
  42. into gsc
  43. from gStudentcharge in gsc.DefaultIfEmpty()
  44. select new CampusView
  45. {
  46. CampusID = a.CampusID,
  47. UniversityID = a.UniversityID,
  48. No = a.No,
  49. Name = a.Name,
  50. SimpleName = a.SimpleName,
  51. EnglishName = a.EnglishName,
  52. UniversityCode = a.CF_University.Code,
  53. UniversityName = a.CF_University.Name,
  54. Generalsuper = a.CF_CampusProfile.Generalsuper,
  55. GeneralsuperName = gGeneralsuper.Name,
  56. Recruitstudents = a.CF_CampusProfile.Recruitstudents,
  57. RecruitstudentsName = gRecruitstudents.Name,
  58. Placesuper = a.CF_CampusProfile.Placesuper,
  59. PlacesuperName = gPlacesuper.Name,
  60. Teachingsuper = a.CF_CampusProfile.Teachingsuper,
  61. TeachingsuperName = gTeachingsuper.Name,
  62. Studentcharge = a.CF_CampusProfile.Studentcharge,
  63. StudentchargeName = gStudentcharge.Name,
  64. ZIPCode = a.CF_CampusProfile.ZIPCode,
  65. Officephone = a.CF_CampusProfile.Officephone,
  66. FAX = a.CF_CampusProfile.FAX,
  67. Email = a.CF_CampusProfile.Email,
  68. Evolution = a.CF_CampusProfile.Evolution,
  69. Remark = a.Remark,
  70. RecordStatus = a.RecordStatus,
  71. CreateUserID = a.CreateUserID,
  72. CreateTime = a.CreateTime,
  73. ModifyUserID = a.ModifyUserID,
  74. ModifyTime = a.ModifyTime
  75. };
  76. return query;
  77. }
  78. }
  79. }