CollegePriorityDAL.cs 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.SchedulingManage;
  9. using EMIS.DataLogic.Repositories;
  10. namespace EMIS.DataLogic.SchedulingManage.SchedulingSettings
  11. {
  12. public class CollegePriorityDAL
  13. {
  14. public CollegePriorityRepository CollegePriorityRepository { get; set; }
  15. public CollegeRepository CollegeRepository { get; set; }
  16. public CampusRepository CampusRepository { get; set; }
  17. public UserRepository UserRepository { get; set; }
  18. /// <summary>
  19. /// 查询院系控制信息CollegePriorityView(排课优先级、开始日期、结束日期等)
  20. /// </summary>
  21. /// <param name="exp"></param>
  22. /// <returns></returns>
  23. public IQueryable<CollegePriorityView> GetCollegePriorityViewQueryable(Expression<Func<ES_CollegePriority, bool>> exp)
  24. {
  25. var query = from cp in CollegePriorityRepository.GetList(exp)
  26. join col in CollegeRepository.Entities
  27. on cp.CollegeID equals col.CollegeID
  28. join cam in CampusRepository.Entities
  29. on col.CampusID equals cam.CampusID
  30. join cus in UserRepository.Entities
  31. on cp.CreateUserID equals cus.UserID into tempcus
  32. from cpcus in tempcus.DefaultIfEmpty()
  33. select new CollegePriorityView
  34. {
  35. CollegePriorityID = cp.CollegePriorityID,
  36. CollegeID = cp.CollegeID,
  37. CollegeNo = col.No,
  38. CollegeName = col.Name,
  39. UnitCategoryID = col.CF_CollegeProfile.UnitCategoryID,
  40. CampusID = col.CampusID,
  41. CampusNo = cam.No,
  42. CampusName = cam.Name,
  43. Priority = cp.Priority,
  44. StartDate = cp.StartDate,
  45. EndDate = cp.EndDate,
  46. RecordStatus = cp.RecordStatus,
  47. CreateUserID = cp.CreateUserID,
  48. CreateUserName = cpcus.Name,
  49. CreateTime = cp.CreateTime,
  50. ModifyUserID = cp.ModifyUserID,
  51. ModifyTime = cp.ModifyTime
  52. };
  53. return query;
  54. }
  55. /// <summary>
  56. /// 查询院系控制中未新增的院系所信息CollegeView
  57. /// </summary>
  58. /// <param name="expCollege"></param>
  59. /// <param name="expCollegePriority"></param>
  60. /// <returns></returns>
  61. public IQueryable<CollegeView> GetCollegeViewNoAddQueryable(Expression<Func<CF_College, bool>> expCollege, Expression<Func<ES_CollegePriority, bool>> expCollegePriority)
  62. {
  63. var query = from col in CollegeRepository.GetList(expCollege)
  64. join cam in CampusRepository.Entities
  65. on col.CampusID equals cam.CampusID
  66. join cp in CollegePriorityRepository.GetList(expCollegePriority)
  67. on col.CollegeID equals cp.CollegeID into tempcp
  68. from colcp in tempcp.DefaultIfEmpty()
  69. where colcp.CollegePriorityID == null
  70. select new CollegeView
  71. {
  72. CollegeID = col.CollegeID,
  73. No = col.No,
  74. Name = col.Name,
  75. SimpleName = col.SimpleName,
  76. CampusID = col.CampusID,
  77. CampusNo = cam.No,
  78. CampusName = cam.Name,
  79. UnitCategoryID = col.CF_CollegeProfile.UnitCategoryID,
  80. CollegeTypeID = col.CF_CollegeProfile.CollegeTypeID,
  81. CollegeCategoryID = col.CF_CollegeProfile.CollegeCategoryID,
  82. Officephone = col.CF_CollegeProfile.Officephone,
  83. Remark = col.Remark,
  84. RecordStatus = col.RecordStatus,
  85. CreateUserID = col.CreateUserID,
  86. CreateTime = col.CreateTime,
  87. ModifyUserID = col.ModifyUserID,
  88. ModifyTime = col.ModifyTime
  89. };
  90. return query;
  91. }
  92. }
  93. }