UniversityDAL.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Text;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel.UniversityManage.AdministrativeOrgan;
  8. using EMIS.DataLogic.Repositories;
  9. namespace EMIS.DataLogic.UniversityManage.AdministrativeOrgan
  10. {
  11. public class UniversityDAL
  12. {
  13. public UniversityRepository UniversityRepository { get; set; }
  14. public UniversityProfileRepository UniversityProfileRepository { get; set; }
  15. public UserRepository UserRepository { get; set; }
  16. /// <summary>
  17. /// 查询学校信息View
  18. /// </summary>
  19. /// <returns></returns>
  20. public IQueryable<UniversityView> GetUniversityViewQueryable(Expression<Func<CF_University, bool>> expUniversity)
  21. {
  22. var query = from uy in UniversityRepository.GetList(expUniversity)
  23. join pf in UniversityProfileRepository.Entities
  24. on uy.UniversityID equals pf.UniversityID into temppf
  25. from uypf in temppf.DefaultIfEmpty()
  26. join pmus in UserRepository.Entities
  27. on uypf.PartyManageID equals pmus.UserID into temppm
  28. from uypm in temppm.DefaultIfEmpty()
  29. select new UniversityView
  30. {
  31. UniversityID = uy.UniversityID,
  32. Code = uy.Code,
  33. Name = uy.Name,
  34. SimpleName = uy.SimpleName,
  35. EnglishName = uy.EnglishName,
  36. ProvinceID = uypf.ProvinceID,
  37. CityID = uypf.CityID,
  38. DistrictID = uypf.DistrictID,
  39. PropertyID = uypf.PropertyID,
  40. SchoolTypeID = uypf.SchoolTypeID,
  41. ManagerID = uypf.ManagerID,
  42. FounderTypeID = uypf.FounderTypeID,
  43. SchoolLevelID = uypf.SchoolLevelID,
  44. HeadMasterName = uypf.HeadMasterName,
  45. PartyManageID = uypf.PartyManageID,
  46. PartyManageName = uypm.Name,
  47. LegalPersonName = uypf.LegalPersonName,
  48. BuildDate = uypf.BuildDate,
  49. AnniversaryDate = uypf.AnniversaryDate,
  50. SchoolBasis = uypf.SchoolBasis,
  51. SchoolMotto = uypf.SchoolMotto,
  52. SubjectCount = uypf.SubjectCount,
  53. Is211University = uypf.Is211University ?? false,
  54. IsKeyUniversity = uypf.IsKeyUniversity ?? false,
  55. IsAdultCollege = uypf.IsAdultCollege ?? false,
  56. IsPostCollege = uypf.IsPostCollege ?? false,
  57. IsNetCollege = uypf.IsNetCollege ?? false,
  58. Telephone = uypf.Telephone,
  59. ZIPCode = uypf.ZIPCode,
  60. Email = uypf.Email,
  61. FAX = uypf.FAX,
  62. PublicNum = uypf.PublicNum,
  63. HomePage = uypf.HomePage,
  64. Address = uypf.Address,
  65. EnglishAddress = uypf.EnglishAddress,
  66. HistoryEvolution = uypf.HistoryEvolution,
  67. Remark = uy.Remark,
  68. RecordStatus = uy.RecordStatus,
  69. CreateUserID = uy.CreateUserID,
  70. CreateTime = uy.CreateTime,
  71. ModifyUserID = uy.ModifyUserID,
  72. ModifyTime = uy.ModifyTime
  73. };
  74. return query;
  75. }
  76. }
  77. }