EducationMissionOpenControlDAL.cs 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel.UniversityManage.AdministrativeOrgan;
  8. using EMIS.ViewModel.EducationManage;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.EducationManage
  11. {
  12. public class EducationMissionOpenControlDAL
  13. {
  14. public EducationMissionOpenControlRepository EducationMissionOpenControlRepository { get; set; }
  15. public CollegeRepository CollegeRepository { get; set; }
  16. public CampusRepository CampusRepository { get; set; }
  17. public UserRepository UserRepository { get; set; }
  18. /// <summary>
  19. /// 查询对应的教学任务控制信息View
  20. /// </summary>
  21. /// <param name="exp"></param>
  22. /// <returns></returns>
  23. public IQueryable<EducationMissionOpenControlView> GetEducationMissionOpenControlViewQueryable(Expression<Func<EM_EducationMissionOpenControl, bool>> exp)
  24. {
  25. var query = from ec in EducationMissionOpenControlRepository.GetList(exp)
  26. join cus in UserRepository.Entities
  27. on ec.CreateUserID equals cus.UserID into tempcus
  28. from eccus in tempcus.DefaultIfEmpty()
  29. select new EducationMissionOpenControlView
  30. {
  31. EducationMissionOpenControlID = ec.EducationMissionOpenControlID,
  32. CollegeID = ec.CollegeID,
  33. CollegeNo = ec.CF_College.No,
  34. CollegeName = ec.CF_College.Name,
  35. UnitCategoryID = ec.CF_College.CF_CollegeProfile.UnitCategoryID,
  36. CampusID = ec.CF_College.CampusID,
  37. CampusNo = ec.CF_College.CF_Campus.No,
  38. CampusName = ec.CF_College.CF_Campus.Name,
  39. SchoolyearID = ec.SchoolyearID,
  40. SchoolyearCode = ec.CF_Schoolyear.Code,
  41. Value = ec.CF_Schoolyear.Value,
  42. StartDate = ec.StartDate,
  43. EndDate = ec.EndDate,
  44. RecordStatus = ec.RecordStatus,
  45. CreateUserID = ec.CreateUserID,
  46. CreateUserName = eccus.Name,
  47. CreateTime = ec.CreateTime,
  48. ModifyUserID = ec.ModifyUserID,
  49. ModifyTime = ec.ModifyTime
  50. };
  51. return query;
  52. }
  53. /// <summary>
  54. /// 查询教学控制中未新增的院系所信息CollegeView
  55. /// </summary>
  56. /// <param name="expCollege"></param>
  57. /// <param name="expEduOpenControl"></param>
  58. /// <returns></returns>
  59. public IQueryable<CollegeView> GetCollegeViewNoAddQueryable(Expression<Func<CF_College, bool>> expCollege, Expression<Func<EM_EducationMissionOpenControl, bool>> expEduOpenControl)
  60. {
  61. var query = from col in CollegeRepository.GetList(expCollege)
  62. join cam in CampusRepository.Entities
  63. on col.CampusID equals cam.CampusID
  64. join ec in EducationMissionOpenControlRepository.GetList(expEduOpenControl)
  65. on col.CollegeID equals ec.CollegeID into tempec
  66. from colec in tempec.DefaultIfEmpty()
  67. where colec.EducationMissionOpenControlID == null
  68. select new CollegeView
  69. {
  70. CollegeID = col.CollegeID,
  71. No = col.No,
  72. Name = col.Name,
  73. SimpleName = col.SimpleName,
  74. CampusID = col.CampusID,
  75. CampusNo = cam.No,
  76. CampusName = cam.Name,
  77. UnitCategoryID = col.CF_CollegeProfile.UnitCategoryID,
  78. CollegeTypeID = col.CF_CollegeProfile.CollegeTypeID,
  79. CollegeCategoryID = col.CF_CollegeProfile.CollegeCategoryID,
  80. Officephone = col.CF_CollegeProfile.Officephone,
  81. Remark = col.Remark,
  82. RecordStatus = col.RecordStatus,
  83. CreateUserID = col.CreateUserID,
  84. CreateTime = col.CreateTime,
  85. ModifyUserID = col.ModifyUserID,
  86. ModifyTime = col.ModifyTime
  87. };
  88. return query;
  89. }
  90. }
  91. }