EvaluationStudentSettingDetailServices.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using Bowin.Common.Linq;
  7. using Bowin.Common.Data;
  8. using Bowin.Common.Linq.Entity;
  9. using EMIS.Entities;
  10. using EMIS.ViewModel;
  11. using EMIS.ViewModel.EvaluationManage.StudentEvaluation;
  12. using EMIS.DataLogic.EvaluationManage.StudentEvaluation;
  13. using EMIS.CommonLogic.StudentManage.StudentStatistics;
  14. namespace EMIS.CommonLogic.EvaluationManage.StudentEvaluation
  15. {
  16. public class EvaluationStudentSettingDetailServices : BaseServices, IEvaluationStudentSettingDetailServices
  17. {
  18. public EvaluationStudentSettingDAL EvaluationStudentSettingDAL { get; set; }
  19. public Lazy<IInSchoolSettingServices> InSchoolSettingServices { get; set; }
  20. /// <summary>
  21. /// 查询对应的学评名单信息View
  22. /// </summary>
  23. /// <param name="configuretView"></param>
  24. /// <param name="schoolyearID"></param>
  25. /// <param name="campusID"></param>
  26. /// <param name="collegeID"></param>
  27. /// <param name="departmentID"></param>
  28. /// <param name="coursematerialID"></param>
  29. /// <param name="courseTypeID"></param>
  30. /// <param name="teachingModeID"></param>
  31. /// <param name="staffID"></param>
  32. /// <param name="evaluationTableID"></param>
  33. /// <param name="inSchoolStatus"></param>
  34. /// <param name="openState"></param>
  35. /// <param name="isEvaluation"></param>
  36. /// <param name="pageIndex"></param>
  37. /// <param name="pageSize"></param>
  38. /// <returns></returns>
  39. public IGridResultSet<EvaluationStudentSettingDetailView> GetEvaluationStudentSettingDetailViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID,
  40. Guid? departmentID, Guid? coursematerialID, int? courseTypeID, int? teachingModeID, Guid? staffID, Guid? evaluationTableID, int? inSchoolStatus, int? openState, int? isEvaluation, int pageIndex, int pageSize)
  41. {
  42. Expression<Func<EM_EvaluationStudentSetting, bool>> expEvaluationStudentSetting = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  43. if (staffID.HasValue)
  44. {
  45. expEvaluationStudentSetting = expEvaluationStudentSetting.And(x => x.UserID == staffID);
  46. }
  47. if (evaluationTableID.HasValue)
  48. {
  49. expEvaluationStudentSetting = expEvaluationStudentSetting.And(x => x.EvaluationTableID == evaluationTableID);
  50. }
  51. if (openState.HasValue)
  52. {
  53. if (openState.Value == (int)CF_GeneralPurpose.IsYes)
  54. {
  55. expEvaluationStudentSetting = expEvaluationStudentSetting.And(x => x.OpenState == true);
  56. }
  57. if (openState.Value == (int)CF_GeneralPurpose.IsNo)
  58. {
  59. expEvaluationStudentSetting = expEvaluationStudentSetting.And(x => x.OpenState != true);
  60. }
  61. }
  62. Expression<Func<EM_EducationMissionClass, bool>> expEducationMissionClass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  63. if (coursematerialID.HasValue)
  64. {
  65. expEducationMissionClass = expEducationMissionClass.And(x => x.CoursematerialID == coursematerialID);
  66. }
  67. if (courseTypeID.HasValue)
  68. {
  69. expEducationMissionClass = expEducationMissionClass.And(x => x.CourseTypeID == courseTypeID);
  70. }
  71. if (teachingModeID.HasValue)
  72. {
  73. expEducationMissionClass = expEducationMissionClass.And(x => x.TeachingModeID == teachingModeID);
  74. }
  75. Expression<Func<EM_EducationMission, bool>> expEducationMission = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  76. if (schoolyearID.HasValue)
  77. {
  78. expEducationMission = expEducationMission.And(x => x.SchoolyearID == schoolyearID);
  79. }
  80. if (collegeID.HasValue)
  81. {
  82. expEducationMission = expEducationMission.And(x => x.CollegeID == collegeID);
  83. }
  84. if (departmentID.HasValue)
  85. {
  86. expEducationMission = expEducationMission.And(x => x.DepartmentID == departmentID);
  87. }
  88. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  89. if (inSchoolStatus != null && inSchoolStatus > -1)
  90. {
  91. var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
  92. if (inSchoolStatus == 1)
  93. {
  94. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  95. }
  96. if (inSchoolStatus == 0)
  97. {
  98. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  99. }
  100. }
  101. var query = EvaluationStudentSettingDAL.GetEvaluationStudentSettingDetailViewQueryable(expEvaluationStudentSetting, expEducationMissionClass, expEducationMission, expStudent);
  102. if (campusID.HasValue)
  103. {
  104. query = query.Where(x => x.CampusID == campusID);
  105. }
  106. if (isEvaluation.HasValue)
  107. {
  108. if (isEvaluation.Value == (int)CF_GeneralPurpose.IsYes)
  109. {
  110. query = query.Where(x => x.IsEvaluation == true);
  111. }
  112. if (isEvaluation.Value == (int)CF_GeneralPurpose.IsNo)
  113. {
  114. query = query.Where(x => x.IsEvaluation != true);
  115. }
  116. }
  117. //查询条件
  118. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  119. {
  120. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  121. }
  122. return this.GetQueryByDataRangeByDepartment(query, x => x.DepartmentID).OrderBy(x => x.SchoolyearValue).ThenBy(x => x.DepartmentNo.Length).ThenBy(x => x.DepartmentNo)
  123. .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ThenBy(x => x.CourseTypeID).ThenBy(x => x.TeachingModeID).ThenBy(x => x.StudentNo).ToGridResultSet<EvaluationStudentSettingDetailView>(pageIndex, pageSize);
  124. }
  125. /// <summary>
  126. /// 查询对应的学评名单信息List
  127. /// </summary>
  128. /// <param name="configuretView"></param>
  129. /// <param name="schoolyearID"></param>
  130. /// <param name="campusID"></param>
  131. /// <param name="collegeID"></param>
  132. /// <param name="departmentID"></param>
  133. /// <param name="coursematerialID"></param>
  134. /// <param name="courseTypeID"></param>
  135. /// <param name="teachingModeID"></param>
  136. /// <param name="staffID"></param>
  137. /// <param name="evaluationTableID"></param>
  138. /// <param name="inSchoolStatus"></param>
  139. /// <param name="openState"></param>
  140. /// <param name="isEvaluation"></param>
  141. /// <returns></returns>
  142. public IList<EvaluationStudentSettingDetailView> GetEvaluationStudentSettingDetailViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID,
  143. Guid? departmentID, Guid? coursematerialID, int? courseTypeID, int? teachingModeID, Guid? staffID, Guid? evaluationTableID, int? inSchoolStatus, int? openState, int? isEvaluation)
  144. {
  145. Expression<Func<EM_EvaluationStudentSetting, bool>> expEvaluationStudentSetting = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  146. if (staffID.HasValue)
  147. {
  148. expEvaluationStudentSetting = expEvaluationStudentSetting.And(x => x.UserID == staffID);
  149. }
  150. if (evaluationTableID.HasValue)
  151. {
  152. expEvaluationStudentSetting = expEvaluationStudentSetting.And(x => x.EvaluationTableID == evaluationTableID);
  153. }
  154. if (openState.HasValue)
  155. {
  156. if (openState.Value == (int)CF_GeneralPurpose.IsYes)
  157. {
  158. expEvaluationStudentSetting = expEvaluationStudentSetting.And(x => x.OpenState == true);
  159. }
  160. if (openState.Value == (int)CF_GeneralPurpose.IsNo)
  161. {
  162. expEvaluationStudentSetting = expEvaluationStudentSetting.And(x => x.OpenState != true);
  163. }
  164. }
  165. Expression<Func<EM_EducationMissionClass, bool>> expEducationMissionClass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  166. if (coursematerialID.HasValue)
  167. {
  168. expEducationMissionClass = expEducationMissionClass.And(x => x.CoursematerialID == coursematerialID);
  169. }
  170. if (courseTypeID.HasValue)
  171. {
  172. expEducationMissionClass = expEducationMissionClass.And(x => x.CourseTypeID == courseTypeID);
  173. }
  174. if (teachingModeID.HasValue)
  175. {
  176. expEducationMissionClass = expEducationMissionClass.And(x => x.TeachingModeID == teachingModeID);
  177. }
  178. Expression<Func<EM_EducationMission, bool>> expEducationMission = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  179. if (schoolyearID.HasValue)
  180. {
  181. expEducationMission = expEducationMission.And(x => x.SchoolyearID == schoolyearID);
  182. }
  183. if (collegeID.HasValue)
  184. {
  185. expEducationMission = expEducationMission.And(x => x.CollegeID == collegeID);
  186. }
  187. if (departmentID.HasValue)
  188. {
  189. expEducationMission = expEducationMission.And(x => x.DepartmentID == departmentID);
  190. }
  191. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  192. if (inSchoolStatus != null && inSchoolStatus > -1)
  193. {
  194. var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
  195. if (inSchoolStatus == 1)
  196. {
  197. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  198. }
  199. if (inSchoolStatus == 0)
  200. {
  201. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  202. }
  203. }
  204. var query = EvaluationStudentSettingDAL.GetEvaluationStudentSettingDetailViewQueryable(expEvaluationStudentSetting, expEducationMissionClass, expEducationMission, expStudent);
  205. if (campusID.HasValue)
  206. {
  207. query = query.Where(x => x.CampusID == campusID);
  208. }
  209. if (isEvaluation.HasValue)
  210. {
  211. if (isEvaluation.Value == (int)CF_GeneralPurpose.IsYes)
  212. {
  213. query = query.Where(x => x.IsEvaluation == true);
  214. }
  215. if (isEvaluation.Value == (int)CF_GeneralPurpose.IsNo)
  216. {
  217. query = query.Where(x => x.IsEvaluation != true);
  218. }
  219. }
  220. //查询条件
  221. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  222. {
  223. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  224. }
  225. return this.GetQueryByDataRangeByDepartment(query, x => x.DepartmentID).OrderBy(x => x.SchoolyearValue).ThenBy(x => x.DepartmentNo.Length).ThenBy(x => x.DepartmentNo)
  226. .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ThenBy(x => x.CourseTypeID).ThenBy(x => x.TeachingModeID).ThenBy(x => x.StudentNo).ToList();
  227. }
  228. }
  229. }