UniversityDAL.cs 4.2 KB

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