ExaminationPlanController.cs 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.Web.Controls;
  8. using EMIS.CommonLogic.ExaminationManage;
  9. using Bowin.Common.Utility;
  10. using Bowin.Web.Controls.Mvc;
  11. using Bowin.Common.Data;
  12. using EMIS.CommonLogic.CalendarManage;
  13. using EMIS.ViewModel.ExaminationManage;
  14. using EMIS.ViewModel.UniversityManage.TeacherManage;
  15. using EMIS.ViewModel.Students;
  16. using Bowin.Common.Exceptions;
  17. using Bowin.Common.JSON;
  18. using EMIS.Utility;
  19. using NPOI.SS.UserModel;
  20. namespace EMIS.Web.Controllers.ExaminationManage
  21. {
  22. [Authorization]
  23. public class ExaminationPlanController : Controller
  24. {
  25. public ISchoolYearServices SchoolYearServices { get; set; }
  26. public IExaminationPlanServices ExaminationPlanServices { get; set; }
  27. /// <summary>
  28. /// 考试计划(普教)
  29. /// </summary>
  30. /// <returns></returns>
  31. public ActionResult List()
  32. {
  33. return View();
  34. }
  35. /// <summary>
  36. /// 考试计划(松山)
  37. /// </summary>
  38. /// <returns></returns>
  39. public ActionResult GdssList()
  40. {
  41. return View();
  42. }
  43. /// <summary>
  44. /// 考试计划(成教)
  45. /// </summary>
  46. /// <returns></returns>
  47. public ActionResult ListDGLG()
  48. {
  49. return View();
  50. }
  51. public ActionResult StudentSelect()
  52. {
  53. return View();
  54. }
  55. public ActionResult GdssStudentSelect(Guid? examinationPlanID)
  56. {
  57. ViewBag.examinationPlanID = examinationPlanID;
  58. return View();
  59. }
  60. public ActionResult ExaminationScheduleList()
  61. {
  62. return View();
  63. }
  64. public ActionResult AdultExaminationScheduleList()
  65. {
  66. return View();
  67. }
  68. public ActionResult StudentExaminationSchedule()
  69. {
  70. return View();
  71. }
  72. public ActionResult TeacherExaminationSchedule()
  73. {
  74. return View();
  75. }
  76. public ActionResult TeacherExaminationTimes()
  77. {
  78. return View();
  79. }
  80. public ActionResult SetTime()
  81. {
  82. return View();
  83. }
  84. public ActionResult Import(string errorFile, string operationTips, string selectedIDs)
  85. {
  86. ViewBag.ErrorFile = errorFile;
  87. if (string.IsNullOrEmpty(operationTips))
  88. {
  89. operationTips = "错误数据下载";
  90. }
  91. ViewBag.operationTips = operationTips;
  92. ViewBag.selectedIDs = selectedIDs;
  93. return View();
  94. }
  95. public ActionResult Classroom(Guid ExaminationPlanID)
  96. {
  97. ExaminationPlanView examinationPlanView = new ExaminationPlanView();
  98. if (ExaminationPlanID != null && ExaminationPlanID != Guid.Empty)
  99. {
  100. examinationPlanView = ExaminationPlanServices.GetExaminationPlanViewInfo(ExaminationPlanID);
  101. }
  102. return View(examinationPlanView);
  103. }
  104. public ActionResult ClassroomGdss(Guid ExaminationPlanID)
  105. {
  106. ExaminationPlanGdssView examinationPlanView = new ExaminationPlanGdssView();
  107. if (ExaminationPlanID != null && ExaminationPlanID != Guid.Empty)
  108. {
  109. examinationPlanView = ExaminationPlanServices.GetExaminationPlanGdssViewInfo(ExaminationPlanID);
  110. }
  111. if (!examinationPlanView.StudentOrderType.HasValue)
  112. {
  113. examinationPlanView.StudentOrderType = (int)CF_StudentOrderType.StudentNo;
  114. }
  115. return View(examinationPlanView);
  116. }
  117. public ActionResult ClassroomLayout(Guid? ExaminationPlanID, Guid? ExaminationRoomLayoutID)//暂时将ExaminationPlanID变为可空
  118. {
  119. ExaminationRoomLayoutView examinationRoomLayoutView = new ExaminationRoomLayoutView();
  120. if (ExaminationRoomLayoutID != null && ExaminationRoomLayoutID != Guid.Empty)
  121. {
  122. examinationRoomLayoutView = ExaminationPlanServices.GetExaminationRoomLayoutViewInfo(ExaminationRoomLayoutID);
  123. }
  124. //屏蔽间隔功能
  125. examinationRoomLayoutView.ColumnSpacing = 0;
  126. examinationRoomLayoutView.RowSpacing = 0;
  127. return View(examinationRoomLayoutView);
  128. }
  129. public ActionResult ClassroomAdult(Guid ExaminationPlanID)
  130. {
  131. ExaminationPlanView examinationPlanView = new ExaminationPlanView();
  132. if (ExaminationPlanID != null && ExaminationPlanID != Guid.Empty)
  133. {
  134. examinationPlanView = ExaminationPlanServices.GetExaminationPlanViewInfo(ExaminationPlanID);
  135. }
  136. return View(examinationPlanView);
  137. }
  138. public ActionResult GenerateResit(Guid? schoolYearID)
  139. {
  140. var schoolYear = SchoolYearServices.GetSchoolYearViewBeforeCurrent();
  141. ViewBag.SchoolYearID = schoolYear == null ? DropdownList.PLEASE_SELECT.ToString() : schoolYear.SchoolYearID.ToString();
  142. return View();
  143. }
  144. public ActionResult GenerateGraduateExam(Guid? schoolYearID)
  145. {
  146. return View();
  147. }
  148. public ActionResult ExaminationPlanStudentList(Guid ExaminationPlanID)
  149. {
  150. return View();
  151. }
  152. public ActionResult AddClassroomLayout(Guid? ExaminationPlanID, Guid? ExaminationRoomLayoutID)//暂时将ExaminationPlanID变为可空
  153. {
  154. ExaminationRoomLayoutView examinationRoomLayoutView = new ExaminationRoomLayoutView();
  155. if (ExaminationRoomLayoutID != null && ExaminationRoomLayoutID != Guid.Empty)
  156. {
  157. examinationRoomLayoutView = ExaminationPlanServices.GetExaminationRoomLayoutViewInfo(ExaminationRoomLayoutID);
  158. }
  159. //屏蔽间隔功能
  160. examinationRoomLayoutView.ColumnSpacing = 0;
  161. examinationRoomLayoutView.RowSpacing = 0;
  162. return View(examinationRoomLayoutView);
  163. }
  164. /// <summary>
  165. /// 新增考室
  166. /// </summary>
  167. /// <returns></returns>
  168. [HttpPost]
  169. public ActionResult AddClassroomLayout(ExaminationRoomLayoutView examinationRoomLayoutView)
  170. {
  171. return View(examinationRoomLayoutView);
  172. }
  173. public ActionResult AddStudentSelect()
  174. {
  175. return View();
  176. }
  177. /// <summary>
  178. /// 复制新增
  179. /// </summary>
  180. /// <param name="degreeApplyID"></param>
  181. /// <returns></returns>
  182. public ActionResult CopyAdd(Guid examinationPlanID)
  183. {
  184. ExaminationPlanView examinationPlanView = new ExaminationPlanView();
  185. examinationPlanView = ExaminationPlanServices.GetExaminationPlanView(examinationPlanID);
  186. return View("Add", examinationPlanView);
  187. }
  188. /// <summary>
  189. /// 复制新增
  190. /// </summary>
  191. /// <param name="degreeApplyView"></param>
  192. /// <returns></returns>
  193. [HttpPost]
  194. public ActionResult CopyAdd(ExaminationPlanView examinationPlanView)
  195. {
  196. examinationPlanView.ExaminationPlanID = Guid.Empty;
  197. return this.Add(examinationPlanView);
  198. }
  199. /// <summary>
  200. /// 新增考试安排
  201. /// </summary>
  202. /// <returns></returns>
  203. public ActionResult Add()
  204. {
  205. return View();
  206. }
  207. [HttpPost]
  208. public ActionResult Add(ExaminationPlanView examinationPlanView)
  209. {
  210. try
  211. {
  212. ExaminationPlanServices.AddExaminationPlan(examinationPlanView);
  213. return Json(new ReturnMessage()
  214. {
  215. IsSuccess = true,
  216. Message = "保存成功。"
  217. });
  218. }
  219. catch (Exception ex)
  220. {
  221. return Json(new ReturnMessage()
  222. {
  223. IsSuccess = false,
  224. Message = "保存失败:" + ex.Message
  225. });
  226. }
  227. }
  228. /// <summary>
  229. /// 考试安排学生
  230. /// </summary>
  231. /// <param name="pararms"></param>
  232. /// <returns></returns>
  233. [HttpPost]
  234. public ActionResult FinalExaminationStudentList()
  235. {
  236. var finalExaminationID = Request["finalExaminationID"].ParseStrTo<Guid>();
  237. //return Json(finalExaminationServices.Value.GetFinalExaminationStudent(finalExaminationID));
  238. return null;
  239. }
  240. /// <summary>
  241. /// 增加学生
  242. /// </summary>
  243. /// <param name="finalExaminationID"></param>
  244. /// <returns></returns>
  245. public ActionResult StudentEdit(Guid? examinationPlanID)
  246. {
  247. ExaminationPlanView finalExaminationView = new ExaminationPlanView();
  248. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  249. if (examinationPlanID.HasValue)
  250. {
  251. finalExaminationView = ExaminationPlanServices.GetExaminationPlanView(examinationPlanID);
  252. }
  253. return View(finalExaminationView);
  254. }
  255. /// <summary>
  256. /// 增加学生
  257. /// </summary>
  258. /// <param name="finalExaminationView"></param>
  259. /// <returns></returns>
  260. [HttpPost]
  261. public ActionResult StudentEdit(ExaminationPlanView finalExaminationView)
  262. {
  263. try
  264. {
  265. //finalExaminationView.ExaminationType = (int)EMIS.ViewModel.CF_ExaminationType.FinalExamination;
  266. var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudentList");
  267. //ExaminationPlanServices.FinalExaminationStudentAdd(finalExaminationView.FinalExaminationID, studentList);
  268. return Json(new ReturnMessage()
  269. {
  270. IsSuccess = true,
  271. Message = "保存成功。"
  272. });
  273. }
  274. catch (Exception ex)
  275. {
  276. return Json(new ReturnMessage()
  277. {
  278. IsSuccess = false,
  279. Message = "保存失败:" + ex.Message
  280. });
  281. }
  282. }
  283. public ActionResult Resetting(string examinationPlanIDs)
  284. {
  285. try
  286. {
  287. var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
  288. ExaminationPlanServices.ResettingExaminationPlans(examinationPlanIDList);
  289. return base.Json("重置成功");
  290. }
  291. catch (Exception ex)
  292. {
  293. string mge = ex.Message;
  294. // System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
  295. return base.Json("重置失败,原因:" + mge + "!");
  296. }
  297. }
  298. public ActionResult Cancel(string examinationPlanIDs)
  299. {
  300. try
  301. {
  302. var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
  303. ExaminationPlanServices.CancelExaminationPlans(examinationPlanIDList);
  304. return base.Json("撤销成功");
  305. }
  306. catch (Exception ex)
  307. {
  308. string mge = ex.Message;
  309. // System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
  310. return base.Json("撤销失败,原因:" + mge + "!");
  311. }
  312. }
  313. ///// <summary>
  314. ///// 添加学生
  315. ///// </summary>
  316. ///// <param name="finalExaminationID"></param>
  317. ///// <returns></returns>
  318. //public ActionResult StudentAdd(Guid? finalExamination, Guid? UserID)
  319. //{
  320. // FinalExaminationView finalExaminationView = new FinalExaminationView();
  321. // finalExaminationView = finalExaminationServices.Value.GetFinalExaminationView(finalExamination);
  322. // finalExaminationView.isAutoAdd = true;
  323. // if (UserID != Guid.Empty && UserID != null)
  324. // {
  325. // var student = StudentfileServices.Value.GetStudentfileView((Guid)UserID);
  326. // var StarttermID = finalExaminationServices.Value.GetFinalExaminationStudentForStudentAdd(finalExamination, UserID);
  327. // var f = finalExaminationServices.Value.GetStarttermID(finalExamination, UserID);
  328. // finalExaminationView.UserID = UserID;
  329. // finalExaminationView.UserName = student.UserName;
  330. // finalExaminationView.StarttermID = StarttermID.StarttermID;
  331. // //如果是修改变成false
  332. // finalExaminationView.isAutoAdd = false;
  333. // }
  334. // return View(finalExaminationView);
  335. //}
  336. ///// <summary>
  337. ///// 添加学生
  338. ///// </summary>
  339. ///// <param name="finalExaminationID"></param>
  340. ///// <returns></returns>
  341. //[HttpPost]
  342. //public ActionResult StudentAdd(FinalExaminationView finalExaminationView)
  343. //{
  344. // try
  345. // {
  346. // finalExaminationServices.Value.StudentAdd(finalExaminationView);
  347. // return Json(new ReturnMessage()
  348. // {
  349. // IsSuccess = true,
  350. // Message = "保存成功。"
  351. // });
  352. // }
  353. // catch (Exception ex)
  354. // {
  355. // return Json(new ReturnMessage()
  356. // {
  357. // IsSuccess = false,
  358. // Message = "保存失败:" + ex.Message
  359. // });
  360. // }
  361. //}
  362. /// <summary>
  363. /// 列表查询
  364. /// </summary>
  365. /// <param name="pararms"></param>
  366. /// <returns></returns>
  367. [HttpPost]
  368. public ActionResult List(QueryParamsModel pararms)
  369. {
  370. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  371. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  372. var starWeek = pararms.getExtraInt("StarWeek");
  373. var endWeek = pararms.getExtraInt("EndWeek");
  374. var collegeID = pararms.getExtraGuid("ddlCollege");
  375. var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  376. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  377. var coursematerialID = pararms.getExtraGuid("cbgCoursematerial");
  378. var examsCategoryID = pararms.getExtraInt("ddlExamsCategory") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExamsCategory");
  379. var examinationModeID = pararms.getExtraInt("ddlExaminationMode") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationMode");
  380. var examinationStyleID = pararms.getExtraInt("ddlExaminationStyle") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationStyle");
  381. var courseEndWeek = pararms.getExtraInt("CourseEndWeek");
  382. var statusID = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
  383. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  384. return base.Json(ExaminationPlanServices.GetExaminationPlanViewList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, starWeek, endWeek, courseEndWeek, statusID, (int)pararms.page, (int)pararms.rows));
  385. }
  386. /// <summary>
  387. /// 列表查询
  388. /// </summary>
  389. /// <param name="pararms"></param>
  390. /// <returns></returns>
  391. [HttpPost]
  392. public ActionResult GdssList(QueryParamsModel pararms)
  393. {
  394. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  395. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  396. var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
  397. var collegeID = pararms.getExtraGuid("ddlCollege");
  398. var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  399. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  400. var coursematerialID = pararms.getExtraGuid("cbgCoursematerial");
  401. var examsCategoryID = pararms.getExtraInt("ddlExamsCategory") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExamsCategory");
  402. var examinationModeID = pararms.getExtraInt("ddlExaminationMode") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationMode");
  403. var examinationStyleID = pararms.getExtraInt("ddlExaminationStyle") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationStyle");
  404. var courseEndWeek = pararms.getExtraInt("CourseEndWeek");
  405. var statusID = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
  406. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  407. return base.Json(ExaminationPlanServices.GetGdssExaminationPlanViewList(configuretView, schoolyearID, collegeID,classmajorID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, courseEndWeek, statusID, (int)pararms.page, (int)pararms.rows));
  408. }
  409. [HttpPost]
  410. public ActionResult GetExaminationRoomLayoutViewList(Guid examinationPlanID)
  411. {
  412. return base.Json(ExaminationPlanServices.GetExaminationRoomLayoutViewList(examinationPlanID));
  413. }
  414. [HttpPost]
  415. public ActionResult GetExaminationTeachers(Guid? examinationRoomLayoutID)
  416. {
  417. return base.Json(ExaminationPlanServices.GetExaminationTeacherViewInfo(examinationRoomLayoutID));
  418. }
  419. [HttpPost]
  420. public ActionResult GetExaminationTeachersGdss(Guid? examinationPlanID)
  421. {
  422. return base.Json(ExaminationPlanServices.GetExaminationTeacherViewInfoGdss(examinationPlanID));
  423. }
  424. [HttpPost]
  425. public ActionResult GetExaminationStudents(Guid? examinationRoomLayoutID)
  426. {
  427. return base.Json(ExaminationPlanServices.GetExaminationStudentViewInfo(examinationRoomLayoutID));
  428. }
  429. /// <summary>
  430. /// 列表查询
  431. /// </summary>
  432. /// <param name="pararms"></param>
  433. /// <returns></returns>
  434. [HttpPost]
  435. public ActionResult StudentList(QueryParamsModel pararms, Guid examinationPlanID, int studentOrderTypeID)
  436. {
  437. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  438. var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
  439. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  440. var studentOrderType = (CF_StudentOrderType)studentOrderTypeID;
  441. return base.Json(ExaminationPlanServices.GetAvailableStudentViewList(examinationPlanID, collegeID, grademajorID, classmajorID, studentOrderType, pararms.page, pararms.rows));
  442. }
  443. [HttpPost]
  444. public ActionResult GdssStudentList(QueryParamsModel pararms, Guid? examinationPlanID)
  445. {
  446. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  447. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  448. var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
  449. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  450. //examinationPlanID = Request.Form["examinationPlanID"].ParseStrTo<Guid>();
  451. return base.Json(ExaminationPlanServices.GetGdssStudentListForSelect(configuretView, examinationPlanID,collegeID, grademajorID,classmajorID,(int)pararms.page, (int)pararms.rows));
  452. }
  453. /// <summary>
  454. /// 列表查询
  455. /// </summary>
  456. /// <param name="pararms"></param>
  457. /// <returns></returns>
  458. [HttpPost]
  459. public ActionResult AddStudentList(QueryParamsModel pararms, int studentOrderTypeID)
  460. {
  461. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  462. var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
  463. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  464. var studentOrderType = (CF_StudentOrderType)studentOrderTypeID;
  465. return base.Json(ExaminationPlanServices.GetAddAvailableStudentViewList(collegeID, grademajorID, classmajorID, studentOrderType, pararms.page, pararms.rows));
  466. }
  467. [HttpPost]
  468. public ActionResult Excel()
  469. {
  470. NpoiExcelHelper neh = new NpoiExcelHelper();
  471. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  472. var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
  473. var collegeID = Request.Form["ddlCollege"].ParseStrTo<Guid>();
  474. var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  475. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  476. var coursematerialID = Request.Form["cbgCoursematerial"].ParseStrTo<Guid>();
  477. var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo<int>();
  478. var examinationModeID = Request.Form["ddlExaminationMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationMode"].ParseStrTo<int>();
  479. var statusID = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
  480. var courseEndWeek = Request.Form["CourseEndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CourseEndWeek"].ParseStrTo<int>();
  481. var starWeek = Request.Form["StarWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StarWeek"].ParseStrTo<int>();
  482. var endWeek = Request.Form["EndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EndWeek"].ParseStrTo<int>();
  483. var examinationStyleID = Request.Form["ddlExaminationStyle"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationStyle"].ParseStrTo<int>();
  484. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  485. List<Guid?> selectIDlist = new List<Guid?>();
  486. var dt = ExaminationPlanServices.GetExaminationPlanViewList(configuretView, schoolyearID, collegeID,gradeYearID,standardID, coursematerialID, examsCategoryID, examinationModeID,examinationStyleID,starWeek,endWeek,courseEndWeek, statusID, selectIDlist).Select(x => new
  487. {
  488. x.SchoolyearCode,
  489. x.CoursematerialName,
  490. x.ClassName,
  491. x.MissionStudentCount,
  492. x.StudentCount,
  493. x.ExaminationModeName,
  494. ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
  495. x.ExaminationTime,
  496. x.ClassroomNum,
  497. x.RecordStatusDesc
  498. }).ToTable();
  499. string[] liststring = { "学年学期", "考试科目", "班级名称", "学生数", "排考人数", "考试方式", "考试日期", "考试时间", "考室数", "状态" };
  500. neh.Export(dt, liststring, "考试计划信息");
  501. return RedirectToAction("MsgShow", "Common", new
  502. {
  503. msg = "导出成功。",
  504. url = Url.Content("~/ExaminationPlan/List").AddMenuParameter()
  505. });
  506. }
  507. [HttpPost]
  508. public ActionResult GdssExcel()
  509. {
  510. NpoiExcelHelper neh = new NpoiExcelHelper();
  511. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  512. var examinationPlanIDs = Request.Form["ExaminationPlanIDs"];
  513. var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
  514. var collegeID = Request.Form["ddlCollege"].ParseStrTo<Guid>();
  515. var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
  516. var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  517. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  518. var coursematerialID = Request.Form["cbgCoursematerial"].ParseStrTo<Guid>();
  519. var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo<int>();
  520. var examinationModeID = Request.Form["ddlExaminationMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationMode"].ParseStrTo<int>();
  521. var statusID = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
  522. var courseEndWeek = Request.Form["CourseEndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CourseEndWeek"].ParseStrTo<int>();
  523. var starWeek = Request.Form["StarWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StarWeek"].ParseStrTo<int>();
  524. var endWeek = Request.Form["EndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EndWeek"].ParseStrTo<int>();
  525. var examinationStyleID = Request.Form["ddlExaminationStyle"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationStyle"].ParseStrTo<int>();
  526. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  527. List<Guid?> selectIDlist = new List<Guid?>();
  528. if (examinationPlanIDs != "")
  529. {
  530. selectIDlist = examinationPlanIDs.SplitIDString();
  531. }
  532. else
  533. {
  534. selectIDlist = null;
  535. }
  536. var dt = ExaminationPlanServices.GetGdssExaminationPlanViewList(configuretView, schoolyearID, collegeID,classmajorID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, courseEndWeek, statusID, selectIDlist).Select(x => new
  537. {
  538. x.SchoolyearCode,
  539. x.CoursematerialName,
  540. x.ClassName,
  541. x.MissionStudentCount,
  542. x.StudentCount,
  543. x.ExaminationModeName,
  544. ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
  545. x.ExaminationTime,
  546. x.ClassroomNum,
  547. x.RecordStatusDesc
  548. }).ToTable();
  549. string[] liststring = { "学年学期", "考试科目", "班级名称", "学生数", "排考人数", "考试方式", "考试日期", "考试时间", "考室数", "状态" };
  550. neh.Export(dt, liststring, "考试计划信息");
  551. return RedirectToAction("MsgShow", "Common", new
  552. {
  553. msg = "导出成功。",
  554. url = Url.Content("~/ExaminationPlan/GdssList").AddMenuParameter()
  555. });
  556. }
  557. [HttpPost]
  558. public ActionResult AdultImportExcel(QueryParamsModel pararms, string selectedIDs)
  559. {
  560. NpoiExcelHelper neh = new NpoiExcelHelper();
  561. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  562. string WindowStr = Request.UrlReferrer.ToString();
  563. int IndexofID = WindowStr.LastIndexOf("=");
  564. WindowStr = WindowStr.Remove(0, IndexofID + 1);
  565. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  566. var starWeek = pararms.getExtraInt("StarWeek");
  567. var endWeek = pararms.getExtraInt("EndWeek");
  568. var collegeID = pararms.getExtraGuid("ddlCollege");
  569. var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  570. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  571. var coursematerialID = pararms.getExtraGuid("cbgCoursematerial");
  572. var examsCategoryID = pararms.getExtraInt("ddlExamsCategory") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExamsCategory");
  573. var examinationModeID = pararms.getExtraInt("ddlExaminationMode") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationMode");
  574. var examinationStyleID = pararms.getExtraInt("ddlExaminationStyle") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationStyle");
  575. var courseEndWeek = pararms.getExtraInt("CourseEndWeek");
  576. var statusID = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
  577. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  578. List<Guid?> selectIDlist = new List<Guid?>();
  579. for (int i = 0; i < selectedIDs.Split(',').Length; i++)
  580. {
  581. string id = selectedIDs.Split(',')[i];
  582. if (!string.IsNullOrEmpty(id))
  583. {
  584. selectIDlist.Add(new Guid(id));
  585. }
  586. }
  587. var dt = ExaminationPlanServices.GetAdultExaminationPlanViewList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, starWeek, endWeek, courseEndWeek, statusID, selectIDlist).Select(x => new
  588. {
  589. x.CoursematerialName,
  590. x.ClassName,
  591. x.MissionStudentCount,
  592. x.StudentCount,
  593. x.ExamsCategoryName,
  594. x.ExaminationModeName,
  595. x.WeekNumString,
  596. ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
  597. x.StartTimeStr,
  598. x.EndTimeStr,
  599. x.ClassroomNames,
  600. x.staffNames
  601. }).ToTable();
  602. string[] liststring = { "考试科目", "考试班级名称", "学生数", "排考人数", "考试性质", "考试方式", "考试周次", "考试日期", "考试时间起", "考试时间止", "考室", "监考老师" };
  603. neh.Export(dt, liststring, "考试信息模板");
  604. return RedirectToAction("MsgShow", "Common", new
  605. {
  606. msg = "导出成功。",
  607. url = Url.Content("~/ExaminationPlan/Import").AddMenuParameter()
  608. });
  609. }
  610. [HttpPost]
  611. public ActionResult GdssImportExcel(QueryParamsModel pararms, string selectedIDs)
  612. {
  613. NpoiExcelHelper neh = new NpoiExcelHelper();
  614. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  615. string WindowStr = Request.UrlReferrer.ToString();
  616. int IndexofID = WindowStr.LastIndexOf("=");
  617. WindowStr = WindowStr.Remove(0, IndexofID + 1);
  618. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  619. var collegeID = pararms.getExtraGuid("ddlCollege");
  620. var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
  621. var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  622. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  623. var coursematerialID = pararms.getExtraGuid("cbgCoursematerial");
  624. var examsCategoryID = pararms.getExtraInt("ddlExamsCategory") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExamsCategory");
  625. var examinationModeID = pararms.getExtraInt("ddlExaminationMode") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationMode");
  626. var examinationStyleID = pararms.getExtraInt("ddlExaminationStyle") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExaminationStyle");
  627. var courseEndWeek = pararms.getExtraInt("CourseEndWeek");
  628. var statusID = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
  629. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  630. List<Guid?> selectIDlist = new List<Guid?>();
  631. for (int i = 0; i < selectedIDs.Split(',').Length; i++)
  632. {
  633. string id = selectedIDs.Split(',')[i];
  634. if (!string.IsNullOrEmpty(id))
  635. {
  636. selectIDlist.Add(new Guid(id));
  637. }
  638. }
  639. var dt = ExaminationPlanServices.GetGdssExaminationPlanViewList(configuretView, schoolyearID, collegeID,classmajorID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, courseEndWeek, statusID, selectIDlist).Select(x => new
  640. {
  641. x.CoursematerialName,
  642. x.ClassName,
  643. x.MissionStudentCount,
  644. x.StudentCount,
  645. x.ExamsCategoryName,
  646. x.ExaminationModeName,
  647. x.WeekNumString,
  648. ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
  649. x.StartTimeStr,
  650. x.EndTimeStr,
  651. x.ClassroomNames,
  652. x.staffNames
  653. }).ToTable();
  654. string[] liststring = { "考试科目", "考试班级名称", "学生数", "排考人数", "考试性质", "考试方式", "考试周次", "考试日期", "考试时间起", "考试时间止", "考室", "监考老师" };
  655. neh.Export(dt, liststring, "考试信息模板");
  656. return RedirectToAction("MsgShow", "Common", new
  657. {
  658. msg = "导出成功。",
  659. url = Url.Content("~/ExaminationPlan/GdssImport").AddMenuParameter()
  660. });
  661. }
  662. [HttpPost]
  663. public ActionResult AdultExcel()
  664. {
  665. NpoiExcelHelper neh = new NpoiExcelHelper();
  666. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  667. var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
  668. var collegeID = Request.Form["ddlCollege"].ParseStrTo<Guid>();
  669. var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  670. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  671. var coursematerialID = Request.Form["cbgCoursematerial"].ParseStrTo<Guid>();
  672. var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo<int>();
  673. var examinationModeID = Request.Form["ddlExaminationMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationMode"].ParseStrTo<int>();
  674. var statusID = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
  675. var courseEndWeek = Request.Form["CourseEndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CourseEndWeek"].ParseStrTo<int>();
  676. var starWeek = Request.Form["StarWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StarWeek"].ParseStrTo<int>();
  677. var endWeek = Request.Form["EndWeek"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EndWeek"].ParseStrTo<int>();
  678. var examinationStyleID = Request.Form["ddlExaminationStyle"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExaminationStyle"].ParseStrTo<int>();
  679. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  680. string examinationPlanIDs = Request.Form["SelectedID"];
  681. List<Guid?> examinationPlanIDList = examinationPlanIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  682. var dt = ExaminationPlanServices.GetAdultExaminationPlanExportViewList(configuretView, examinationPlanIDList, schoolyearID, collegeID, gradeYearID, standardID, coursematerialID, examsCategoryID, examinationModeID, examinationStyleID, starWeek, endWeek, courseEndWeek, statusID).Select(x => new
  683. {
  684. x.CoursematerialName,
  685. x.ClassName,
  686. x.MissionStudentCount,
  687. x.StudentCount,
  688. x.ExamsCategoryName,
  689. x.ExaminationModeName,
  690. x.ExaminationWeekNumString,
  691. ExaminationDate = x.ExaminationDate.HasValue ? x.ExaminationDate.Value.ToString("yyyy-MM-dd") : "",
  692. x.StartTimeStr,
  693. x.EndTimeStr,
  694. x.ClassroomName,
  695. x.TeacherNames
  696. }).ToTable();
  697. string[] liststring = { "考试科目", "考试班级名称", "学生数", "排考人数", "考试性质", "考试方式", "考试周次", "考试日期", "考试时间起",
  698. "考试时间止", "考室", "监考老师" };
  699. neh.Export(dt, liststring, "考试计划信息");
  700. return RedirectToAction("MsgShow", "Common", new
  701. {
  702. msg = "导出成功。",
  703. url = Url.Content("~/ExaminationPlan/List").AddMenuParameter()
  704. });
  705. }
  706. public ActionResult Generate(Guid? schoolYearID)
  707. {
  708. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  709. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();
  710. return View();
  711. }
  712. [HttpPost]
  713. public ActionResult Generate()
  714. {
  715. try
  716. {
  717. //var schoolYear = SchoolYearServices.GetCurrentSchoolYear();
  718. var schoolYearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  719. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  720. var gradeID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  721. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  722. //var isGenerateNotSubmit = Request.Form["IsGenerateNotSubmit"].ParseStrTo<bool>();
  723. this.ExaminationPlanServices.GenerateExaminationPlan(schoolYearID, collegeID, gradeID, standardID);
  724. return Json(new ReturnMessage()
  725. {
  726. IsSuccess = true,
  727. Message = "生成成功。"
  728. });
  729. }
  730. catch (Exception ex)
  731. {
  732. return Json(new ReturnMessage()
  733. {
  734. IsSuccess = false,
  735. Message = "生成失败:" + ex.Message
  736. });
  737. }
  738. }
  739. [HttpPost]
  740. public ActionResult GenerateResit()
  741. {
  742. try
  743. {
  744. var schoolyearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  745. this.ExaminationPlanServices.GenerateResitPlan(schoolyearID.Value);
  746. return Json(new ReturnMessage()
  747. {
  748. IsSuccess = true,
  749. Message = "生成成功。"
  750. });
  751. }
  752. catch (Exception ex)
  753. {
  754. return Json(new ReturnMessage()
  755. {
  756. IsSuccess = false,
  757. Message = "生成失败:" + ex.Message
  758. });
  759. }
  760. }
  761. [HttpPost]
  762. public ActionResult GenerateGraduateExam()
  763. {
  764. try
  765. {
  766. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  767. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  768. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  769. //var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
  770. var learnSystem = Request.Form["DictionaryLearnSystem"].ParseStrTo<decimal>();
  771. this.ExaminationPlanServices.GenerateGraduateExamPlan(yearID.Value, collegeID, standardID, learnSystem);
  772. return Json(new ReturnMessage()
  773. {
  774. IsSuccess = true,
  775. Message = "生成成功。"
  776. });
  777. }
  778. catch (Exception ex)
  779. {
  780. return Json(new ReturnMessage()
  781. {
  782. IsSuccess = false,
  783. Message = "生成失败:" + ex.Message
  784. });
  785. }
  786. }
  787. [HttpPost]
  788. public ActionResult AutoSchedule(string examinationPlanIDs)
  789. {
  790. try
  791. {
  792. var examinationPlanIDList = examinationPlanIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  793. this.ExaminationPlanServices.AutoGenerateExaminationRoomLayout(examinationPlanIDList);
  794. return Json(new ReturnMessage()
  795. {
  796. IsSuccess = true,
  797. Message = "自动排考成功。"
  798. });
  799. }
  800. catch (Exception ex)
  801. {
  802. return Json(new ReturnMessage()
  803. {
  804. IsSuccess = false,
  805. Message = ex.Message
  806. });
  807. }
  808. }
  809. /// <summary>
  810. /// 保存考试计划
  811. /// </summary>
  812. /// <returns></returns>
  813. [HttpPost]
  814. public ActionResult Classroom(ExaminationPlanView examinationPlanView)
  815. {
  816. try
  817. {
  818. ExaminationPlanServices.Save(examinationPlanView);
  819. return Json(new ReturnMessage()
  820. {
  821. IsSuccess = true,
  822. Message = "保存成功。"
  823. });
  824. }
  825. catch (Exception ex)
  826. {
  827. return Json(new ReturnMessage()
  828. {
  829. IsSuccess = false,
  830. Message = ex.Message
  831. });
  832. }
  833. }
  834. /// <summary>
  835. /// 保存考试计划
  836. /// </summary>
  837. /// <returns></returns>
  838. [HttpPost]
  839. public ActionResult ClassroomGdss(ExaminationPlanGdssView examinationPlanView)
  840. {
  841. try
  842. {
  843. var staffList = DataGrid.GetTableData<StaffView>("dgRoomTeacher");
  844. var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudent");
  845. var staffIDList = staffList.Select(x => (Guid?)x.UserID).ToList();
  846. var studentIDList = studentList.Select(x => (Guid?)x.UserID).ToList();
  847. ExaminationPlanServices.SaveGdss(examinationPlanView, staffIDList, studentIDList);
  848. return Json(new ReturnMessage()
  849. {
  850. IsSuccess = true,
  851. Message = "保存成功。"
  852. });
  853. }
  854. catch (Exception ex)
  855. {
  856. return Json(new ReturnMessage()
  857. {
  858. IsSuccess = false,
  859. Message = ex.Message
  860. });
  861. }
  862. }
  863. [HttpPost]
  864. public ActionResult CheckBeforeSave(Guid? examinationPlanID, Guid? buildingsInfoID, Guid? classroomID, DateTime? date, TimeSpan? starttime, TimeSpan? endtime, string teacherIDs, string studentIDs)
  865. {
  866. var staffIDList = teacherIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
  867. var studentIDList = studentIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
  868. ExaminationPlanGdssView examinationPlanView = new ExaminationPlanGdssView();
  869. examinationPlanView.ExaminationPlanID = examinationPlanID.Value;
  870. examinationPlanView.BuildingsInfoID = buildingsInfoID;
  871. examinationPlanView.ClassroomID = classroomID;
  872. examinationPlanView.ExaminationDate = date;
  873. examinationPlanView.StartTime = starttime;
  874. examinationPlanView.EndTime = endtime;
  875. var clashingStudentList = ExaminationPlanServices.CheckBeforeGdssSave(examinationPlanView, staffIDList, studentIDList);
  876. if (clashingStudentList.Count > 0)
  877. {
  878. #region 表单头
  879. Dictionary<string, string> cellheader = new Dictionary<string, string>
  880. {
  881. { "CollegeName", "院系" },
  882. { "ClassmajorName", "班级" },
  883. { "LoginID", "学号" },
  884. { "UserName", "姓名" },
  885. { "CourseName", "课程" },
  886. };
  887. #endregion
  888. var sourcePhysicalPath = Server.MapPath("/Content/DownFile/冲突学生数据.xls");
  889. string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, clashingStudentList, "学生报名名单失败文件", sourcePhysicalPath));
  890. return Json(new ReturnMessage()
  891. {
  892. IsSuccess = true,
  893. Message = errorWebPath
  894. });
  895. }
  896. else {
  897. return Json(new ReturnMessage()
  898. {
  899. IsSuccess = false,
  900. Message = "保存成功。"
  901. });
  902. }
  903. }
  904. [HttpPost]
  905. public ActionResult GdssSaveNotStudent(ExaminationPlanGdssView examinationPlanView)
  906. {
  907. try
  908. {
  909. var staffList = DataGrid.GetTableData<StaffView>("dgRoomTeacher");
  910. var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudent");
  911. var staffIDList = staffList.Select(x => (Guid?)x.UserID).ToList();
  912. var studentIDList = studentList.Select(x => (Guid?)x.UserID).ToList();
  913. ExaminationPlanServices.SaveGdssNotClashingStudent(examinationPlanView, staffIDList, studentIDList);
  914. return Json(new ReturnMessage()
  915. {
  916. IsSuccess = true,
  917. Message = "保存成功。"
  918. });
  919. }
  920. catch (Exception ex)
  921. {
  922. return Json(new ReturnMessage()
  923. {
  924. IsSuccess = false,
  925. Message = ex.Message
  926. });
  927. }
  928. }
  929. /// <summary>
  930. ///
  931. /// </summary>
  932. /// <param name="examinationPlanView"></param>
  933. /// <param name="staffIDList"></param>
  934. /// <param name="studentIDList"></param>
  935. [HttpGet]
  936. public ActionResult ClassroomGdssFalse(ExaminationPlanGdssView examinationPlanView, List<StudentsView> studentList)
  937. {
  938. #region 表单头
  939. Dictionary<string, string> cellheader = new Dictionary<string, string>
  940. {
  941. { "CollegeName", "院系" },
  942. { "ClassmajorName", "班级" },
  943. { "LoginID", "学号" },
  944. { "UserName", "姓名" },
  945. { "CourseName", "课程" },
  946. };
  947. #endregion
  948. var sourcePhysicalPath = Server.MapPath("/Content/DownFile/冲突学生数据.xls");
  949. string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, studentList, "学生报名名单失败文件", sourcePhysicalPath));
  950. ViewBag.ErrorFile = errorWebPath;
  951. ViewBag.operationTips = errorWebPath;
  952. return View(examinationPlanView);
  953. }
  954. [HttpPost]
  955. public ActionResult ClassroomGdssFalse(ExaminationPlanGdssView examinationPlanView)
  956. {
  957. try
  958. {
  959. var staffList = DataGrid.GetTableData<StaffView>("dgRoomTeacher");
  960. var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudent");
  961. var staffIDList = staffList.Select(x => (Guid?)x.UserID).ToList();
  962. var studentIDList = studentList.Select(x => (Guid?)x.UserID).ToList();
  963. ExaminationPlanServices.SaveGdssNotClashingStudent(examinationPlanView, staffIDList, studentIDList);
  964. return Json(new ReturnMessage()
  965. {
  966. IsSuccess = true,
  967. Message = "保存成功。"
  968. });
  969. }
  970. catch (Exception ex)
  971. {
  972. return Json(new ReturnMessage()
  973. {
  974. IsSuccess = false,
  975. Message = ex.Message
  976. });
  977. }
  978. }
  979. /// <summary>
  980. /// 保存考试计划(成教版)
  981. /// </summary>
  982. /// <returns></returns>
  983. [HttpPost]
  984. public ActionResult ClassroomAdult(ExaminationPlanView examinationPlanView)
  985. {
  986. try
  987. {
  988. ExaminationPlanServices.Save(examinationPlanView);
  989. return Json(new ReturnMessage()
  990. {
  991. IsSuccess = true,
  992. Message = "保存成功。"
  993. });
  994. }
  995. catch (Exception ex)
  996. {
  997. return Json(new ReturnMessage()
  998. {
  999. IsSuccess = false,
  1000. Message = ex.Message
  1001. });
  1002. }
  1003. }
  1004. /// <summary>
  1005. /// 保存考试计划
  1006. /// </summary>
  1007. /// <returns></returns>
  1008. [HttpPost]
  1009. public ActionResult ClassroomLayout(ExaminationRoomLayoutView examinationRoomLayoutView)
  1010. {
  1011. try
  1012. {
  1013. var teacherList = DataGrid.GetTableData<StaffView>("dgRoomTeacher");
  1014. var studentList = DataGrid.GetTableData<ExaminationRoomStudentView>("dgStudent");
  1015. ExaminationPlanServices.SaveClassroomLayout(examinationRoomLayoutView,
  1016. teacherList.Select(x => (Guid?)x.UserID).ToList(),
  1017. studentList);
  1018. return Json(new ReturnMessage()
  1019. {
  1020. IsSuccess = true,
  1021. Message = "保存成功。"
  1022. });
  1023. }
  1024. catch (Exception ex)
  1025. {
  1026. return Json(new ReturnMessage()
  1027. {
  1028. IsSuccess = false,
  1029. Message = "保存失败:" + ex.Message
  1030. });
  1031. }
  1032. }
  1033. [HttpPost]
  1034. public ActionResult ExaminationClassroomLayoutDelete(string examinationRoomLayoutIDs)
  1035. {
  1036. try
  1037. {
  1038. List<Guid> list = new List<Guid>();
  1039. for (int i = 0; i < examinationRoomLayoutIDs.Split(',').Length; i++)
  1040. {
  1041. string id = examinationRoomLayoutIDs.Split(',')[i];
  1042. if (!string.IsNullOrEmpty(id))
  1043. {
  1044. Guid examinationRoomLayoutID = new Guid(id);
  1045. list.Add(examinationRoomLayoutID);
  1046. }
  1047. }
  1048. ExaminationPlanServices.DeleteExaminationClassroomLayout(list);
  1049. return Json(new ReturnMessage()
  1050. {
  1051. IsSuccess = true,
  1052. Message = "删除成功。"
  1053. });
  1054. }
  1055. catch (Exception ex)
  1056. {
  1057. return Json(new ReturnMessage()
  1058. {
  1059. IsSuccess = false,
  1060. Message = "删除失败:" + ex.Message
  1061. });
  1062. }
  1063. }
  1064. /// <summary>
  1065. /// 提交
  1066. /// </summary>
  1067. /// <param name="roleID"></param>
  1068. /// <returns></returns>
  1069. [HttpPost]
  1070. public ActionResult Submit(string examinationPlanIDs)
  1071. {
  1072. try
  1073. {
  1074. var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
  1075. ExaminationPlanServices.Submit(examinationPlanIDList);
  1076. return Json(new ReturnMessage()
  1077. {
  1078. IsSuccess = true,
  1079. Message = "提交成功。"
  1080. });
  1081. }
  1082. catch (Exception ex)
  1083. {
  1084. string mge = ex.Message;
  1085. return Json(new ReturnMessage()
  1086. {
  1087. IsSuccess = false,
  1088. Message = "提交失败," + mge
  1089. });
  1090. }
  1091. }
  1092. /// <summary>
  1093. /// 提交
  1094. /// </summary>
  1095. /// <param name="roleID"></param>
  1096. /// <returns></returns>
  1097. [HttpPost]
  1098. public ActionResult UnSubmit(string examinationPlanIDs)
  1099. {
  1100. try
  1101. {
  1102. var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
  1103. ExaminationPlanServices.UnSubmit(examinationPlanIDList);
  1104. return Json(new ReturnMessage()
  1105. {
  1106. IsSuccess = true,
  1107. Message = "撤回成功。"
  1108. });
  1109. }
  1110. catch (Exception ex)
  1111. {
  1112. string mge = ex.Message;
  1113. return Json(new ReturnMessage()
  1114. {
  1115. IsSuccess = false,
  1116. Message = "撤回失败," + mge
  1117. });
  1118. }
  1119. }
  1120. /// <summary>
  1121. /// 删除
  1122. /// </summary>
  1123. /// <param name="roleID"></param>
  1124. /// <returns></returns>
  1125. [HttpPost]
  1126. public ActionResult Delete(string examinationPlanIDs)
  1127. {
  1128. try
  1129. {
  1130. var examinationPlanIDList = examinationPlanIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
  1131. ExaminationPlanServices.Delete(examinationPlanIDList);
  1132. return base.Json("删除成功");
  1133. }
  1134. catch (Exception ex)
  1135. {
  1136. string mge = ex.Message;
  1137. // System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
  1138. return base.Json("删除失败,原因:" + mge + "!");
  1139. }
  1140. }
  1141. [HttpPost]
  1142. public ActionResult SetTime(string ids, DateTime? examinationDate, TimeSpan? startTime, TimeSpan? endTime)
  1143. {
  1144. try
  1145. {
  1146. List<Guid?> list = ids.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  1147. ExaminationPlanServices.SetTime(list, examinationDate, startTime, endTime);
  1148. return base.Json(new ReturnMessage { IsSuccess = true, Message = "设置时间成功" });
  1149. }
  1150. catch (Exception ex)
  1151. {
  1152. return base.Json(new ReturnMessage { IsSuccess = false, Message = "设置时间失败:" + ex.Message });
  1153. }
  1154. }
  1155. [HttpPost]
  1156. public ActionResult Import(HttpPostedFileBase file)
  1157. {
  1158. try
  1159. {
  1160. if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
  1161. {
  1162. throw new Exception("只允许上传xls和xlsx格式的Excel文件!");
  1163. }
  1164. string returnMessage = "";
  1165. string sourceWebPath = FileUploadHelper.UploadFile(file);
  1166. var sourcePhysicalPath = Server.MapPath(sourceWebPath);
  1167. var errFileWebPath = ExaminationPlanServices.AdultImport(sourcePhysicalPath, out returnMessage);
  1168. if (errFileWebPath != "")
  1169. {
  1170. ViewBag.ErrorFile = errFileWebPath;
  1171. ViewBag.operationTips = returnMessage;
  1172. return RedirectToAction("MsgShow", "Common", new
  1173. {
  1174. WindowID = "none",
  1175. msg = "导入失败!",
  1176. url = Url.Action("Import").AddMenuParameter() + "&errorFile=" + errFileWebPath + "&operationTips=" + returnMessage + "&WindowID=" + Request["WindowID"]
  1177. });
  1178. }
  1179. else
  1180. {
  1181. return RedirectToAction("MsgShow", "Common", new
  1182. {
  1183. WindowID = Request["WindowID"],
  1184. msg = "导入成功!",
  1185. url = Url.Action("List").AddMenuParameter()
  1186. });
  1187. }
  1188. }
  1189. catch (Exception ex)
  1190. {
  1191. return RedirectToAction("MsgShow", "Common", new
  1192. {
  1193. WindowID = Request["WindowID"],
  1194. msg = "导入失败,原因:" + ex.Message + "!",
  1195. url = Url.Action("List").AddMenuParameter()
  1196. });
  1197. }
  1198. }
  1199. [HttpPost]
  1200. public ActionResult GetExaminationPlanStudentList(Guid examinationPlanID)
  1201. {
  1202. return Json(ExaminationPlanServices.GetExaminationPlanStudentList(examinationPlanID));
  1203. }
  1204. public ActionResult CheckStudentSchedule(Guid examinationPlanID, string studentUserIDs)
  1205. {
  1206. var studentUserIDList = studentUserIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid)new Guid(x)).ToList();
  1207. try
  1208. {
  1209. ExaminationPlanServices.CheckStudentSchedule(examinationPlanID, studentUserIDList);
  1210. return Json(new ReturnMessage()
  1211. {
  1212. IsSuccess = true
  1213. });
  1214. }
  1215. catch (Exception ex)
  1216. {
  1217. return Json(new ReturnMessage()
  1218. {
  1219. IsSuccess = false,
  1220. Message = "提交失败," + ex.Message
  1221. });
  1222. }
  1223. }
  1224. public ActionResult GdssImport(string errorFile, string operationTips, string selectedIDs)
  1225. {
  1226. ViewBag.ErrorFile = errorFile;
  1227. if (string.IsNullOrEmpty(operationTips))
  1228. {
  1229. operationTips = "错误数据下载";
  1230. }
  1231. ViewBag.operationTips = operationTips;
  1232. ViewBag.selectedIDs = selectedIDs;
  1233. return View();
  1234. }
  1235. [HttpPost]
  1236. public ActionResult GdssImport(HttpPostedFileBase file)
  1237. {
  1238. try
  1239. {
  1240. if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
  1241. {
  1242. throw new Exception("只允许上传xls和xlsx格式的Excel文件!");
  1243. }
  1244. string returnMessage = "";
  1245. string sourceWebPath = FileUploadHelper.UploadFile(file);
  1246. var sourcePhysicalPath = Server.MapPath(sourceWebPath);
  1247. var errFileWebPath = ExaminationPlanServices.AdultImport(sourcePhysicalPath, out returnMessage);
  1248. if (errFileWebPath != "")
  1249. {
  1250. ViewBag.ErrorFile = errFileWebPath;
  1251. ViewBag.operationTips = returnMessage;
  1252. return RedirectToAction("MsgShow", "Common", new
  1253. {
  1254. WindowID = "none",
  1255. msg = "导入失败!",
  1256. url = Url.Action("Import").AddMenuParameter() + "&errorFile=" + errFileWebPath + "&operationTips=" + returnMessage + "&WindowID=" + Request["WindowID"]
  1257. });
  1258. }
  1259. else
  1260. {
  1261. return RedirectToAction("MsgShow", "Common", new
  1262. {
  1263. WindowID = Request["WindowID"],
  1264. msg = "导入成功!",
  1265. url = Url.Action("List").AddMenuParameter()
  1266. });
  1267. }
  1268. }
  1269. catch (Exception ex)
  1270. {
  1271. return RedirectToAction("MsgShow", "Common", new
  1272. {
  1273. WindowID = Request["WindowID"],
  1274. msg = "导入失败,原因:" + ex.Message + "!",
  1275. url = Url.Action("List").AddMenuParameter()
  1276. });
  1277. }
  1278. }
  1279. }
  1280. }