GraduationConditionServices.cs 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  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 EMIS.DataLogic.GraduationManage.GraduationSetting;
  8. using Bowin.Common.Linq.Entity;
  9. using EMIS.ViewModel.GraduationManage.GraduationSetting;
  10. using EMIS.ViewModel;
  11. using EMIS.Entities;
  12. using EMIS.CommonLogic.ChargeManage.ArrearsSituation;
  13. namespace EMIS.CommonLogic.GraduationManage.GraduationSetting
  14. {
  15. public class GraduationConditionServices : BaseServices, IGraduationConditionServices
  16. {
  17. public GraduationConditionDAL GraduationConditionDAL { get; set; }
  18. public IArrearsListServices ArrearsListServices { get; set; }
  19. /// <summary>
  20. /// 查询毕业条件信息View
  21. /// </summary>
  22. /// <param name="configuretView"></param>
  23. /// <param name="isCurrent"></param>
  24. /// <param name="pageIndex"></param>
  25. /// <param name="pageSize"></param>
  26. /// <returns></returns>
  27. public IGridResultSet<GraduationConditionView> GraduationConditionViewGrid(ConfiguretView configuretView, int? isCurrent,
  28. int pageIndex, int pageSize)
  29. {
  30. //毕业条件
  31. Expression<Func<ER_GraduationCondition, bool>> exp = (x => true);
  32. if (isCurrent.HasValue)
  33. {
  34. if (isCurrent == 1)
  35. {
  36. exp = exp.And(x => x.RecordStatus >= (int)SYS_STATUS.USABLE);
  37. }
  38. if (isCurrent == 0)
  39. {
  40. exp = exp.And(x => x.RecordStatus <= (int)SYS_STATUS.UNUSABLE);
  41. }
  42. }
  43. var query = GraduationConditionDAL.GetGraduationConditionQueryable(exp);
  44. //查询条件
  45. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  46. {
  47. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  48. }
  49. return query.OrderBy(x => x.OrderNo).ToGridResultSet<GraduationConditionView>(pageIndex, pageSize);
  50. }
  51. /// <summary>
  52. /// 查询毕业条件信息List
  53. /// </summary>
  54. /// <param name="configuretView"></param>
  55. /// <param name="isCurrent"></param>
  56. /// <returns></returns>
  57. public List<GraduationConditionView> GetGraduationViewList(ConfiguretView configuretView, int? isCurrent)
  58. {
  59. //毕业条件
  60. Expression<Func<ER_GraduationCondition, bool>> exp = (x => true);
  61. if (isCurrent.HasValue)
  62. {
  63. if (isCurrent == 1)
  64. {
  65. exp = exp.And(x => x.RecordStatus >= (int)SYS_STATUS.USABLE);
  66. }
  67. if (isCurrent == 0)
  68. {
  69. exp = exp.And(x => x.RecordStatus <= (int)SYS_STATUS.UNUSABLE);
  70. }
  71. }
  72. var query = GraduationConditionDAL.GetGraduationConditionQueryable(exp);
  73. //查询条件
  74. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  75. {
  76. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  77. }
  78. return query.OrderBy(x => x.OrderNo).ToList();
  79. }
  80. /// <summary>
  81. /// 根据毕业条件ID查询对应毕业条件GraduationConditionView
  82. /// </summary>
  83. /// <param name="GraduationConditionID"></param>
  84. /// <returns></returns>
  85. public GraduationConditionView GetGraduationConditionView(Guid? GraduationConditionID)
  86. {
  87. try
  88. {
  89. var query = GraduationConditionDAL
  90. .GetGraduationConditionQueryable(x => x.GraduationConditionID == GraduationConditionID)
  91. .SingleOrDefault();
  92. return query;
  93. }
  94. catch (Exception ex)
  95. {
  96. throw new Exception(ex.Message);
  97. }
  98. }
  99. /// <summary>
  100. /// 编辑
  101. /// </summary>
  102. /// <param name="graduationConditionView"></param>
  103. public void GraduationConditionEdit(GraduationConditionView graduationConditionView)
  104. {
  105. try
  106. {
  107. //查询数据库进行验证
  108. var graduationConditionVerification = GraduationConditionDAL.GraduationConditionRepository
  109. .GetList(x => x.GraduationConditionID != graduationConditionView.GraduationConditionID
  110. && x.Title == graduationConditionView.Title)
  111. .SingleOrDefault();
  112. if (graduationConditionVerification == null)
  113. {
  114. //数据有误验证
  115. if (graduationConditionView.GraduationConditionID != Guid.Empty)
  116. {
  117. var graduationCondition = GraduationConditionDAL.GraduationConditionRepository
  118. .GetList(x => x.GraduationConditionID == graduationConditionView.GraduationConditionID)
  119. .SingleOrDefault();
  120. if (graduationCondition == null)
  121. {
  122. throw new Exception("数据有误,请核查");
  123. }
  124. else
  125. {
  126. //表示修改
  127. graduationCondition.OrderNo = (short?)graduationConditionView.OrderNo;
  128. graduationCondition.Title = graduationConditionView.Title;
  129. graduationCondition.RecordStatus = graduationConditionView.IsEnable ? (int)SYS_STATUS.USABLE : (int)SYS_STATUS.UNUSABLE;
  130. SetModifyStatus(graduationCondition);
  131. }
  132. }
  133. else
  134. {
  135. //表示新增
  136. ER_GraduationCondition graduationCondition = new ER_GraduationCondition();
  137. graduationCondition.GraduationConditionID = Guid.NewGuid();
  138. graduationCondition.OrderNo = (short?)graduationConditionView.OrderNo;
  139. graduationCondition.Title = graduationConditionView.Title;
  140. graduationCondition.MethodFullName = graduationConditionView.MethodFullName;
  141. SetNewStatus(graduationCondition);
  142. UnitOfWork.Add(graduationCondition);
  143. }
  144. }
  145. else
  146. {
  147. throw new Exception("已存在相同条件名称的毕业条件,请核查");
  148. }
  149. //事务提交
  150. UnitOfWork.Commit();
  151. }
  152. catch (Exception ex)
  153. {
  154. throw new Exception(ex.Message);
  155. }
  156. }
  157. /// <summary>
  158. /// 无条件
  159. /// </summary>
  160. /// <param name="userID"></param>
  161. /// <returns></returns>
  162. public string NoCondition(Guid? userID)
  163. {
  164. return "Pass";
  165. }
  166. /// <summary>
  167. /// 所修课程(必修、限选)要求符合专业计划(不包括俱乐部课程)
  168. /// </summary>
  169. /// <param name="userID"></param>
  170. /// <returns></returns>
  171. public string SpecialtyPlanCourseComplete(Guid? userID)
  172. {
  173. try
  174. {
  175. //查询课程类型设置信息List
  176. var courseTypeSelectCourseTypeList = GraduationConditionDAL.CourseTypeSelectCourseTypeRepository
  177. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  178. if(courseTypeSelectCourseTypeList == null || courseTypeSelectCourseTypeList.Count() <= 0)
  179. {
  180. throw new Exception("课程类型设置未配置,请配置");
  181. }
  182. //学生信息表
  183. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  184. expStudent = expStudent.And(x => x.UserID == userID);
  185. //课程类型设置表(必修、限选)
  186. Expression<Func<EM_CourseTypeSelectCourseType, bool>> expCourseTypeSelectCourseType = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  187. expCourseTypeSelectCourseType = expCourseTypeSelectCourseType.And(x => x.IsRequired.Value || x.IsOptionalCourse.Value);
  188. //查询对应的学生成绩信息List
  189. var finallyScoreViewList = GraduationConditionDAL
  190. .GetFinallyScoreNoClubViewQueryable(expStudent, expCourseTypeSelectCourseType).ToList();
  191. if (finallyScoreViewList == null || finallyScoreViewList.Count() <= 0)
  192. {
  193. return "成绩为空";
  194. }
  195. //查询对应的学生专业计划信息List
  196. var studentSpecialtyPlanViewList = GraduationConditionDAL
  197. .GetStudentSpecialtyPlanViewQueryable(expStudent).ToList();
  198. if (studentSpecialtyPlanViewList == null || studentSpecialtyPlanViewList.Count() <= 0)
  199. {
  200. return "专业计划为空";
  201. }
  202. else
  203. {
  204. foreach (var finallyScoreView in finallyScoreViewList)
  205. {
  206. //根据课程信息、课程类型、课程学分进行比对(学时暂时不考虑)
  207. var specialtyPlanView = studentSpecialtyPlanViewList
  208. .Where(x => x.CoursematerialID == finallyScoreView.CoursematerialID
  209. && x.CourseTypeID == finallyScoreView.CourseTypeID
  210. && x.Credit == finallyScoreView.Credit).FirstOrDefault();
  211. if (specialtyPlanView == null)
  212. {
  213. return "所修习课程不符合专业计划(" + finallyScoreView.CourseName
  214. + "-" + finallyScoreView.CourseTypeName
  215. + "-" + Math.Round(finallyScoreView.ScoreCredit.Value, 1) + "-" + finallyScoreView.StarttermName + ")";
  216. }
  217. }
  218. }
  219. return "Pass";
  220. }
  221. catch (Exception ex)
  222. {
  223. throw new Exception(ex.Message);
  224. }
  225. }
  226. /// <summary>
  227. /// 所修课程(必修,不包括俱乐部课程)成绩要求全部及格(>=60)
  228. /// </summary>
  229. /// <param name="userID"></param>
  230. /// <returns></returns>
  231. public string LearnCourseScorePass(Guid? userID)
  232. {
  233. try
  234. {
  235. //查询课程类型设置信息List
  236. var courseTypeSelectCourseTypeList = GraduationConditionDAL.CourseTypeSelectCourseTypeRepository
  237. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  238. if (courseTypeSelectCourseTypeList == null || courseTypeSelectCourseTypeList.Count() <= 0)
  239. {
  240. throw new Exception("课程类型设置未配置,请配置");
  241. }
  242. //学生信息
  243. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  244. expStudent = expStudent.And(x => x.UserID == userID);
  245. //课程类型设置表(必修)
  246. Expression<Func<EM_CourseTypeSelectCourseType, bool>> expCourseTypeSelectCourseType = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  247. expCourseTypeSelectCourseType = expCourseTypeSelectCourseType.And(x => x.IsRequired.Value);
  248. //查询对应的学生成绩信息List
  249. var finallyScoreViewList = GraduationConditionDAL
  250. .GetFinallyScoreNoClubViewQueryable(expStudent, expCourseTypeSelectCourseType).ToList();
  251. //查询对应的专项理论课程ViewList
  252. var specialItemViewList = finallyScoreViewList
  253. .Where(x => x.CourseName.Contains("专项理论")).ToList();
  254. if (finallyScoreViewList == null || finallyScoreViewList.Count() <= 0)
  255. {
  256. return "成绩为空";
  257. }
  258. else
  259. {
  260. foreach (var finallyScoreView in finallyScoreViewList)
  261. {
  262. if (finallyScoreView.TotalScore.Value >= 60)
  263. {
  264. //专项理论
  265. if (specialItemViewList != null && specialItemViewList.Count() > 0)
  266. {
  267. if (finallyScoreView.CourseName.Contains("专项理论"))
  268. {
  269. //查询对应的专项理论课程List(根据开课学期)
  270. var specialItemList = specialItemViewList
  271. .Where(x => x.StarttermID == finallyScoreView.StarttermID)
  272. .ToList();
  273. if (specialItemList != null && specialItemList.Count() > 1)
  274. {
  275. return finallyScoreView.StarttermName + "专项理论课程重复";
  276. }
  277. }
  278. }
  279. }
  280. else
  281. {
  282. return finallyScoreView.CourseName + "课程不及格(" + finallyScoreView.StarttermName + ")";
  283. }
  284. }
  285. }
  286. return "Pass";
  287. }
  288. catch (Exception ex)
  289. {
  290. throw new Exception(ex.Message);
  291. }
  292. }
  293. /// <summary>
  294. /// 毕业课程要求修习且及格(>=60)
  295. /// </summary>
  296. /// <param name="userID"></param>
  297. /// <returns></returns>
  298. public string GraduationCourseComplete(Guid? userID)
  299. {
  300. try
  301. {
  302. //学生信息
  303. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  304. expStudent = expStudent.And(x => x.UserID == userID);
  305. //查询对应的毕业课程信息List
  306. var graduationCourseViewList = GraduationConditionDAL
  307. .GetGraduationCourseViewQueryable(expStudent).ToList();
  308. if (graduationCourseViewList == null || graduationCourseViewList.Count() <= 0)
  309. {
  310. return "未设置毕业课程,请设置";
  311. }
  312. //查询对应的学生成绩信息List
  313. var finallyScoreViewList = GraduationConditionDAL
  314. .GetFinallyScoreViewQueryable(expStudent).ToList();
  315. if (finallyScoreViewList == null || finallyScoreViewList.Count() <= 0)
  316. {
  317. return "成绩为空";
  318. }
  319. bool isForeignLanguage = true; //外国语
  320. bool isOtherElective = true; //特别的选修(主项中的副项,如:体教)
  321. bool isMajorElective = true; //主项选修
  322. bool isDeputyElective = true; //副项选修
  323. bool isSpecialtyElective = true; //专项选修
  324. bool isSpecialtyImprove = true; //专项提高
  325. foreach (var graduationCourseView in graduationCourseViewList)
  326. {
  327. //注:以下逻辑暂时这么处理
  328. if (graduationCourseView.CourseName.Trim().StartsWith("外国语"))
  329. {
  330. //外国语
  331. if (isForeignLanguage)
  332. {
  333. //根据课程名称进行比对(课程类型、课程学分、学时暂时不考虑)
  334. var foreignLanguageViewList = finallyScoreViewList
  335. .Where(x => x.CourseName.Trim().StartsWith("外国语")).ToList();
  336. if (foreignLanguageViewList != null && foreignLanguageViewList.Count() > 0)
  337. {
  338. foreach (var foreignLanguageView in foreignLanguageViewList)
  339. {
  340. if (foreignLanguageView.TotalScore < 60)
  341. {
  342. return foreignLanguageView.CourseName + "课程不及格";
  343. }
  344. //查询对应的外国语课程List(根据开课学期)
  345. var foreignLanguageList = foreignLanguageViewList
  346. .Where(x => x.StarttermID == foreignLanguageView.StarttermID)
  347. .ToList();
  348. if (foreignLanguageList != null && foreignLanguageList.Count() > 1)
  349. {
  350. return foreignLanguageView.StarttermName + "外国语课程重复";
  351. }
  352. }
  353. isForeignLanguage = false;
  354. }
  355. else
  356. {
  357. return "外国语课程未录入";
  358. }
  359. }
  360. }
  361. else if (graduationCourseView.CourseName.Trim().StartsWith("主项选修2"))
  362. {
  363. //特别的选修
  364. if (isOtherElective)
  365. {
  366. //根据课程名称进行比对(课程类型、课程学分、学时暂时不考虑)
  367. var otherElectiveViewList = finallyScoreViewList
  368. .Where(x => x.CourseName.Trim().StartsWith("主项选修2")).ToList();
  369. if (otherElectiveViewList != null && otherElectiveViewList.Count() > 0)
  370. {
  371. foreach (var otherElectiveView in otherElectiveViewList)
  372. {
  373. if (otherElectiveView.TotalScore < 60)
  374. {
  375. return otherElectiveView.CourseName + "课程不及格";
  376. }
  377. //查询对应的主项选修2课程List(根据开课学期)
  378. var otherElectiveList = otherElectiveViewList
  379. .Where(x => x.StarttermID == otherElectiveView.StarttermID)
  380. .ToList();
  381. if (otherElectiveList != null && otherElectiveList.Count() > 1)
  382. {
  383. return otherElectiveView.StarttermName + "主项选修2课程重复";
  384. }
  385. }
  386. isOtherElective = false;
  387. }
  388. else
  389. {
  390. return "主项选修2课程未录入";
  391. }
  392. }
  393. }
  394. else if (graduationCourseView.CourseName.Trim().StartsWith("主项选修"))
  395. {
  396. //主项选修
  397. if (isMajorElective)
  398. {
  399. //根据课程名称进行比对(课程类型、课程学分、学时暂时不考虑)
  400. var majorElectiveViewList = finallyScoreViewList.Where(x => x.CourseName.Trim().StartsWith("主项选修")
  401. && !x.CourseName.Trim().StartsWith("主项选修2")).ToList();
  402. if (majorElectiveViewList != null && majorElectiveViewList.Count() > 0)
  403. {
  404. foreach (var majorElectiveView in majorElectiveViewList)
  405. {
  406. if (majorElectiveView.TotalScore < 60)
  407. {
  408. return majorElectiveView.CourseName + "课程不及格";
  409. }
  410. //查询对应的主项选修课程List(根据开课学期)
  411. var majorElectiveList = majorElectiveViewList
  412. .Where(x => x.StarttermID == majorElectiveView.StarttermID)
  413. .ToList();
  414. if (majorElectiveList != null && majorElectiveList.Count() > 1)
  415. {
  416. return majorElectiveView.StarttermName + "主项选修课程重复";
  417. }
  418. }
  419. //var majorElectiveList = stuScoreList.Select(x => x.CourseName.Substring(0, x.CourseName.Length - 1))
  420. // .ToList();
  421. //if (majorElectiveList.Distinct().Count() > 1)
  422. //{
  423. // return "各主项选修课程不同类";
  424. //}
  425. isMajorElective = false;
  426. }
  427. else
  428. {
  429. return "主项选修课程未录入";
  430. }
  431. }
  432. }
  433. else if (graduationCourseView.CourseName.Trim().StartsWith("副项选修"))
  434. {
  435. //副项选修
  436. if (isDeputyElective)
  437. {
  438. //根据课程名称进行比对(课程类型、课程学分、学时暂时不考虑)
  439. var deputyElectiveViewList = finallyScoreViewList
  440. .Where(x => x.CourseName.Trim().StartsWith("副项选修")).ToList();
  441. if (deputyElectiveViewList != null && deputyElectiveViewList.Count() > 0)
  442. {
  443. foreach (var deputyElectiveView in deputyElectiveViewList)
  444. {
  445. if (deputyElectiveView.TotalScore < 60)
  446. {
  447. return deputyElectiveView.CourseName + "课程不及格";
  448. }
  449. //查询对应的副项选修课程List(根据开课学期)
  450. var deputyElectiveList = deputyElectiveViewList
  451. .Where(x => x.StarttermID == deputyElectiveView.StarttermID)
  452. .ToList();
  453. if (deputyElectiveList != null && deputyElectiveList.Count() > 1)
  454. {
  455. return deputyElectiveView.StarttermName + "副项选修课程重复";
  456. }
  457. }
  458. isDeputyElective = false;
  459. }
  460. else
  461. {
  462. return "副项选修课程未录入";
  463. }
  464. }
  465. }
  466. else if (graduationCourseView.CourseName.Trim().StartsWith("专项选修"))
  467. {
  468. //专项选修
  469. if (isSpecialtyElective)
  470. {
  471. //根据课程名称进行比对(课程类型、课程学分、学时暂时不考虑)
  472. var specialtyElectiveViewList = finallyScoreViewList
  473. .Where(x => x.CourseName.Trim().StartsWith("专项选修")).ToList();
  474. if (specialtyElectiveViewList != null && specialtyElectiveViewList.Count() > 0)
  475. {
  476. foreach (var specialtyElectiveView in specialtyElectiveViewList)
  477. {
  478. if (specialtyElectiveView.TotalScore < 60)
  479. {
  480. return specialtyElectiveView.CourseName + "课程不及格";
  481. }
  482. //查询对应的专项选修课程List(根据开课学期)
  483. var specialtyElectiveList = specialtyElectiveViewList
  484. .Where(x => x.StarttermID == specialtyElectiveView.StarttermID)
  485. .ToList();
  486. if (specialtyElectiveList != null && specialtyElectiveList.Count() > 1)
  487. {
  488. return specialtyElectiveView.StarttermName + "专项选修课程重复";
  489. }
  490. }
  491. isSpecialtyElective = false;
  492. }
  493. else
  494. {
  495. return "专项选修课程未录入";
  496. }
  497. }
  498. }
  499. else if (graduationCourseView.CourseName.Trim().StartsWith("专项提高"))
  500. {
  501. //专项提高
  502. if (isSpecialtyImprove)
  503. {
  504. //根据课程名称进行比对(课程类型、课程学分、学时暂时不考虑)
  505. var specialtyImproveViewList = finallyScoreViewList
  506. .Where(x => x.CourseName.Trim().StartsWith("专项提高")).ToList();
  507. if (specialtyImproveViewList != null && specialtyImproveViewList.Count() > 0)
  508. {
  509. foreach (var specialtyImproveView in specialtyImproveViewList)
  510. {
  511. if (specialtyImproveView.TotalScore < 60)
  512. {
  513. return specialtyImproveView.CourseName + "课程不及格";
  514. }
  515. //查询对应的专项提高课程List(根据开课学期)
  516. var specialtyImproveList = specialtyImproveViewList
  517. .Where(x => x.StarttermID == specialtyImproveView.StarttermID)
  518. .ToList();
  519. if (specialtyImproveList != null && specialtyImproveList.Count() > 1)
  520. {
  521. return specialtyImproveView.StarttermName + "专项提高课程重复";
  522. }
  523. }
  524. isSpecialtyImprove = false;
  525. }
  526. else
  527. {
  528. return "专项提高课程未录入";
  529. }
  530. }
  531. }
  532. else
  533. {
  534. //根据课程信息、课程类型、课程学分进行比对(学时暂时不考虑)
  535. var finallyScoreView = finallyScoreViewList
  536. .Where(x => x.CoursematerialID == graduationCourseView.CoursematerialID
  537. && x.CourseTypeID == graduationCourseView.CourseTypeID
  538. && x.Credit == graduationCourseView.CourseCredit).SingleOrDefault();
  539. if (finallyScoreView == null)
  540. {
  541. return graduationCourseView.CourseName + "课程未录入";
  542. }
  543. if (finallyScoreView != null)
  544. {
  545. if (finallyScoreView.TotalScore.Value < 60)
  546. {
  547. return graduationCourseView.CourseName + "课程不及格(" + finallyScoreView.StarttermName + ")";
  548. }
  549. }
  550. }
  551. }
  552. return "Pass";
  553. }
  554. catch (Exception ex)
  555. {
  556. throw new Exception(ex.Message);
  557. }
  558. }
  559. /// <summary>
  560. /// 毕业设计(论文)课程要求修习且及格(>=60分)
  561. /// </summary>
  562. /// <param name="userID"></param>
  563. /// <returns></returns>
  564. public string GraduateDesignCourseComplete(Guid? userID)
  565. {
  566. try
  567. {
  568. //学生信息
  569. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  570. expStudent = expStudent.And(x => x.UserID == userID);
  571. //查询对应的毕业设计课程信息List
  572. var graduateDesignCourseList = GraduationConditionDAL
  573. .GraduateDesignCoursematerialRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  574. if (graduateDesignCourseList == null || graduateDesignCourseList.Count() <= 0)
  575. {
  576. return "未设置毕业设计课程,请设置";
  577. }
  578. //查询对应的毕业设计课程成绩信息List
  579. var finallyScoreViewList = GraduationConditionDAL
  580. .GetGraduateDesignCourseViewQueryable(expStudent).ToList();
  581. if (finallyScoreViewList == null || finallyScoreViewList.Count() <= 0)
  582. {
  583. return "毕业设计课程未录入";
  584. }
  585. foreach (var finallyScoreView in finallyScoreViewList)
  586. {
  587. if (finallyScoreView.TotalScore < 60)
  588. {
  589. return "毕业设计课程不及格(" + finallyScoreView.StarttermName + ")";
  590. }
  591. }
  592. return "Pass";
  593. }
  594. catch (Exception ex)
  595. {
  596. throw new Exception(ex.Message);
  597. }
  598. }
  599. /// <summary>
  600. /// 类型(课程类型)学分要求符合(等于或大于等于)
  601. /// 注:实践环节学分=实践环节(不包含俱乐部)+实践环节(包含俱乐部)且大于4只取4分
  602. /// 校本课程学分=校本课程(不包含俱乐部)+校本课程(包含俱乐部)且大于4只取4分
  603. /// </summary>
  604. /// <param name="userID"></param>
  605. /// <returns></returns>
  606. public string GradCourseTypeCreditComplete(Guid? userID)
  607. {
  608. try
  609. {
  610. //查询课程类型设置信息List
  611. var courseTypeSelectCourseTypeList = GraduationConditionDAL.CourseTypeSelectCourseTypeRepository
  612. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  613. if (courseTypeSelectCourseTypeList == null || courseTypeSelectCourseTypeList.Count() <= 0)
  614. {
  615. throw new Exception("课程类型设置未配置,请配置");
  616. }
  617. //查询毕业课程类型设置信息List
  618. var graduationCourseTypeSettingList = GraduationConditionDAL.GraduationCourseTypeSettingRepository
  619. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  620. if (graduationCourseTypeSettingList == null || graduationCourseTypeSettingList.Count() <= 0)
  621. {
  622. throw new Exception("毕业课程类型设置未配置,请配置");
  623. }
  624. //学生信息
  625. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  626. expStudent = expStudent.And(x => x.UserID == userID);
  627. //查询对应的毕业课程类型学分信息List
  628. var courseTypeRequirementViewList = GraduationConditionDAL
  629. .GetGradCourseTypeRequirementViewQueryable(expStudent).ToList();
  630. if (courseTypeRequirementViewList == null || courseTypeRequirementViewList.Count() <= 0)
  631. {
  632. return "未设置类型学分,请设置";
  633. }
  634. //查询对应的毕业学生课程类型学分信息List
  635. var gradStudentCourseTypeCreditViewList = GraduationConditionDAL
  636. .GetGradStudentCourseTypeCreditViewQueryable(expStudent).ToList();
  637. //查询对应的毕业学生成绩学分信息(根据学生信息)
  638. var gradStudentScoreCreditView = GraduationConditionDAL
  639. .GetGradStudentScoreCreditViewQueryable(expStudent)
  640. .SingleOrDefault();
  641. if (gradStudentCourseTypeCreditViewList == null || gradStudentCourseTypeCreditViewList.Count() <= 0
  642. || gradStudentScoreCreditView == null)
  643. {
  644. return "成绩为空";
  645. }
  646. else
  647. {
  648. foreach (var courseTypeRequirementView in courseTypeRequirementViewList)
  649. {
  650. //查询对应的毕业学生课程类型学分信息
  651. var gradStudentCourseTypeCreditView = gradStudentCourseTypeCreditViewList
  652. .Where(x => x.CourseTypeID == courseTypeRequirementView.CourseTypeID)
  653. .SingleOrDefault();
  654. if (gradStudentCourseTypeCreditView == null)
  655. {
  656. return "类型学分(课程类型:" + courseTypeRequirementView.CourseTypeName + ")为空";
  657. }
  658. else
  659. {
  660. if (courseTypeRequirementView.IsRequired.Value)
  661. {
  662. //必修(等于)注:学前为大于等于(暂时这样考虑)
  663. //实践环节(实践环节学分=实践环节(不包含俱乐部)+实践环节(包含俱乐部)且大于4只取4分)
  664. if (courseTypeRequirementView.IsPractise.Value)
  665. {
  666. //学前教育专业为大于等于(逻辑暂时这样处理)
  667. if (gradStudentScoreCreditView.StandardID == 40106)
  668. {
  669. if (gradStudentScoreCreditView.PractiseCredit.Value < courseTypeRequirementView.TotalCredit.Value)
  670. {
  671. return "实践环节学分不足(-" + (courseTypeRequirementView.TotalCredit.Value
  672. - gradStudentScoreCreditView.PractiseCredit.Value).ToString() + ")";
  673. }
  674. }
  675. else
  676. {
  677. if (gradStudentScoreCreditView.PractiseCredit.Value > courseTypeRequirementView.TotalCredit.Value)
  678. {
  679. return "实践环节学分超标(+" + (gradStudentScoreCreditView.PractiseCredit.Value
  680. - courseTypeRequirementView.TotalCredit.Value).ToString() + ")";
  681. }
  682. if (gradStudentScoreCreditView.PractiseCredit.Value < courseTypeRequirementView.TotalCredit.Value)
  683. {
  684. return "实践环节学分不足(-" + (courseTypeRequirementView.TotalCredit.Value
  685. - gradStudentScoreCreditView.PractiseCredit.Value).ToString() + ")";
  686. }
  687. }
  688. }
  689. else
  690. {
  691. if (gradStudentCourseTypeCreditView.TotalCredit.Value > courseTypeRequirementView.TotalCredit.Value)
  692. {
  693. return "类型学分超标(" + courseTypeRequirementView.CourseTypeName + ":+"
  694. + (gradStudentCourseTypeCreditView.TotalCredit.Value
  695. - courseTypeRequirementView.TotalCredit.Value) + ")";
  696. }
  697. if (gradStudentCourseTypeCreditView.TotalCredit.Value < courseTypeRequirementView.TotalCredit.Value)
  698. {
  699. return "类型学分不足(" + courseTypeRequirementView.CourseTypeName + ":-"
  700. + (courseTypeRequirementView.TotalCredit.Value
  701. - gradStudentCourseTypeCreditView.TotalCredit.Value) + ")";
  702. }
  703. }
  704. }
  705. else
  706. {
  707. //限选、任选(大于等于)
  708. //校本课程(校本课程学分=校本课程(不包含俱乐部)+校本课程(包含俱乐部)且大于4只取4分)
  709. if (courseTypeRequirementView.IsSchoolbasedCurriculum.Value)
  710. {
  711. if (gradStudentScoreCreditView.SchoolbasedCredit.Value < courseTypeRequirementView.TotalCredit.Value)
  712. {
  713. return "校本课程学分不足(-" + (courseTypeRequirementView.TotalCredit.Value
  714. - gradStudentScoreCreditView.SchoolbasedCredit.Value).ToString() + ")";
  715. }
  716. }
  717. else
  718. {
  719. if (gradStudentCourseTypeCreditView.TotalCredit.Value < courseTypeRequirementView.TotalCredit.Value)
  720. {
  721. return "类型学分不足(" + courseTypeRequirementView.CourseTypeName + ":-"
  722. + (courseTypeRequirementView.TotalCredit.Value
  723. - gradStudentCourseTypeCreditView.TotalCredit.Value) + ")";
  724. }
  725. }
  726. }
  727. }
  728. }
  729. }
  730. return "Pass";
  731. }
  732. catch (Exception ex)
  733. {
  734. throw new Exception(ex.Message);
  735. }
  736. }
  737. /// <summary>
  738. /// 专业选修学分要求符合(大于等于)
  739. /// </summary>
  740. /// <param name="userID"></param>
  741. /// <returns></returns>
  742. public string GradSpecialtyOptionalCreditComplete(Guid? userID)
  743. {
  744. try
  745. {
  746. //查询课程类型设置信息List
  747. var courseTypeSelectCourseTypeList = GraduationConditionDAL.CourseTypeSelectCourseTypeRepository
  748. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  749. if (courseTypeSelectCourseTypeList == null || courseTypeSelectCourseTypeList.Count() <= 0)
  750. {
  751. throw new Exception("课程类型设置未配置,请配置");
  752. }
  753. //查询毕业课程类型设置信息List
  754. var graduationCourseTypeSettingList = GraduationConditionDAL.GraduationCourseTypeSettingRepository
  755. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  756. if (graduationCourseTypeSettingList == null || graduationCourseTypeSettingList.Count() <= 0)
  757. {
  758. throw new Exception("毕业课程类型设置未配置,请配置");
  759. }
  760. //学生信息
  761. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  762. expStudent = expStudent.And(x => x.UserID == userID);
  763. //查询对应的毕业专业学分信息View
  764. var gradGrademajorRequirementView = GraduationConditionDAL
  765. .GetGradGrademajorRequirementViewQueryable(expStudent)
  766. .SingleOrDefault();
  767. if (gradGrademajorRequirementView == null)
  768. {
  769. return "未设置专业学分,请设置";
  770. }
  771. //查询对应的毕业学生成绩学分信息(根据学生信息)
  772. var gradStudentScoreCreditView = GraduationConditionDAL
  773. .GetGradStudentScoreCreditViewQueryable(expStudent)
  774. .SingleOrDefault();
  775. if (gradStudentScoreCreditView == null)
  776. {
  777. return "成绩为空";
  778. }
  779. else
  780. {
  781. //对应的专业选修学分(选修学分=限选+任选)暂时是这样计算
  782. var specialtyOptionalCredit = gradStudentScoreCreditView.OptionalCourseCredit.Value
  783. + gradStudentScoreCreditView.FreeSelectionCourseCredit.Value;
  784. if (specialtyOptionalCredit < gradGrademajorRequirementView.OptionalCourseCredit.Value)
  785. {
  786. return "选修学分不足(-" + (gradGrademajorRequirementView.OptionalCourseCredit.Value
  787. - specialtyOptionalCredit).ToString() + ")";
  788. }
  789. }
  790. return "Pass";
  791. }
  792. catch (Exception ex)
  793. {
  794. throw new Exception(ex.Message);
  795. }
  796. }
  797. /// <summary>
  798. /// 专业必修学分要求符合(等于)
  799. /// </summary>
  800. /// <param name="userID"></param>
  801. /// <returns></returns>
  802. public string GradSpecialtyRequiredCreditComplete(Guid? userID)
  803. {
  804. try
  805. {
  806. //查询课程类型设置信息List
  807. var courseTypeSelectCourseTypeList = GraduationConditionDAL.CourseTypeSelectCourseTypeRepository
  808. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  809. if (courseTypeSelectCourseTypeList == null || courseTypeSelectCourseTypeList.Count() <= 0)
  810. {
  811. throw new Exception("课程类型设置未配置,请配置");
  812. }
  813. //查询毕业课程类型设置信息List
  814. var graduationCourseTypeSettingList = GraduationConditionDAL.GraduationCourseTypeSettingRepository
  815. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  816. if (graduationCourseTypeSettingList == null || graduationCourseTypeSettingList.Count() <= 0)
  817. {
  818. throw new Exception("毕业课程类型设置未配置,请配置");
  819. }
  820. //学生信息
  821. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  822. expStudent = expStudent.And(x => x.UserID == userID);
  823. //查询对应的毕业专业学分信息View
  824. var gradGrademajorRequirementView = GraduationConditionDAL
  825. .GetGradGrademajorRequirementViewQueryable(expStudent)
  826. .SingleOrDefault();
  827. if (gradGrademajorRequirementView == null)
  828. {
  829. return "未设置专业学分,请设置";
  830. }
  831. //查询对应的毕业学生成绩学分信息(根据学生信息)
  832. var gradStudentScoreCreditView = GraduationConditionDAL
  833. .GetGradStudentScoreCreditViewQueryable(expStudent)
  834. .SingleOrDefault();
  835. if (gradStudentScoreCreditView == null)
  836. {
  837. return "成绩为空";
  838. }
  839. else
  840. {
  841. //对应的专业必修学分(必修学分=必修-实践环节(不包含俱乐部)- 实践环节学分(只包含俱乐部))
  842. var specialtyRequiredCredit = gradStudentScoreCreditView.RequiredCredit.Value
  843. - gradStudentScoreCreditView.PractiseNoClubCredit.Value
  844. - gradStudentScoreCreditView.PractiseClubCredit.Value;
  845. if (specialtyRequiredCredit > gradGrademajorRequirementView.RequiredCredit.Value)
  846. {
  847. return "必修学分超标(+" + (specialtyRequiredCredit
  848. - gradGrademajorRequirementView.RequiredCredit.Value).ToString() + ")";
  849. }
  850. if (specialtyRequiredCredit < gradGrademajorRequirementView.RequiredCredit.Value)
  851. {
  852. return "必修学分不足(-" + (gradGrademajorRequirementView.RequiredCredit.Value
  853. - specialtyRequiredCredit).ToString() + ")";
  854. }
  855. }
  856. return "Pass";
  857. }
  858. catch (Exception ex)
  859. {
  860. throw new Exception(ex.Message);
  861. }
  862. }
  863. /// <summary>
  864. /// 专业总学分要求符合(大于等于)
  865. /// </summary>
  866. /// <param name="userID"></param>
  867. /// <returns></returns>
  868. public string GradSpecialtyTotalCreditComplete(Guid? userID)
  869. {
  870. try
  871. {
  872. //查询课程类型设置信息List
  873. var courseTypeSelectCourseTypeList = GraduationConditionDAL.CourseTypeSelectCourseTypeRepository
  874. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  875. if (courseTypeSelectCourseTypeList == null || courseTypeSelectCourseTypeList.Count() <= 0)
  876. {
  877. throw new Exception("课程类型设置未配置,请配置");
  878. }
  879. //查询毕业课程类型设置信息List
  880. var graduationCourseTypeSettingList = GraduationConditionDAL.GraduationCourseTypeSettingRepository
  881. .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
  882. if (graduationCourseTypeSettingList == null || graduationCourseTypeSettingList.Count() <= 0)
  883. {
  884. throw new Exception("毕业课程类型设置未配置,请配置");
  885. }
  886. //学生信息
  887. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  888. expStudent = expStudent.And(x => x.UserID == userID);
  889. //查询对应的毕业专业学分信息View
  890. var gradGrademajorRequirementView = GraduationConditionDAL
  891. .GetGradGrademajorRequirementViewQueryable(expStudent)
  892. .SingleOrDefault();
  893. if (gradGrademajorRequirementView == null)
  894. {
  895. return "未设置专业学分,请设置";
  896. }
  897. //查询对应的毕业学生成绩学分信息(根据学生信息)
  898. var gradStudentScoreCreditView = GraduationConditionDAL
  899. .GetGradStudentScoreCreditViewQueryable(expStudent).SingleOrDefault();
  900. if (gradStudentScoreCreditView == null)
  901. {
  902. return "成绩为空";
  903. }
  904. else
  905. {
  906. //对应的专业总学分
  907. var specialtyTotalCredit = gradStudentScoreCreditView.TotalCredit.Value;
  908. if (specialtyTotalCredit < gradGrademajorRequirementView.TotalCredit.Value)
  909. {
  910. return "总学分不足(-" + (gradGrademajorRequirementView.TotalCredit.Value
  911. - specialtyTotalCredit).ToString() + ")";
  912. }
  913. }
  914. return "Pass";
  915. }
  916. catch (Exception ex)
  917. {
  918. throw new Exception(ex.Message);
  919. }
  920. }
  921. /// <summary>
  922. /// 所修课程门数大于等于毕业门数且小于等于执行门数(毕业标准)
  923. /// </summary>
  924. /// <param name="userID"></param>
  925. /// <returns></returns>
  926. public string GraduationStandardCountComplete(Guid? userID)
  927. {
  928. try
  929. {
  930. //学生信息
  931. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  932. expStudent = expStudent.And(x => x.UserID == userID);
  933. //查询对应的毕业标准信息View
  934. var graduationStandardView = GraduationConditionDAL
  935. .GetGraduationStandardViewQueryable(expStudent).SingleOrDefault();
  936. if (graduationStandardView == null)
  937. {
  938. return "未设置毕业标准,请设置";
  939. }
  940. //查询对应的学生最终成绩学分信息View
  941. var finallyScorePersonalCreditView = GraduationConditionDAL
  942. .GetFinallyScorePersonalCreditViewQueryable(expStudent)
  943. .SingleOrDefault();
  944. if (finallyScorePersonalCreditView == null)
  945. {
  946. return "成绩为空";
  947. }
  948. else
  949. {
  950. if (finallyScorePersonalCreditView.CourseCount.Value < graduationStandardView.RequireCourseCount.Value)
  951. {
  952. return "所修课程门数不足(少" + (graduationStandardView.RequireCourseCount.Value
  953. - finallyScorePersonalCreditView.CourseCount.Value).ToString() + "门)";
  954. }
  955. if (finallyScorePersonalCreditView.CourseCount.Value > graduationStandardView.ExecCourseCount.Value)
  956. {
  957. return "所修课程门数超出(多" + (finallyScorePersonalCreditView.CourseCount.Value
  958. - graduationStandardView.ExecCourseCount.Value).ToString() + "门)";
  959. }
  960. }
  961. return "Pass";
  962. }
  963. catch (Exception ex)
  964. {
  965. throw new Exception(ex.Message);
  966. }
  967. }
  968. /// <summary>
  969. /// 所修课程总学分大于等于毕业学分且小于等于执行学分(毕业标准)
  970. /// </summary>
  971. /// <param name="userID"></param>
  972. /// <returns></returns>
  973. public string GraduationStandardCreditComplete(Guid? userID)
  974. {
  975. try
  976. {
  977. //学生信息
  978. Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  979. expStudent = expStudent.And(x => x.UserID == userID);
  980. //查询对应的毕业标准信息View
  981. var graduationStandardView = GraduationConditionDAL
  982. .GetGraduationStandardViewQueryable(expStudent).SingleOrDefault();
  983. if (graduationStandardView == null)
  984. {
  985. return "未设置毕业标准,请设置";
  986. }
  987. //查询对应的学生最终成绩学分信息View
  988. var finallyScorePersonalCreditView = GraduationConditionDAL
  989. .GetFinallyScorePersonalCreditViewQueryable(expStudent)
  990. .SingleOrDefault();
  991. if (finallyScorePersonalCreditView == null)
  992. {
  993. return "成绩为空";
  994. }
  995. else
  996. {
  997. if (finallyScorePersonalCreditView.TotalCredit.Value < graduationStandardView.GraduationCredit.Value)
  998. {
  999. return "所修课程总学分不足(少" + (graduationStandardView.GraduationCredit.Value
  1000. - finallyScorePersonalCreditView.TotalCredit.Value).ToString() + "分)";
  1001. }
  1002. if (finallyScorePersonalCreditView.TotalCredit.Value > graduationStandardView.ExecutableCreditTotal.Value)
  1003. {
  1004. return "所修课程总学分超出(多" + (finallyScorePersonalCreditView.TotalCredit.Value
  1005. - graduationStandardView.ExecutableCreditTotal.Value).ToString() + "分)";
  1006. }
  1007. }
  1008. return "Pass";
  1009. }
  1010. catch (Exception ex)
  1011. {
  1012. throw new Exception(ex.Message);
  1013. }
  1014. }
  1015. /// <summary>
  1016. /// 无欠缴学费记录
  1017. /// </summary>
  1018. /// <param name="userID"></param>
  1019. /// <returns></returns>
  1020. public string GradChargeComplete(Guid? userID)
  1021. {
  1022. try
  1023. {
  1024. var arrearListView = ArrearsListServices.GetArrearListView(userID);
  1025. if (arrearListView == null)
  1026. {
  1027. //表示不欠费--欠费信息不存在
  1028. return "Pass";
  1029. }
  1030. else
  1031. {
  1032. return "欠费(-" + Math.Round(arrearListView.AmountSum.Value, 1).ToString() + ")";
  1033. }
  1034. }
  1035. catch (Exception ex)
  1036. {
  1037. throw new Exception(ex.Message);
  1038. }
  1039. }
  1040. }
  1041. }