FinalExaminationController.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.ScoreManage;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.CommonLogic.CalendarManage;
  11. using EMIS.ViewModel.ScoreManage;
  12. using Bowin.Common.Exceptions;
  13. using Bowin.Common.Utility;
  14. using EMIS.ViewModel.Students;
  15. using Bowin.Common.Data;
  16. using EMIS.CommonLogic.Students;
  17. using EMIS.Utility;
  18. namespace EMIS.Web.Controllers.ScoreManage
  19. {
  20. [Authorization]
  21. public class FinalExaminationController : Controller
  22. {
  23. public Lazy<IStudentsServices> StudentfileServices { get; set; }
  24. public Lazy<IFinalExaminationServices> finalExaminationServices { get; set; }
  25. public Lazy<ISchoolYearServices> SchoolYearServices { get; set; }
  26. /// <summary>
  27. /// 期末设定页面
  28. /// </summary>
  29. /// <returns></returns>
  30. public ActionResult List()
  31. {
  32. var schoolYear = SchoolYearServices.Value.GetSchoolYearIsCurrent(true);
  33. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  34. return View();
  35. }
  36. /// <summary>
  37. /// 期末设定列表查询
  38. /// </summary>
  39. /// <param name="pararms"></param>
  40. /// <returns></returns>
  41. [HttpPost]
  42. public ActionResult List(QueryParamsModel pararms)
  43. {
  44. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  45. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  46. var departmentID = pararms.getExtraGuid("DepartmentComboGrid");
  47. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  48. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  49. var examsCategoryID = pararms.getExtraInt("DictionaryExamsCategory") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryExamsCategory");
  50. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  51. var approvalStatus = pararms.getExtraInt("DictionaryScoreState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryScoreState");
  52. var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  53. return Json(finalExaminationServices.Value.GetFinalExaminationViewGrid(configuretView, collegeID, departmentID, schoolyearID, coursematerialID, courseTypeID, examsCategoryID,
  54. (int)EMIS.ViewModel.CF_ExaminationType.FinalExamination, approvalStatus, gradeYearID, (int)pararms.page, (int)pararms.rows));
  55. }
  56. /// <summary>
  57. /// 编辑
  58. /// </summary>
  59. /// <param name="finalExaminationID"></param>
  60. /// <returns></returns>
  61. public ActionResult Edit(Guid? finalExamination,string aType)
  62. {
  63. FinalExaminationView finalExaminationView = new FinalExaminationView();
  64. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  65. var schoolYear = SchoolYearServices.Value.GetSchoolYearIsCurrent(true);
  66. if (finalExamination.HasValue)
  67. {
  68. finalExaminationView = finalExaminationServices.Value.GetFinalExaminationView(finalExamination);
  69. }
  70. else
  71. {
  72. finalExaminationView.CollegeID = curUser.CollegeID;
  73. finalExaminationView.SchoolyearID = schoolYear.SchoolyearID;
  74. finalExaminationView.GradeYearID = schoolYear.Years;
  75. finalExaminationView.ExamsCategoryID = (int)CF_ExamsCategory.FinalExam;
  76. finalExaminationView.ExaminationModeID =(int)CF_ExaminationMode.WrittenExam;
  77. finalExaminationView.ResultTypeID = (int)CF_ResultType.Percentage;
  78. finalExaminationView.TotalHours = 0;
  79. }
  80. if(aType=="add"){
  81. finalExaminationView.FinalExaminationID = null;
  82. }
  83. finalExaminationView.isAutoAdd = true;
  84. return View(finalExaminationView);
  85. }
  86. /// <summary>
  87. /// 新增/编辑
  88. /// </summary>
  89. /// <param name="finalExaminationView"></param>
  90. /// <returns></returns>
  91. [HttpPost]
  92. public ActionResult Edit(FinalExaminationView finalExaminationView)
  93. {
  94. try
  95. {
  96. finalExaminationView.ExaminationType = (int)EMIS.ViewModel.CF_ExaminationType.FinalExamination;
  97. var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudentList");
  98. var ClassmajorID = finalExaminationView.ClassID;
  99. List<Guid?> ClassmajorIDList = new List<Guid?>();
  100. if (ClassmajorID!=null)
  101. {
  102. ClassmajorIDList = ClassmajorID.SplitIDString();
  103. }
  104. finalExaminationServices.Value.FinalExaminationAdd(finalExaminationView,ClassmajorIDList);
  105. return Json(new ReturnMessage()
  106. {
  107. IsSuccess = true,
  108. Message = "保存成功。"
  109. });
  110. }
  111. catch (Exception ex)
  112. {
  113. return Json(new ReturnMessage()
  114. {
  115. IsSuccess = false,
  116. Message = "保存失败:" + ex.Message
  117. });
  118. }
  119. }
  120. /// <summary>
  121. /// 增加学生
  122. /// </summary>
  123. /// <param name="finalExaminationID"></param>
  124. /// <returns></returns>
  125. public ActionResult StudentEdit(Guid? finalExamination)
  126. {
  127. FinalExaminationView finalExaminationView = new FinalExaminationView();
  128. var schoolYear = SchoolYearServices.Value.GetSchoolYearIsCurrent(true);
  129. if (finalExamination.HasValue)
  130. {
  131. finalExaminationView = finalExaminationServices.Value.GetFinalExaminationView(finalExamination);
  132. }
  133. else
  134. {
  135. finalExaminationView.SchoolyearID = schoolYear.SchoolyearID;
  136. finalExaminationView.GradeYearID = schoolYear.Years;
  137. finalExaminationView.ExamsCategoryID = (int)CF_ExamsCategory.FinalExam;
  138. finalExaminationView.ExaminationModeID = (int)CF_ExaminationMode.WrittenExam;
  139. }
  140. return View(finalExaminationView);
  141. }
  142. /// <summary>
  143. /// 增加学生
  144. /// </summary>
  145. /// <param name="finalExaminationView"></param>
  146. /// <returns></returns>
  147. [HttpPost]
  148. public ActionResult StudentEdit(FinalExaminationView finalExaminationView)
  149. {
  150. try
  151. {
  152. finalExaminationView.ExaminationType = (int)EMIS.ViewModel.CF_ExaminationType.FinalExamination;
  153. var studentList = DataGrid.GetTableData<BaseStudentView>("dgStudentList");
  154. finalExaminationServices.Value.FinalExaminationStudentAdd(finalExaminationView.FinalExaminationID, studentList);
  155. return Json(new ReturnMessage()
  156. {
  157. IsSuccess = true,
  158. Message = "保存成功。"
  159. });
  160. }
  161. catch (Exception ex)
  162. {
  163. return Json(new ReturnMessage()
  164. {
  165. IsSuccess = false,
  166. Message = "保存失败:" + ex.Message
  167. });
  168. }
  169. }
  170. /// <summary>
  171. /// 添加学生
  172. /// </summary>
  173. /// <param name="finalExaminationID"></param>
  174. /// <returns></returns>
  175. public ActionResult StudentAdd(Guid? finalExamination, Guid? UserID)
  176. {
  177. FinalExaminationView finalExaminationView = new FinalExaminationView();
  178. finalExaminationView = finalExaminationServices.Value.GetFinalExaminationView(finalExamination);
  179. finalExaminationView.isAutoAdd = true;
  180. if(UserID!=Guid.Empty&&UserID!=null){
  181. var student=StudentfileServices.Value.GetStudentfileView((Guid)UserID);
  182. var StarttermID = finalExaminationServices.Value.GetFinalExaminationStudentForStudentAdd(finalExamination, UserID);
  183. var f= finalExaminationServices.Value.GetStarttermID(finalExamination,UserID);
  184. finalExaminationView.UserID = UserID;
  185. finalExaminationView.UserName = student.UserName;
  186. finalExaminationView.StarttermID = StarttermID.StarttermID;
  187. //如果是修改变成false
  188. finalExaminationView.isAutoAdd = false;
  189. }
  190. return View(finalExaminationView);
  191. }
  192. /// <summary>
  193. /// 添加学生
  194. /// </summary>
  195. /// <param name="finalExaminationID"></param>
  196. /// <returns></returns>
  197. [HttpPost]
  198. public ActionResult StudentAdd(FinalExaminationView finalExaminationView)
  199. {
  200. try
  201. {
  202. finalExaminationServices.Value.StudentAdd(finalExaminationView);
  203. return Json(new ReturnMessage()
  204. {
  205. IsSuccess = true,
  206. Message = "保存成功。"
  207. });
  208. }
  209. catch (Exception ex)
  210. {
  211. return Json(new ReturnMessage()
  212. {
  213. IsSuccess = false,
  214. Message = "保存失败:" + ex.Message
  215. });
  216. }
  217. }
  218. /// <summary>
  219. /// 删除
  220. /// </summary>
  221. /// <param name="finalExaminationIDs"></param>
  222. /// <returns></returns>
  223. [HttpPost]
  224. public ActionResult Delete(string finalExaminationIDs)
  225. {
  226. try
  227. {
  228. List<Guid?> list = new List<Guid?>();
  229. for (int i = 0; i < finalExaminationIDs.Split(',').Length; i++)
  230. {
  231. if (!string.IsNullOrEmpty(finalExaminationIDs.Split(',')[i]))
  232. {
  233. Guid FinalExaminationID = new Guid(finalExaminationIDs.Split(',')[i]);
  234. list.Add(FinalExaminationID);
  235. }
  236. }
  237. finalExaminationServices.Value.FinalExaminationDelete(list);
  238. return this.Json("删除成功!");
  239. }
  240. catch (Exception ex)
  241. {
  242. string mge = ex.Message;
  243. System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
  244. if (num != null)
  245. {
  246. if (num.Number == 547)
  247. mge = "请先删除所有关联的数据!";
  248. }
  249. return this.Json("删除失败,原因:" + mge);
  250. }
  251. }
  252. /// <summary>
  253. /// 删除学生
  254. /// </summary>
  255. /// <param name="finalExaminationIDs"></param>
  256. /// <returns></returns>
  257. [HttpPost]
  258. public ActionResult StudentDelete(Guid finalExaminationID, string UserIDs)
  259. {
  260. try
  261. {
  262. List<Guid?> list = new List<Guid?>();
  263. for (int i = 0; i < UserIDs.Split(',').Length; i++)
  264. {
  265. if (!string.IsNullOrEmpty(UserIDs.Split(',')[i]))
  266. {
  267. Guid FinalExaminationID = new Guid(UserIDs.Split(',')[i]);
  268. list.Add(FinalExaminationID);
  269. }
  270. }
  271. finalExaminationServices.Value.FinalExaminationStudentDelete(finalExaminationID, list);
  272. return this.Json("删除成功!");
  273. }
  274. catch (Exception ex)
  275. {
  276. string mge = ex.Message;
  277. System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
  278. if (num != null)
  279. {
  280. if (num.Number == 547)
  281. mge = "请先删除所有关联的数据!";
  282. }
  283. return this.Json("删除失败,原因:" + mge);
  284. }
  285. }
  286. /// <summary>
  287. /// 生成考试科目
  288. /// </summary>
  289. /// <returns></returns>
  290. public ActionResult GenerateEdit(Guid? schoolYearID)
  291. {
  292. var schoolYear = SchoolYearServices.Value.GetSchoolYearIsCurrent(true);
  293. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();
  294. return View();
  295. }
  296. /// <summary>
  297. /// 生成考试科目
  298. /// </summary>
  299. /// <param name="schoolYearID"></param>
  300. /// <returns></returns>
  301. [HttpPost]
  302. public ActionResult GenerateEdit()
  303. {
  304. try
  305. {
  306. var schoolYearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  307. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  308. var gradeID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  309. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  310. var isGenerateNotSubmit = Request.Form["IsGenerateNotSubmit"].ParseStrTo<bool>();
  311. finalExaminationServices.Value.GenerateFinalExamination(schoolYearID, collegeID, gradeID, standardID, isGenerateNotSubmit == true);
  312. return Json(new ReturnMessage()
  313. {
  314. IsSuccess = true,
  315. Message = "生成成功。"
  316. });
  317. }
  318. catch (Exception ex)
  319. {
  320. return Json(new ReturnMessage()
  321. {
  322. IsSuccess = false,
  323. Message = "生成失败:" + ex.Message
  324. });
  325. }
  326. }
  327. /// <summary>
  328. /// 学生成绩录入名单
  329. /// </summary>
  330. /// <returns></returns>
  331. public ActionResult StudentList(Guid? finalExaminationID)
  332. {
  333. ViewBag.FinalExaminationID = finalExaminationID;
  334. return View();
  335. }
  336. /// <summary>
  337. /// 期末设定学生成绩录入名单
  338. /// </summary>
  339. /// <param name="pararms"></param>
  340. /// <returns></returns>
  341. [HttpPost]
  342. public ActionResult FinalExaminationStudentList()
  343. {
  344. var finalExaminationID = Request["finalExaminationID"].ParseStrTo<Guid>();
  345. return Json(finalExaminationServices.Value.GetFinalExaminationStudent(finalExaminationID));
  346. }
  347. ///// <summary>
  348. ///// 添加学生
  349. ///// </summary>
  350. ///// <param name="finalExaminationID"></param>
  351. ///// <param name="userIDs"></param>
  352. ///// <returns></returns>
  353. //[HttpPost]
  354. //public ActionResult FinalExaminationStudentAdd(Guid? finalExaminationID, string userIDs)
  355. //{
  356. // try
  357. // {
  358. // List<Guid> list = new List<Guid>();
  359. // for (int i = 0; i < userIDs.Split(',').Length; i++)
  360. // {
  361. // if (!string.IsNullOrEmpty(userIDs.Split(',')[i]))
  362. // {
  363. // Guid userID = new Guid(userIDs.Split(',')[i]);
  364. // list.Add(userID);
  365. // }
  366. // }
  367. // finalExaminationServices.Value.FinalExaminationStudentAdd(finalExaminationID, list);
  368. // return Json("成功");
  369. // }
  370. // catch (Exception ex)
  371. // {
  372. // return Json("增加学生失败,原因:" + ex.Message);
  373. // }
  374. //}
  375. /// <summary>
  376. /// 允许录入
  377. /// </summary>
  378. /// <param name="finalExaminationIDs"></param>
  379. /// <returns></returns>
  380. [HttpPost]
  381. public ActionResult Final_ResitExaminationIsEntry(string finalExaminationIDs)
  382. {
  383. try
  384. {
  385. List<Guid> list = new List<Guid>();
  386. for (int i = 0; i < finalExaminationIDs.Split(',').Length; i++)
  387. {
  388. if (!string.IsNullOrEmpty(finalExaminationIDs.Split(',')[i]))
  389. {
  390. Guid FinalExaminationID = new Guid(finalExaminationIDs.Split(',')[i]);
  391. list.Add(FinalExaminationID);
  392. }
  393. }
  394. finalExaminationServices.Value.GetFinal_ResitExaminationIsEntry(list);
  395. return Json("允许录入成功。");
  396. }
  397. catch (Exception ex)
  398. {
  399. return Json("允许录入失败,原因:" + ex.Message);
  400. }
  401. }
  402. /// <summary>
  403. /// 撤销录入
  404. /// </summary>
  405. /// <param name="finalExaminationIDs"></param>
  406. /// <returns></returns>
  407. [HttpPost]
  408. public ActionResult Final_ResitExaminationBack(string finalExaminationIDs)
  409. {
  410. try
  411. {
  412. List<Guid> list = new List<Guid>();
  413. for (int i = 0; i < finalExaminationIDs.Split(',').Length; i++)
  414. {
  415. if (!string.IsNullOrEmpty(finalExaminationIDs.Split(',')[i]))
  416. {
  417. Guid FinalExaminationID = new Guid(finalExaminationIDs.Split(',')[i]);
  418. list.Add(FinalExaminationID);
  419. }
  420. }
  421. finalExaminationServices.Value.GetFinal_ResitExaminationBack(list);
  422. return Json("取消录入成功。");
  423. }
  424. catch (Exception ex)
  425. {
  426. return Json("取消录入失败,原因:" + ex.Message);
  427. }
  428. }
  429. /// <summary>
  430. /// 导出Excel
  431. /// </summary>
  432. /// <returns></returns>
  433. [HttpPost]
  434. public ActionResult Excel()
  435. {
  436. NpoiExcelHelper neh = new NpoiExcelHelper();
  437. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  438. var FinalExaminationID = Request.Form["FinalExaminationID"];
  439. var collegeID = Request.Form["CollegeComboGrid"].ParseStrTo<Guid>();
  440. var departmentID = Request.Form["DepartmentComboGrid"].ParseStrTo<Guid>();
  441. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
  442. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  443. var examsCategoryID = Request.Form["DictionaryExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryExamsCategory"].ParseStrTo<int>();
  444. var schoolyearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  445. var approvalStatus = Request.Form["DictionaryScoreState"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryScoreState"].ParseStrTo<int>();
  446. var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  447. List<Guid?> FinalExaminationIDList = new List<Guid?>();
  448. if (FinalExaminationID != "")
  449. {
  450. FinalExaminationIDList = FinalExaminationID.SplitIDString();
  451. }
  452. else
  453. {
  454. FinalExaminationIDList = null;
  455. }
  456. var dt = finalExaminationServices.Value.GetFinalExaminationViewList_Excel(configuretView, collegeID, departmentID, schoolyearID, coursematerialID, courseTypeID, examsCategoryID,
  457. (int)EMIS.ViewModel.CF_ExaminationType.FinalExamination, approvalStatus, gradeYearID, FinalExaminationIDList).Select(x => new
  458. {
  459. x.SchoolyearCode,
  460. x.GradeYearID,
  461. x.ClassName,
  462. x.CourseCode,
  463. x.CourseName,
  464. x.CourseTypeName,
  465. x.Credit,
  466. x.ExamsCategoryName,
  467. x.CreatorUserNo,
  468. x.CreatorUserName,
  469. x.EntryDeadlineTime,
  470. x.StudentCount,
  471. x.SAPunlogStudentCount,
  472. x.ApprovalStatusName
  473. }).ToTable();
  474. string[] liststring = { "学年学期", "年级", "录入班级名称", "课程代码", "课程名称","课程类型","学分", "考试性质","录入人编号", "录入人姓名",
  475. "录入截止日期","学生数","未录入人数","状态" };
  476. neh.Export(dt, liststring, "期末设定信息");
  477. return RedirectToAction("MsgShow", "Common", new
  478. {
  479. msg = "导出成功!",
  480. url = Url.Action("List").AddMenuParameter()
  481. });
  482. }
  483. /// <summary>
  484. /// 查找默认开课学期
  485. /// </summary>
  486. /// <param name="finalExaminationIDs"></param>
  487. /// <returns></returns>
  488. [HttpPost]
  489. public ActionResult GetStarttermID(Guid? finalExaminationID,Guid? UserID)
  490. {
  491. var value= finalExaminationServices.Value.GetStarttermID(finalExaminationID,UserID);
  492. return Json(value);
  493. }
  494. /// <summary>
  495. /// 新增前验证
  496. /// </summary>
  497. /// <param name="finalExaminationIDs"></param>
  498. /// <returns></returns>
  499. [HttpPost]
  500. public ActionResult Verification(Guid? finalExaminationID, Guid? UserID)
  501. {
  502. var Student = finalExaminationServices.Value.GetFinalExaminationStudentForStudentAdd(finalExaminationID, UserID);
  503. if (Student == null)
  504. {
  505. return base.Json("不存在");
  506. }
  507. else
  508. {
  509. return base.Json("存在");
  510. }
  511. }
  512. [HttpPost]
  513. public ActionResult StudentDetails_Excel()
  514. {
  515. NpoiExcelHelper neh = new NpoiExcelHelper();
  516. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  517. var FinalExaminationID = Request.Form["FinalExaminationID"];
  518. var collegeID = Request.Form["CollegeComboGrid"].ParseStrTo<Guid>();
  519. var departmentID = Request.Form["DepartmentComboGrid"].ParseStrTo<Guid>();
  520. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
  521. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  522. var examsCategoryID = Request.Form["DictionaryExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryExamsCategory"].ParseStrTo<int>();
  523. var schoolyearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  524. var approvalStatus = Request.Form["DictionaryScoreState"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryScoreState"].ParseStrTo<int>();
  525. var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  526. List<Guid?> FinalExaminationIDList = new List<Guid?>();
  527. if (FinalExaminationID != "")
  528. {
  529. FinalExaminationIDList = FinalExaminationID.SplitIDString();
  530. }
  531. else
  532. {
  533. FinalExaminationIDList = null;
  534. }
  535. var dt = finalExaminationServices.Value.GetFinalExaminationStudentDetailsList(configuretView, collegeID, departmentID, schoolyearID, coursematerialID, courseTypeID, examsCategoryID,
  536. (int)EMIS.ViewModel.CF_ExaminationType.FinalExamination, approvalStatus, gradeYearID, FinalExaminationIDList).Select(x => new
  537. {
  538. x.SchoolyearCode,
  539. x.ClassName,
  540. x.CourseCode,
  541. x.CourseName,
  542. x.CourseTypeName,
  543. x.Credit,
  544. x.ExamsCategoryName,
  545. x.LoginID,
  546. x.UserName,
  547. x.CollegeName,
  548. x.Year,
  549. x.StandardName,
  550. x.ClassmajorName,
  551. }).ToTable();
  552. string[] liststring = { "学年学期","录入班级", "课程代码", "课程名称", "课程类型","学分","考试性质", "学号","姓名",RSL.Get("College"),
  553. "年级","专业名称","班级名称" };
  554. neh.Export(dt, liststring, "成绩录入学生名单" + DateTime.Now.ToString("yyyyMMdd"));
  555. return RedirectToAction("MsgShow", "Common", new
  556. {
  557. msg = "导出成功!",
  558. url = Url.Action("List").AddMenuParameter()
  559. });
  560. }
  561. /// <summary>
  562. /// 批量修改验证
  563. /// </summary>
  564. /// <param name="finalExaminationIDs"></param>
  565. /// <returns></returns>
  566. //[HttpPost]
  567. //public ActionResult CanBatchEdit(string finalExaminationIDs)
  568. //{
  569. // List<Guid?> list = new List<Guid?>();
  570. // for (int i = 0; i < finalExaminationIDs.Split(',').Length; i++)
  571. // {
  572. // if (!string.IsNullOrEmpty(finalExaminationIDs.Split(',')[i]))
  573. // {
  574. // Guid FinalExaminationID = new Guid(finalExaminationIDs.Split(',')[i]);
  575. // list.Add(FinalExaminationID);
  576. // }
  577. // }
  578. // var Student = finalExaminationServices.Value.CanBatchEdit(list);
  579. // if (Student == "可以修改")
  580. // {
  581. // return base.Json("可以修改");
  582. // }
  583. // else
  584. // {
  585. // return base.Json("不能修改");
  586. // }
  587. //}
  588. }
  589. }