No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

603 líneas
27 KiB

  1. using System;
  2. using Nancy;
  3. using Learun.Util;
  4. using System.Collections.Generic;
  5. using Learun.Application.TwoDevelopment.EducationalAdministration;
  6. using System.Linq;
  7. namespace Learun.Application.WebApi
  8. {
  9. /// <summary>
  10. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  11. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  12. /// 创 建:超级管理员
  13. /// 日 期:2019-07-01 17:06
  14. /// 描 述:邮件查看
  15. /// </summary>
  16. public class OpenLessonPlanOfElectiveStudentApi : BaseNoAuthentication
  17. {
  18. private OpenLessonPlanOfElectiveIBLL openLessonPlanOfElectiveIbll = new OpenLessonPlanOfElectiveBLL();
  19. private StuSelectLessonListOfElectiveIBLL stuSelectLessonListOfElectiveIBLL = new StuSelectLessonListOfElectiveBLL();
  20. private StuSelectLessonListOfElectivePreIBLL stuSelectLessonListOfElectivePreIBLL = new StuSelectLessonListOfElectivePreBLL();
  21. private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
  22. LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL();
  23. EmpInfoIBLL empInfoIbll = new EmpInfoBLL();
  24. private OLPElectiveStuSelectCountIBLL oLPElectiveStuSelectCountIBLL = new OLPElectiveStuSelectCountBLL();
  25. private LessonInfoIBLL lessonInfoIBLL = new LessonInfoBLL();
  26. /// <summary>
  27. /// 注册接口
  28. /// <summary>
  29. public OpenLessonPlanOfElectiveStudentApi()
  30. : base("/Learun/OpenLessonPlanOfElectiveStudent")
  31. {
  32. Get["/pagelist"] = GetPageList;
  33. Get["/studentpagelist"] = StudentGetPageList;
  34. Get["/form"] = GetForm;
  35. Post["/Cancel"] = Cancel;
  36. Post["/SignIn"] = SignIn;
  37. Post["/SignInByMobile"] = SignInByMobile;
  38. Post["/CancelPre"] = CancelPre;
  39. Post["/SignInPre"] = SignInPre;
  40. Post["/GetApplyResult"] = GetApplyResult;
  41. }
  42. private Response GetApplyResult(dynamic _)
  43. {
  44. dynamic parameter = this.GetReqData<dynamic>();
  45. string keyValue = parameter.keyValue;
  46. string account = parameter.StuNo;
  47. //学员信息
  48. var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
  49. if (stuInfoBasicEntity == null)
  50. {
  51. return Success("当前学员不存在!");
  52. }
  53. //课程信息
  54. var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
  55. if (olpeEntity == null)
  56. {
  57. return Success("当前课程不存在!");
  58. }
  59. //当前学员本学期是否有报名课程:每学期一门
  60. //var sslleEntity = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntityByStuNo(account, "");
  61. //if (sslleEntity != null)
  62. //{
  63. // if (sslleEntity.OLPEId != keyValue && sslleEntity.Status != 3)
  64. // {
  65. // return Success("已存在报名课程,每学期只能选择一门选修课!如需报名其他课程请先取消。");
  66. // }
  67. // if (sslleEntity.Status == 1)
  68. // {
  69. // return Success("报名审核中,请耐心等待!");
  70. // }
  71. // else if (sslleEntity.Status == 2)
  72. // {
  73. // return Success("已存在报名成功的课程,只能选择一门选修课!");
  74. // }
  75. //}
  76. //else
  77. //{
  78. // //所选课程的报名人数是否已满
  79. // var aa = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByOLPEId(keyValue);
  80. // var aaa = aa.Count(x => x.Status == 1 || x.Status == 2);
  81. // if (aaa >= olpeEntity.StuNumMax)
  82. // {
  83. // return Success("当前课程报名人数已满,请选择其他课程!");
  84. // }
  85. //}
  86. //每学期两门
  87. var sslleEntity = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntityByStuNo(account, keyValue);
  88. if (sslleEntity != null)
  89. {
  90. if (sslleEntity.Status == 1)
  91. {
  92. return Success("当前课程报名审核中,请耐心等待!");
  93. }
  94. else if (sslleEntity.Status == 2)
  95. {
  96. return Success("当前课程已报名成功!");
  97. }
  98. }
  99. else
  100. {
  101. //所选课程的报名人数是否已满
  102. var aa = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByOLPEId(keyValue);
  103. var aaa = aa.Count(x => x.Status == 1 || x.Status == 2);
  104. if (aaa >= olpeEntity.StuNumMax)
  105. {
  106. return Success("当前课程报名人数已满,请选择其他课程!");
  107. }
  108. //每学期最多两门
  109. var sslleList = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByStuNo(account);
  110. var sslleListOfNow = sslleList.Where(x => x.AcademicYearNo == olpeEntity.AcademicYearNo && x.Semester == olpeEntity.Semester);
  111. var sslleListOfNow1 = sslleListOfNow.Where(x => x.Status == 1 || x.Status == 2);
  112. if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt())
  113. {
  114. return Success("每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!");
  115. }
  116. //相同时间不能报名
  117. if (sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any())
  118. {
  119. //相同时间不能报名
  120. return Success("本学期此时间段已有报名的选修课!");
  121. }
  122. //专业选修课根据学生选课次数表判断选课上限
  123. var lesson = lessonInfoIBLL.GetLessonInfoAndTypeByLessonNo(olpeEntity.LessonNo);
  124. if (lesson != null && lesson.LessonTypeCode.Contains("Professional"))
  125. {
  126. var oLPElectiveStuSelectCount = oLPElectiveStuSelectCountIBLL.GetOLPElectiveStuSelectCountEntity(olpeEntity.AcademicYearNo, olpeEntity.Semester, stuInfoBasicEntity.DeptNo);
  127. if (oLPElectiveStuSelectCount != null && sslleListOfNow1.Count() > oLPElectiveStuSelectCount.SelectMaxCount)
  128. {
  129. return Fail("本系部最多选择" + oLPElectiveStuSelectCount.SelectMaxCount + "门专业选修课!");
  130. }
  131. }
  132. }
  133. return Fail("正在提交,请等待!");
  134. }
  135. #region 获取数据
  136. /// <summary>
  137. /// 获取页面显示列表分页数据
  138. /// <summary>
  139. /// <param name="_"></param>
  140. /// <returns></returns>
  141. public Response GetPageList(dynamic _)
  142. {
  143. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  144. var data = openLessonPlanOfElectiveIbll.GetPageListOfStudent(parameter.pagination, parameter.queryJson).OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.LessonNo).ThenBy(x => x.EmpNo);
  145. var jsonData = new
  146. {
  147. rows = data,
  148. total = parameter.pagination.total,
  149. page = parameter.pagination.page,
  150. records = parameter.pagination.records
  151. };
  152. return Success(jsonData);
  153. }
  154. public Response StudentGetPageList(dynamic _)
  155. {
  156. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  157. var data = stuSelectLessonListOfElectiveIBLL.GetPageList(parameter.pagination, parameter.queryJson).OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.LessonNo).ThenBy(x => x.EmpNo);
  158. var jsonData = new
  159. {
  160. rows = data,
  161. total = parameter.pagination.total,
  162. page = parameter.pagination.page,
  163. records = parameter.pagination.records
  164. };
  165. return Success(jsonData);
  166. }
  167. /// <summary>
  168. /// 获取表单数据
  169. /// <summary>
  170. /// <param name="_"></param>
  171. /// <returns></returns>
  172. public Response GetForm(dynamic _)
  173. {
  174. string keyValue = this.GetReqData();
  175. var JournalReceiveData = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
  176. if (lessonInfoIbll.GetLessonInfoEntityByLessonNo(JournalReceiveData.LessonNo) != null)
  177. {
  178. if (!string.IsNullOrEmpty(lessonInfoIbll.GetLessonInfoEntityByLessonNo(JournalReceiveData.LessonNo).Introduction))
  179. JournalReceiveData.Introduction = WebHelper.NoHtml(WebHelper.HtmlDecode(lessonInfoIbll.GetLessonInfoEntityByLessonNo(JournalReceiveData.LessonNo).Introduction)) ?? "";
  180. }
  181. if (empInfoIbll.GetEmpInfoEntityByEmpNo(JournalReceiveData.EmpNo) != null)
  182. {
  183. if (!string.IsNullOrEmpty(empInfoIbll.GetEmpInfoEntityByEmpNo(JournalReceiveData.EmpNo).resume))
  184. JournalReceiveData.resume = WebHelper.NoHtml(WebHelper.HtmlDecode(empInfoIbll.GetEmpInfoEntityByEmpNo(JournalReceiveData.EmpNo).resume)) ?? "";
  185. }
  186. var jsonData = new
  187. {
  188. JournalReceive = JournalReceiveData,
  189. };
  190. return Success(jsonData);
  191. }
  192. #endregion
  193. #region 提交数据
  194. /// <summary>
  195. /// 删除实体数据
  196. /// <param name="_"></param>
  197. /// <summary>
  198. /// <returns></returns>
  199. public Response Cancel(dynamic _)
  200. {
  201. dynamic parameter = this.GetReqData<dynamic>();
  202. string keyValue = parameter.keyValue;
  203. string account = parameter.StuNo;
  204. //学员信息
  205. var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
  206. if (stuInfoBasicEntity == null)
  207. {
  208. return Fail("当前学员不存在!");
  209. }
  210. //课程信息
  211. var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
  212. if (olpeEntity == null)
  213. {
  214. return Fail("当前课程不存在!");
  215. }
  216. //当前学员是否已经报名该课程
  217. var sslleEntity = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveEntityByStuNo(account, keyValue);
  218. if (sslleEntity != null)
  219. {
  220. if (sslleEntity.Status != 2)
  221. {
  222. stuSelectLessonListOfElectiveIBLL.DeleteEntity(sslleEntity.Id);
  223. return Success("取消成功");
  224. }
  225. else
  226. {
  227. return Fail("取消失败,当前课程已报名成功!");
  228. }
  229. }
  230. else
  231. {
  232. return Fail("当前课程未报名,无需取消!");
  233. }
  234. }
  235. /// <summary>
  236. /// 报名
  237. /// </summary>
  238. /// <param name="_"></param>
  239. /// <returns></returns>
  240. public Response SignIn(dynamic _)
  241. {
  242. //dynamic parameter = this.GetReqData<dynamic>();
  243. //string keyValue = parameter.keyValue;
  244. //string account = parameter.StuNo;
  245. var parameter = this.GetReq<SignModel>();
  246. //string keyValue = parameter.keyValue;
  247. //string account = parameter.StuNo;
  248. //SignUpHelper.Instance.Start();
  249. ////进队列
  250. //SignUpHelper.AddQueue(account, keyValue);
  251. return SignInPre(parameter.StuNo, parameter.keyValue);
  252. //return Success("操作成功");
  253. }
  254. public Response SignInByMobile(dynamic _)
  255. {
  256. dynamic parameter = this.GetReqData<dynamic>();
  257. string keyValue = parameter.keyValue;
  258. string account = parameter.StuNo;
  259. SignUpHelper.Instance.Start();
  260. //进队列
  261. SignUpHelper.AddQueue(account, keyValue);
  262. return Success("操作成功");
  263. }
  264. /// <summary>
  265. /// 删除实体数据 (预)
  266. /// <param name="_"></param>
  267. /// <summary>
  268. /// <returns></returns>
  269. public Response CancelPre(dynamic _)
  270. {
  271. dynamic parameter = this.GetReqData<dynamic>();
  272. string keyValue = parameter.keyValue;
  273. string account = parameter.StuNo;
  274. //学员信息
  275. var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
  276. if (stuInfoBasicEntity == null)
  277. {
  278. return Fail("当前学员不存在!");
  279. }
  280. //课程信息
  281. var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
  282. if (olpeEntity == null)
  283. {
  284. return Fail("当前课程不存在!");
  285. }
  286. //当前学员是否已经报名该课程
  287. var sslleEntity = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreEntityByStuNo(account, keyValue);
  288. if (sslleEntity != null)
  289. {
  290. if (sslleEntity.Status != 2)
  291. {
  292. stuSelectLessonListOfElectivePreIBLL.DeleteEntity(sslleEntity.Id);
  293. return Success("取消成功");
  294. }
  295. else
  296. {
  297. return Fail("取消失败,当前课程已报名成功!");
  298. }
  299. }
  300. else
  301. {
  302. return Fail("当前课程未报名,无需取消!");
  303. }
  304. }
  305. /// <summary>
  306. /// 报名(预)
  307. /// </summary>
  308. /// <param name="_"></param>
  309. /// <returns></returns>
  310. public Response SignInPre(dynamic _)
  311. {
  312. dynamic parameter = this.GetReqData<dynamic>();
  313. string keyValue = parameter.keyValue;
  314. string account = parameter.StuNo;
  315. //学员信息
  316. var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
  317. if (stuInfoBasicEntity == null)
  318. {
  319. return Fail("当前学员不存在!");
  320. }
  321. //课程信息
  322. var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
  323. if (olpeEntity == null)
  324. {
  325. return Fail("当前课程不存在!");
  326. }
  327. //所选课程的报名人数是否已满
  328. var aa = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreListByOLPEId(olpeEntity.Id);
  329. var aaa = aa.Where(x => x.Status == 2).Count();
  330. if (aaa >= olpeEntity.StuNumMax)
  331. {
  332. return Fail("当前课程报名人数已满,请选择其他课程!");
  333. }
  334. //当前学员本学期是否有报名课程:每学期一门
  335. //var sslleEntity = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreEntityByStuNo(account, "");
  336. //if (sslleEntity != null)
  337. //{
  338. // if (sslleEntity.OLPEId != keyValue && sslleEntity.Status != 3)
  339. // {
  340. // return Fail("已存在报名课程,每学期只能选择一门选修课!如需报名其他课程请先取消。");
  341. // }
  342. // if (sslleEntity.Status == 1)
  343. // {
  344. // return Fail("报名审核中,请耐心等待!");
  345. // }
  346. // else if (sslleEntity.Status == 2)
  347. // {
  348. // return Fail("已存在报名成功的课程,只能选择一门选修课!");
  349. // }
  350. // else if (sslleEntity.Status == 3)//移除报名失败的数据
  351. // {
  352. // stuSelectLessonListOfElectivePreIBLL.DeleteEntity(sslleEntity.Id);
  353. // }
  354. //}
  355. //每学期两门
  356. var sslleList = stuSelectLessonListOfElectivePreIBLL.GetStuSelectLessonListOfElectivePreListByStuNo(account);
  357. var sslleListOfNow = sslleList.Where(x => x.AcademicYearNo == olpeEntity.AcademicYearNo && x.Semester == olpeEntity.Semester);
  358. var sslleListOfNow1 = sslleListOfNow.Where(x => x.Status == 1 || x.Status == 2);
  359. var sslleListOfNow2 = sslleListOfNow.Where(x => x.Status == 3);
  360. if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt())
  361. {
  362. return Fail("每学期最多选择" + Config.GetValue("ElectiveLessonApplyMax").ToInt() + "门选修课!");
  363. }
  364. else
  365. {
  366. var m = sslleListOfNow1.FirstOrDefault(x => x.OLPEId == olpeEntity.Id);
  367. if (m != null)
  368. {
  369. if (m.Status == 1)
  370. {
  371. return Fail("当前课程报名审核中,请耐心等待!");
  372. }
  373. else if (m.Status == 2)
  374. {
  375. return Fail("当前课程已报名成功!");
  376. }
  377. }
  378. }
  379. //专业选修课根据学生选课次数表判断选课上限
  380. var lesson = lessonInfoIBLL.GetLessonInfoAndTypeByLessonNo(olpeEntity.LessonNo);
  381. if (lesson != null && lesson.LessonTypeCode.Contains("Professional"))
  382. {
  383. var oLPElectiveStuSelectCount = oLPElectiveStuSelectCountIBLL.GetOLPElectiveStuSelectCountEntity(olpeEntity.AcademicYearNo, olpeEntity.Semester, stuInfoBasicEntity.DeptNo);
  384. if (oLPElectiveStuSelectCount != null && sslleListOfNow1.Count() > oLPElectiveStuSelectCount.SelectMaxCount)
  385. {
  386. return Fail("本系部最多选择" + oLPElectiveStuSelectCount.SelectMaxCount + "门专业选修课!");
  387. }
  388. }
  389. if (sslleListOfNow2.Count() > 0)
  390. {
  391. foreach (var item in sslleListOfNow2)
  392. {
  393. stuSelectLessonListOfElectivePreIBLL.DeleteEntity(item.Id);
  394. }
  395. }
  396. //相同时间不能报名
  397. if (sslleListOfNow1.Select(x => x.LessonSection == olpeEntity.LessonSection).Any())
  398. {
  399. //相同时间不能报名
  400. return Success("本学期此时间段已有报名的选修课!");
  401. }
  402. //新增报名数据
  403. var model = new StuSelectLessonListOfElectivePreEntity()
  404. {
  405. OLPEId = olpeEntity.Id,
  406. NoticeBookNo = stuInfoBasicEntity.NoticeNo,
  407. StuNo = stuInfoBasicEntity.StuNo,
  408. DeptNo = stuInfoBasicEntity.DeptNo,
  409. MajorNo = stuInfoBasicEntity.MajorNo,
  410. ClassNo = stuInfoBasicEntity.ClassNo,
  411. MajorDetailNo = stuInfoBasicEntity.MajorDetailNo,
  412. MajorDetailName = stuInfoBasicEntity.MajorDetailName,
  413. StuName = stuInfoBasicEntity.StuName,
  414. GenderNo = stuInfoBasicEntity.GenderNo,
  415. Grade = stuInfoBasicEntity.Grade,
  416. AcademicYearNo = olpeEntity.AcademicYearNo,
  417. Semester = olpeEntity.Semester,
  418. LessonNo = olpeEntity.LessonNo,
  419. LessonName = olpeEntity.LessonName,
  420. LessonSortNo = olpeEntity.LessonSortNo,
  421. LessonSection = olpeEntity.LessonSection,
  422. LessonTime = olpeEntity.LessonTime,
  423. EmpNo = olpeEntity.EmpNo,
  424. EmpName = olpeEntity.EmpName,
  425. ClassRoomNo = olpeEntity.ClassRoomNo,
  426. ClassRoomName = olpeEntity.ClassRoomName,
  427. StudyScore = olpeEntity.StudyScore,
  428. StartWeek = olpeEntity.StartWeek,
  429. EndWeek = olpeEntity.EndWeek,
  430. StartDate = olpeEntity.StartDate,
  431. EndDate = olpeEntity.EndDate,
  432. CreateTime = DateTime.Now,
  433. Status = 1,
  434. OrdinaryScoreScale = 1,
  435. TermInScoreScale = 1,
  436. TermEndScoreScale = 1,
  437. OtherScoreScale = 1,
  438. F_SchoolId = olpeEntity.F_SchoolId
  439. };
  440. stuSelectLessonListOfElectivePreIBLL.SaveEntity("", model);
  441. return Success("报名成功");
  442. }
  443. #endregion
  444. #region 私有类
  445. private Response SignInPre(string account, string keyValue)
  446. {
  447. try
  448. {
  449. //学员信息
  450. var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
  451. if (stuInfoBasicEntity == null)
  452. {
  453. //return Fail("当前学员不存在!");
  454. return Fail("当前学员不存在!");
  455. }
  456. //课程信息
  457. var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue);
  458. if (olpeEntity == null)
  459. {
  460. //return Fail("当前课程不存在!");
  461. return Fail("当前课程不存在!");
  462. }
  463. //所选课程的报名人数是否已满
  464. var aa = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByOLPEId(olpeEntity.Id);
  465. var aaa = aa.Where(x => x.Status == 1 || x.Status == 2).Count();
  466. if (aaa >= olpeEntity.StuNumMax)
  467. {
  468. //return Fail("当前课程报名人数已满,请选择其他课程!");
  469. return Fail("当前课程报名人数已满,请选择其他课程!");
  470. }
  471. //每学期两门
  472. var sslleList = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByStuNo(account);
  473. var sslleListOfNow = sslleList.Where(x => x.AcademicYearNo == olpeEntity.AcademicYearNo && x.Semester == olpeEntity.Semester);
  474. var sslleListOfNow1 = sslleListOfNow.Where(x => x.Status == 1 || x.Status == 2);
  475. var sslleListOfNow2 = sslleListOfNow.Where(x => x.Status == 3);
  476. if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt())
  477. {
  478. return Fail("每学期最多选择两门选修课!");
  479. //return;
  480. }
  481. else
  482. {
  483. var m = sslleListOfNow1.FirstOrDefault(x => x.OLPEId == olpeEntity.Id);
  484. if (m != null)
  485. {
  486. if (m.Status == 1)
  487. {
  488. return Fail("当前课程报名审核中,请耐心等待!");
  489. //return;
  490. }
  491. else if (m.Status == 2)
  492. {
  493. return Success("当前课程已报名成功!");
  494. //return;
  495. }
  496. }
  497. }
  498. if (sslleListOfNow2.Count() > 0)
  499. {
  500. foreach (var item in sslleListOfNow2)
  501. {
  502. stuSelectLessonListOfElectiveIBLL.DeleteEntity(item.Id);
  503. }
  504. }
  505. //相同时间不能报名
  506. if (sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any())
  507. {
  508. return Success("本学期此时间段已有报名的选修课!");
  509. }
  510. //相同课程不能报名
  511. if (sslleListOfNow1.Where(x => x.LessonNo == olpeEntity.LessonNo).Any())
  512. {
  513. //return Fail("相同课程不能报名!");
  514. return Success("本学期此课程已报名!");
  515. }
  516. //新增报名数据
  517. var model = new StuSelectLessonListOfElectiveEntity()
  518. {
  519. OLPEId = olpeEntity.Id,
  520. NoticeBookNo = stuInfoBasicEntity.NoticeNo,
  521. StuNo = stuInfoBasicEntity.StuNo,
  522. DeptNo = stuInfoBasicEntity.DeptNo,
  523. MajorNo = stuInfoBasicEntity.MajorNo,
  524. ClassNo = stuInfoBasicEntity.ClassNo,
  525. MajorDetailNo = stuInfoBasicEntity.MajorDetailNo,
  526. MajorDetailName = stuInfoBasicEntity.MajorDetailName,
  527. StuName = stuInfoBasicEntity.StuName,
  528. GenderNo = stuInfoBasicEntity.GenderNo,
  529. Grade = stuInfoBasicEntity.Grade,
  530. AcademicYearNo = olpeEntity.AcademicYearNo,
  531. Semester = olpeEntity.Semester,
  532. LessonNo = olpeEntity.LessonNo,
  533. LessonName = olpeEntity.LessonName,
  534. LessonSortNo = olpeEntity.LessonSortNo,
  535. LessonSection = olpeEntity.LessonSection,
  536. LessonTime = olpeEntity.LessonTime,
  537. EmpNo = olpeEntity.EmpNo,
  538. EmpName = olpeEntity.EmpName,
  539. ClassRoomNo = olpeEntity.ClassRoomNo,
  540. ClassRoomName = olpeEntity.ClassRoomName,
  541. StudyScore = olpeEntity.StudyScore,
  542. StartWeek = olpeEntity.StartWeek,
  543. EndWeek = olpeEntity.EndWeek,
  544. StartDate = olpeEntity.StartDate,
  545. EndDate = olpeEntity.EndDate,
  546. CreateTime = DateTime.Now,
  547. Status = 1,
  548. OrdinaryScoreScale = 1,
  549. TermInScoreScale = 1,
  550. TermEndScoreScale = 1,
  551. OtherScoreScale = 1,
  552. F_SchoolId = olpeEntity.F_SchoolId
  553. };
  554. stuSelectLessonListOfElectiveIBLL.SaveEntity("", model);
  555. return Success("报名成功");
  556. }
  557. catch (Exception)
  558. {
  559. return Fail("系统异常!请联系管理员");
  560. }
  561. }
  562. /// <summary>
  563. /// 表单实体类
  564. /// <summary>
  565. private class ReqFormEntity
  566. {
  567. public string keyValue { get; set; }
  568. public string strEntity { get; set; }
  569. }
  570. /// <summary>
  571. /// 报名模型
  572. /// </summary>
  573. private class SignModel
  574. {
  575. public string keyValue { get; set; }
  576. public string StuNo { get; set; }
  577. }
  578. #endregion
  579. }
  580. }