SpecialtyApplyDAL.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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;
  8. using EMIS.ViewModel.EnrollManage.SpecialtyManage;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.EnrollManage.SpecialtyManage
  11. {
  12. public class SpecialtyApplyDAL
  13. {
  14. public SpecialtyApplyRepository specialtyApplyRepository { get; set; }
  15. public SpecialtyRepository specialtyRepository { get; set; }
  16. public CollegeRepository collegeRepository { get; set; }
  17. public CampusRepository campusRepository { get; set; }
  18. public DictionaryItemRepository dictionaryItemRepository { get; set; }
  19. public RecruitSpecialtyRepository recruitSpecialtyRepository { get; set; }
  20. public UserRepository userRepository { get; set; }
  21. /// <summary>
  22. /// 查询专业申请信息SpecialtyApplyView
  23. /// </summary>
  24. /// <param name="exp">条件查询</param>
  25. /// <returns></returns>
  26. public IQueryable<SpecialtyApplyView> GetSpecialtyApplyViewQueryable(Expression<Func<CF_SpecialtyApply, bool>> exp)
  27. {
  28. var query = from spay in specialtyApplyRepository.GetList(exp)
  29. join sp in specialtyRepository.Entities
  30. on spay.SpecialtyID equals sp.SpecialtyID
  31. join col in collegeRepository.Entities
  32. on spay.CollegeID equals col.CollegeID
  33. join cam in campusRepository.Entities
  34. on col.CampusID equals cam.CampusID
  35. join stan in dictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_Standard.ToString())
  36. on sp.StandardID equals stan.Value into tempstan
  37. from dtstan in tempstan.DefaultIfEmpty()
  38. join crus in userRepository.Entities
  39. on spay.CreateUserID equals crus.UserID into tempcrus
  40. from spaycrus in tempcrus.DefaultIfEmpty()
  41. select new SpecialtyApplyView
  42. {
  43. SpecialtyApplyID = spay.SpecialtyApplyID,
  44. SpecialtyID = spay.SpecialtyID,
  45. StandardID = sp.StandardID,
  46. StandardCode = dtstan.Code,
  47. StandardName = dtstan.Name,
  48. CollegeID = spay.CollegeID,
  49. CollegeCode = col.No,
  50. CollegeName = col.Name,
  51. CampusID = col.CampusID,
  52. CampusCode = cam.No,
  53. CampusName = cam.Name,
  54. GradeID = spay.GradeID,
  55. SemesterID = spay.SemesterID,
  56. EducationID = sp.EducationID,
  57. LearningformID = sp.LearningformID,
  58. LearnSystem = sp.LearnSystem,
  59. ScienceclassID = sp.ScienceclassID,
  60. StandardTitle = sp.StandardTitle,
  61. StandardLevel = sp.StandardLevel,
  62. PropertyID = sp.PropertyID,
  63. ApprovalStatus = spay.ApprovalStatus,
  64. Remark = spay.Remark,
  65. RecordStatus = spay.RecordStatus,
  66. CreateUserID = spay.CreateUserID,
  67. CreateUserCode = spaycrus.LoginID,
  68. CreateUserName = spaycrus.Name,
  69. CreateTime = spay.CreateTime,
  70. ModifyUserID = spay.ModifyUserID,
  71. ModifyTime = spay.ModifyTime
  72. };
  73. return query;
  74. }
  75. /// <summary>
  76. /// 查询未进行申请的专业信息SpecialtyView
  77. /// </summary>
  78. /// <param name="expSpecialty"></param>
  79. /// <param name="expSpecialtyApply"></param>
  80. /// <param name="expRecruitSpecialty"></param>
  81. /// <returns></returns>
  82. public IQueryable<SpecialtyView> GetSpecialtyViewNoApplyQueryable(Expression<Func<CF_Specialty, bool>> expSpecialty,
  83. Expression<Func<CF_SpecialtyApply, bool>> expSpecialtyApply, Expression<Func<CF_RecruitSpecialty, bool>> expRecruitSpecialty)
  84. {
  85. var query = from sp in specialtyRepository.GetList(expSpecialty)
  86. join stan in dictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_Standard.ToString())
  87. on sp.StandardID equals stan.Value into tempstan
  88. from dtstan in tempstan.DefaultIfEmpty()
  89. join spay in specialtyApplyRepository.GetList(expSpecialtyApply)
  90. on sp.SpecialtyID equals spay.SpecialtyID into tempspay
  91. from spapply in tempspay.DefaultIfEmpty()
  92. join rs in recruitSpecialtyRepository.GetList(expRecruitSpecialty)
  93. on sp.SpecialtyID equals rs.SpecialtyID into temprs
  94. from rsp in temprs.DefaultIfEmpty()
  95. where spapply.SpecialtyApplyID == null && rsp.RecruitSpecialtyID == null
  96. select new SpecialtyView
  97. {
  98. SpecialtyID = sp.SpecialtyID,
  99. StandardID = sp.StandardID,
  100. StandardCode = dtstan.Code,
  101. StandardName = dtstan.Name,
  102. EducationID = sp.EducationID,
  103. LearningformID = sp.LearningformID,
  104. LearnSystem = sp.LearnSystem,
  105. ScienceclassID = sp.ScienceclassID,
  106. PropertyID = sp.PropertyID,
  107. StandardTitle = sp.StandardTitle,
  108. StandardLevel = sp.StandardLevel,
  109. RecordStatus = sp.RecordStatus,
  110. Remark = sp.Remark,
  111. CreateUserID = sp.CreateUserID,
  112. CreateTime = sp.CreateTime,
  113. ModifyUserID = sp.ModifyUserID,
  114. ModifyTime = sp.ModifyTime,
  115. };
  116. return query;
  117. }
  118. }
  119. }