EvaluationGradeControlServices.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Text;
  6. using Bowin.Common.Linq;
  7. using Bowin.Common.Linq.Entity;
  8. using Bowin.Common.Utility;
  9. using EMIS.Entities;
  10. using EMIS.ViewModel;
  11. using EMIS.ViewModel.EvaluationManage.EvaluationSetting;
  12. using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
  13. using EMIS.DataLogic.EvaluationManage.EvaluationSetting;
  14. using EMIS.CommonLogic.StudentManage.StudentStatistics;
  15. namespace EMIS.CommonLogic.EvaluationManage.EvaluationSetting
  16. {
  17. public class EvaluationGradeControlServices : BaseServices, IEvaluationGradeControlServices
  18. {
  19. public Lazy<EvaluationGradeControlDAL> EvaluationGradeControlDAL { get; set; }
  20. public Lazy<IInSchoolSettingServices> InSchoolSettingServices { get; set; }
  21. /// <summary>
  22. /// 查询对应的年级专业评价控制信息View
  23. /// </summary>
  24. /// <param name="configuretView"></param>
  25. /// <param name="schoolyearID"></param>
  26. /// <param name="campusID"></param>
  27. /// <param name="collegeID"></param>
  28. /// <param name="gradeID"></param>
  29. /// <param name="standardID"></param>
  30. /// <param name="educationID"></param>
  31. /// <param name="learningformID"></param>
  32. /// <param name="learnSystem"></param>
  33. /// <param name="semesterID"></param>
  34. /// <param name="dateRange"></param>
  35. /// <param name="inSchoolStatus"></param>
  36. /// <param name="pageIndex"></param>
  37. /// <param name="pageSize"></param>
  38. /// <returns></returns>
  39. public IGridResultSet<EvaluationGradeControlView> GetEvaluationGradeControlViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID,
  40. int? gradeID, int? standardID, int? educationID, int? learningformID, string learnSystem, int? semesterID, DateTime? dateRange, int? inSchoolStatus, int pageIndex, int pageSize)
  41. {
  42. Expression<Func<EM_EvaluationGradeControl, bool>> expEvaluationGradeControl = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  43. if (schoolyearID.HasValue)
  44. {
  45. expEvaluationGradeControl = expEvaluationGradeControl.And(x => x.SchoolyearID == schoolyearID);
  46. }
  47. if (dateRange.HasValue)
  48. {
  49. expEvaluationGradeControl = expEvaluationGradeControl.And(x => x.StartTime <= dateRange);
  50. }
  51. if (dateRange.HasValue)
  52. {
  53. expEvaluationGradeControl = expEvaluationGradeControl.And(x => x.EndTime >= dateRange);
  54. }
  55. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  56. if (inSchoolStatus != null && inSchoolStatus > -1)
  57. {
  58. var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
  59. if (inSchoolStatus == 1)
  60. {
  61. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  62. }
  63. if (inSchoolStatus == 0)
  64. {
  65. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  66. }
  67. }
  68. var query = EvaluationGradeControlDAL.Value.GetEvaluationGradeControlViewQueryable(expEvaluationGradeControl, expStudent);
  69. if (campusID.HasValue)
  70. {
  71. query = query.Where(x => x.CampusID == campusID);
  72. }
  73. if (collegeID.HasValue)
  74. {
  75. query = query.Where(x => x.CollegeID == collegeID);
  76. }
  77. if (gradeID.HasValue)
  78. {
  79. query = query.Where(x => x.GradeID == gradeID);
  80. }
  81. if (standardID.HasValue)
  82. {
  83. query = query.Where(x => x.StandardID == standardID);
  84. }
  85. if (educationID.HasValue)
  86. {
  87. query = query.Where(x => x.EducationID == educationID);
  88. }
  89. if (learningformID.HasValue)
  90. {
  91. query = query.Where(x => x.LearningformID == learningformID);
  92. }
  93. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  94. {
  95. var LearnSystems = Convert.ToDecimal(learnSystem);
  96. query = query.Where(x => x.LearnSystem == LearnSystems);
  97. }
  98. if (semesterID.HasValue)
  99. {
  100. query = query.Where(x => x.SemesterID == semesterID);
  101. }
  102. //查询条件
  103. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  104. {
  105. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  106. }
  107. return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenBy(x => x.StandardID)
  108. .ThenBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode).OrderBy(x => x.SchoolyearValue).ToGridResultSet<EvaluationGradeControlView>(pageIndex, pageSize);
  109. }
  110. /// <summary>
  111. /// 查询对应的年级专业评价控制信息List
  112. /// </summary>
  113. /// <param name="configuretView"></param>
  114. /// <param name="schoolyearID"></param>
  115. /// <param name="campusID"></param>
  116. /// <param name="collegeID"></param>
  117. /// <param name="gradeID"></param>
  118. /// <param name="standardID"></param>
  119. /// <param name="educationID"></param>
  120. /// <param name="learningformID"></param>
  121. /// <param name="learnSystem"></param>
  122. /// <param name="semesterID"></param>
  123. /// <param name="dateRange"></param>
  124. /// <param name="inSchoolStatus"></param>
  125. /// <returns></returns>
  126. public IList<EvaluationGradeControlView> GetEvaluationGradeControlViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID,
  127. int? gradeID, int? standardID, int? educationID, int? learningformID, string learnSystem, int? semesterID, DateTime? dateRange, int? inSchoolStatus)
  128. {
  129. Expression<Func<EM_EvaluationGradeControl, bool>> expEvaluationGradeControl = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  130. if (schoolyearID.HasValue)
  131. {
  132. expEvaluationGradeControl = expEvaluationGradeControl.And(x => x.SchoolyearID == schoolyearID);
  133. }
  134. if (dateRange.HasValue)
  135. {
  136. expEvaluationGradeControl = expEvaluationGradeControl.And(x => x.StartTime <= dateRange);
  137. }
  138. if (dateRange.HasValue)
  139. {
  140. expEvaluationGradeControl = expEvaluationGradeControl.And(x => x.EndTime >= dateRange);
  141. }
  142. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  143. if (inSchoolStatus != null && inSchoolStatus > -1)
  144. {
  145. var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
  146. if (inSchoolStatus == 1)
  147. {
  148. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  149. }
  150. if (inSchoolStatus == 0)
  151. {
  152. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  153. }
  154. }
  155. var query = EvaluationGradeControlDAL.Value.GetEvaluationGradeControlViewQueryable(expEvaluationGradeControl, expStudent);
  156. if (campusID.HasValue)
  157. {
  158. query = query.Where(x => x.CampusID == campusID);
  159. }
  160. if (collegeID.HasValue)
  161. {
  162. query = query.Where(x => x.CollegeID == collegeID);
  163. }
  164. if (gradeID.HasValue)
  165. {
  166. query = query.Where(x => x.GradeID == gradeID);
  167. }
  168. if (standardID.HasValue)
  169. {
  170. query = query.Where(x => x.StandardID == standardID);
  171. }
  172. if (educationID.HasValue)
  173. {
  174. query = query.Where(x => x.EducationID == educationID);
  175. }
  176. if (learningformID.HasValue)
  177. {
  178. query = query.Where(x => x.LearningformID == learningformID);
  179. }
  180. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  181. {
  182. var LearnSystems = Convert.ToDecimal(learnSystem);
  183. query = query.Where(x => x.LearnSystem == LearnSystems);
  184. }
  185. if (semesterID.HasValue)
  186. {
  187. query = query.Where(x => x.SemesterID == semesterID);
  188. }
  189. //查询条件
  190. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  191. {
  192. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  193. }
  194. return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo).ThenBy(x => x.StandardID)
  195. .ThenBy(x => x.GrademajorCode.Length).ThenBy(x => x.GrademajorCode).OrderBy(x => x.SchoolyearValue).ToList();
  196. }
  197. /// <summary>
  198. /// 查询对应的年级专业评价控制信息EvaluationGradeControlView
  199. /// </summary>
  200. /// <param name="evaluationGradeControlID"></param>
  201. /// <returns></returns>
  202. public EvaluationGradeControlView GetEvaluationGradeControlView(Guid? evaluationGradeControlID)
  203. {
  204. try
  205. {
  206. var query = EvaluationGradeControlDAL.Value.GetEvaluationGradeControlViewQueryable(x => x.EvaluationGradeControlID == evaluationGradeControlID).SingleOrDefault();
  207. return query;
  208. }
  209. catch (Exception ex)
  210. {
  211. throw new Exception(ex.Message);
  212. }
  213. }
  214. /// <summary>
  215. /// 编辑(注:学年学期在入学学年学期和毕业学年学期范围内)
  216. /// </summary>
  217. /// <param name="evaluationGradeControlView"></param>
  218. public void EvaluationGradeControlEdit(EvaluationGradeControlView evaluationGradeControlView)
  219. {
  220. try
  221. {
  222. var evaluationGradeControlVerify = EvaluationGradeControlDAL.Value.EvaluationGradeControlRepository.GetList(x => x.EvaluationGradeControlID != evaluationGradeControlView.EvaluationGradeControlID
  223. && x.SchoolyearID == evaluationGradeControlView.SchoolyearID && x.GrademajorID == evaluationGradeControlView.GrademajorID).SingleOrDefault();
  224. if (evaluationGradeControlVerify == null)
  225. {
  226. if (!evaluationGradeControlView.SchoolyearID.HasValue)
  227. {
  228. throw new Exception("学年学期不能为空。");
  229. }
  230. var schoolyear = EvaluationGradeControlDAL.Value.SchoolyearRepository.GetList(x => x.SchoolyearID == evaluationGradeControlView.SchoolyearID).SingleOrDefault();
  231. if (!evaluationGradeControlView.GrademajorID.HasValue)
  232. {
  233. throw new Exception("年级专业不能为空。");
  234. }
  235. var grademajor = EvaluationGradeControlDAL.Value.GrademajorRepository.GetList(x => x.GrademajorID == evaluationGradeControlView.GrademajorID).SingleOrDefault();
  236. if (grademajor == null)
  237. {
  238. throw new Exception("年级专业信息不存在。");
  239. }
  240. var startSchoolyear = EvaluationGradeControlDAL.Value.SchoolyearRepository.GetList(x => x.Years == grademajor.GradeID && x.SchoolcodeID == grademajor.SemesterID).SingleOrDefault();
  241. var graduateSchoolyear = EvaluationGradeControlDAL.Value.SchoolyearRepository.GetList(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault();
  242. if (startSchoolyear.Value > schoolyear.Value)
  243. {
  244. throw new Exception("对应的年级专业中入学学年学期大于当前选择的学年学期(不在入学学年学期范围内)。");
  245. }
  246. if (graduateSchoolyear.Value < schoolyear.Value)
  247. {
  248. throw new Exception("对应的年级专业中毕业学年学期小于当前选择的学年学期(不在毕业学年学期范围内)。");
  249. }
  250. if (evaluationGradeControlView.EvaluationGradeControlID != Guid.Empty)
  251. {
  252. var evaluationGradeControl = EvaluationGradeControlDAL.Value.EvaluationGradeControlRepository.GetList(x => x.EvaluationGradeControlID == evaluationGradeControlView.EvaluationGradeControlID).SingleOrDefault();
  253. if (evaluationGradeControl == null)
  254. {
  255. throw new Exception("数据有误,请核查。");
  256. }
  257. else
  258. {
  259. //表示修改
  260. evaluationGradeControl.SchoolyearID = evaluationGradeControlView.SchoolyearID;
  261. evaluationGradeControl.GrademajorID = evaluationGradeControlView.GrademajorID;
  262. evaluationGradeControl.Number = evaluationGradeControlView.Number;
  263. evaluationGradeControl.StartTime = evaluationGradeControlView.StartTime;
  264. evaluationGradeControl.EndTime = evaluationGradeControlView.EndTime;
  265. SetModifyStatus(evaluationGradeControl);
  266. }
  267. }
  268. else
  269. {
  270. //表示新增
  271. var newEvaluationGradeControl = new EM_EvaluationGradeControl();
  272. newEvaluationGradeControl.EvaluationGradeControlID = Guid.NewGuid();
  273. newEvaluationGradeControl.SchoolyearID = evaluationGradeControlView.SchoolyearID;
  274. newEvaluationGradeControl.GrademajorID = evaluationGradeControlView.GrademajorID;
  275. newEvaluationGradeControl.Number = evaluationGradeControlView.Number;
  276. newEvaluationGradeControl.StartTime = evaluationGradeControlView.StartTime;
  277. newEvaluationGradeControl.EndTime = evaluationGradeControlView.EndTime;
  278. SetNewStatus(newEvaluationGradeControl);
  279. UnitOfWork.Add(newEvaluationGradeControl);
  280. }
  281. }
  282. else
  283. {
  284. throw new Exception("已存在相同的评价控制信息(学年学期、年级专业唯一),请核查。");
  285. }
  286. UnitOfWork.Commit();
  287. }
  288. catch (Exception ex)
  289. {
  290. throw new Exception(ex.Message);
  291. }
  292. }
  293. /// <summary>
  294. /// 批量新增(注:学年学期在入学学年学期和毕业学年学期范围内)
  295. /// </summary>
  296. /// <param name="grademajorIDList"></param>
  297. /// <param name="evaluationGradeControlView"></param>
  298. /// <returns></returns>
  299. public string EvaluationGradeControlBatchAdd(List<Guid?> grademajorIDList, EvaluationGradeControlView evaluationGradeControlView)
  300. {
  301. try
  302. {
  303. Expression<Func<EM_EvaluationGradeControl, bool>> expEvaluationGradeControl = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  304. expEvaluationGradeControl = expEvaluationGradeControl.And(x => grademajorIDList.Contains(x.GrademajorID));
  305. var evaluationGradeControlList = EvaluationGradeControlDAL.Value.EvaluationGradeControlRepository.GetList(expEvaluationGradeControl).ToList();
  306. var schoolyearList = EvaluationGradeControlDAL.Value.SchoolyearRepository.GetList(x => true).ToList();
  307. var schoolyear = schoolyearList.Where(x => x.SchoolyearID == evaluationGradeControlView.SchoolyearID).SingleOrDefault();
  308. if(schoolyear == null)
  309. {
  310. throw new Exception("学年学期信息不存在。");
  311. }
  312. var grademajorList = EvaluationGradeControlDAL.Value.GrademajorRepository.GetList(x => grademajorIDList.Contains(x.GrademajorID)).ToList();
  313. int success = 0;
  314. int fail = 0;
  315. string tipMessage = null;
  316. var evaluationGradeControlInList = new List<EM_EvaluationGradeControl>();
  317. foreach (var grademajorID in grademajorIDList)
  318. {
  319. var grademajor = grademajorList.Where(x => x.GrademajorID == grademajorID).SingleOrDefault();
  320. if (grademajor == null)
  321. {
  322. throw new Exception("年级专业信息不存在。");
  323. }
  324. var startSchoolyear = schoolyearList.Where(x => x.Years == grademajor.GradeID && x.SchoolcodeID == grademajor.SemesterID).SingleOrDefault();
  325. if (startSchoolyear.Value <= schoolyear.Value)
  326. {
  327. var graduateSchoolyear = schoolyearList.Where(x => x.SchoolyearID == grademajor.GraduateSchoolyearID).SingleOrDefault();
  328. if (graduateSchoolyear.Value >= schoolyear.Value)
  329. {
  330. var evaluationGradeControlVerify = evaluationGradeControlList.Where(x => x.GrademajorID == grademajorID && x.SchoolyearID == evaluationGradeControlView.SchoolyearID).SingleOrDefault();
  331. if (evaluationGradeControlVerify == null)
  332. {
  333. //新增
  334. var evaluationGradeControl = new EM_EvaluationGradeControl();
  335. evaluationGradeControl.EvaluationGradeControlID = Guid.NewGuid();
  336. evaluationGradeControl.SchoolyearID = evaluationGradeControlView.SchoolyearID;
  337. evaluationGradeControl.GrademajorID = grademajorID;
  338. evaluationGradeControl.Number = evaluationGradeControlView.Number;
  339. evaluationGradeControl.StartTime = evaluationGradeControlView.StartTime;
  340. evaluationGradeControl.EndTime = evaluationGradeControlView.EndTime;
  341. SetNewStatus(evaluationGradeControl);
  342. evaluationGradeControlInList.Add(evaluationGradeControl);
  343. success++;
  344. }
  345. else
  346. {
  347. //表示已存在相同的评价控制信息
  348. fail++;
  349. }
  350. }
  351. else
  352. {
  353. //表示对应的年级专业中毕业学年学期小于当前选择的学年学期(不在毕业学年学期范围内)
  354. fail++;
  355. }
  356. }
  357. else
  358. {
  359. //表示对应的年级专业中入学学年学期大于当前选择的学年学期(不在入学学年学期范围内)
  360. fail++;
  361. }
  362. }
  363. UnitOfWork.BulkInsert(evaluationGradeControlInList);
  364. if (success > 0 && fail <= 0)
  365. {
  366. tipMessage = success + "条";
  367. }
  368. else
  369. {
  370. tipMessage = success + "条," + fail + "条失败,原因:不在入学学年学期范围内、不在毕业学年学期范围内或已存在相同的评价控制信息(学年学期、年级专业唯一),请检查";
  371. }
  372. return tipMessage;
  373. }
  374. catch (Exception ex)
  375. {
  376. throw new Exception(ex.Message);
  377. }
  378. }
  379. /// <summary>
  380. /// 查询年级专业评价控制中未新增年级专业信息View
  381. /// </summary>
  382. /// <param name="configuretView"></param>
  383. /// <param name="campusID"></param>
  384. /// <param name="collegeID"></param>
  385. /// <param name="gradeID"></param>
  386. /// <param name="standardID"></param>
  387. /// <param name="educationID"></param>
  388. /// <param name="learningformID"></param>
  389. /// <param name="learnSystem"></param>
  390. /// <param name="inSchoolStatus"></param>
  391. /// <param name="schoolyearID"></param>
  392. /// <param name="pageIndex"></param>
  393. /// <param name="pageSize"></param>
  394. /// <returns></returns>
  395. public IGridResultSet<GrademajorView> GetGrademajorViewNoAddGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID,
  396. int? educationID, int? learningformID, string learnSystem, int? inSchoolStatus, Guid? schoolyearID, int pageIndex, int pageSize)
  397. {
  398. Expression<Func<EM_EvaluationGradeControl, bool>> expEvaluationGradeControl = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  399. expEvaluationGradeControl = expEvaluationGradeControl.And(x => x.SchoolyearID == schoolyearID);
  400. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  401. if (inSchoolStatus != null && inSchoolStatus > -1)
  402. {
  403. var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
  404. if (inSchoolStatus == 1)
  405. {
  406. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  407. }
  408. if (inSchoolStatus == 0)
  409. {
  410. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  411. }
  412. }
  413. var query = EvaluationGradeControlDAL.Value.GetGrademajorViewNoAddQueryable(expEvaluationGradeControl, expStudent);
  414. if (schoolyearID.HasValue)
  415. {
  416. var schoolyear = EvaluationGradeControlDAL.Value.SchoolyearRepository.GetList(x => x.SchoolyearID == schoolyearID).SingleOrDefault();
  417. query = query.Where(x => x.StartValue <= schoolyear.Value);
  418. query = query.Where(x => x.GraduateValue >= schoolyear.Value);
  419. }
  420. if (campusID.HasValue)
  421. {
  422. query = query.Where(x => x.CampusID == campusID);
  423. }
  424. if (collegeID.HasValue)
  425. {
  426. query = query.Where(x => x.CollegeID == collegeID);
  427. }
  428. if (gradeID.HasValue)
  429. {
  430. query = query.Where(x => x.GradeID == gradeID);
  431. }
  432. if (standardID.HasValue)
  433. {
  434. query = query.Where(x => x.StandardID == standardID);
  435. }
  436. if (educationID.HasValue)
  437. {
  438. query = query.Where(x => x.EducationID == educationID);
  439. }
  440. if (learningformID.HasValue)
  441. {
  442. query = query.Where(x => x.LearningformID == learningformID);
  443. }
  444. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  445. {
  446. var LearnSystems = Convert.ToDecimal(learnSystem);
  447. query = query.Where(x => x.LearnSystem == LearnSystems);
  448. }
  449. //查询条件
  450. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  451. {
  452. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  453. }
  454. return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode).ThenBy(x => x.StandardID)
  455. .ThenBy(x => x.Code.Length).ThenBy(x => x.Code).ToGridResultSet<GrademajorView>(pageIndex, pageSize);
  456. }
  457. /// <summary>
  458. /// 查询年级专业评价控制中未新增年级专业信息List
  459. /// </summary>
  460. /// <param name="configuretView"></param>
  461. /// <param name="campusID"></param>
  462. /// <param name="collegeID"></param>
  463. /// <param name="gradeID"></param>
  464. /// <param name="standardID"></param>
  465. /// <param name="educationID"></param>
  466. /// <param name="learningformID"></param>
  467. /// <param name="learnSystem"></param>
  468. /// <param name="inSchoolStatus"></param>
  469. /// <param name="schoolyearID"></param>
  470. /// <param name="pageIndex"></param>
  471. /// <param name="pageSize"></param>
  472. /// <returns></returns>
  473. public IList<GrademajorView> GetGrademajorViewNoAddList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID, int? standardID,
  474. int? educationID, int? learningformID, string learnSystem, int? inSchoolStatus, Guid? schoolyearID, int pageIndex, int pageSize)
  475. {
  476. Expression<Func<EM_EvaluationGradeControl, bool>> expEvaluationGradeControl = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  477. expEvaluationGradeControl = expEvaluationGradeControl.And(x => x.SchoolyearID == schoolyearID);
  478. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  479. if (inSchoolStatus != null && inSchoolStatus > -1)
  480. {
  481. var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
  482. if (inSchoolStatus == 1)
  483. {
  484. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  485. }
  486. if (inSchoolStatus == 0)
  487. {
  488. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  489. }
  490. }
  491. var query = EvaluationGradeControlDAL.Value.GetGrademajorViewNoAddQueryable(expEvaluationGradeControl, expStudent);
  492. if (schoolyearID.HasValue)
  493. {
  494. var schoolyear = EvaluationGradeControlDAL.Value.SchoolyearRepository.GetList(x => x.SchoolyearID == schoolyearID).SingleOrDefault();
  495. query = query.Where(x => x.StartValue <= schoolyear.Value);
  496. query = query.Where(x => x.GraduateValue >= schoolyear.Value);
  497. }
  498. if (campusID.HasValue)
  499. {
  500. query = query.Where(x => x.CampusID == campusID);
  501. }
  502. if (collegeID.HasValue)
  503. {
  504. query = query.Where(x => x.CollegeID == collegeID);
  505. }
  506. if (gradeID.HasValue)
  507. {
  508. query = query.Where(x => x.GradeID == gradeID);
  509. }
  510. if (standardID.HasValue)
  511. {
  512. query = query.Where(x => x.StandardID == standardID);
  513. }
  514. if (educationID.HasValue)
  515. {
  516. query = query.Where(x => x.EducationID == educationID);
  517. }
  518. if (learningformID.HasValue)
  519. {
  520. query = query.Where(x => x.LearningformID == learningformID);
  521. }
  522. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  523. {
  524. var LearnSystems = Convert.ToDecimal(learnSystem);
  525. query = query.Where(x => x.LearnSystem == LearnSystems);
  526. }
  527. //查询条件
  528. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  529. {
  530. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  531. }
  532. return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode).ThenBy(x => x.StandardID)
  533. .ThenBy(x => x.Code.Length).ThenBy(x => x.Code).ToList();
  534. }
  535. /// <summary>
  536. /// 删除
  537. /// </summary>
  538. /// <param name="evaluationGradeControlIDs"></param>
  539. /// <returns></returns>
  540. public bool EvaluationGradeControlDelete(List<Guid?> evaluationGradeControlIDs)
  541. {
  542. try
  543. {
  544. UnitOfWork.Delete<EM_EvaluationGradeControl>(x => evaluationGradeControlIDs.Contains(x.EvaluationGradeControlID));
  545. return true;
  546. }
  547. catch (Exception)
  548. {
  549. throw;
  550. }
  551. }
  552. }
  553. }