StudentScoreController.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  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.CommonLogic.ScoreManage;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.ViewModel.ScoreManage;
  11. using System.Dynamic;
  12. using EMIS.Utility;
  13. using Bowin.Common.Exceptions;
  14. using EMIS.Entities;
  15. using Bowin.Common.Utility;
  16. using Bowin.Common.Data;
  17. using EMIS.CommonLogic.CalendarManage;
  18. using NPOI.SS.UserModel;
  19. using NPOI.HSSF.UserModel;
  20. using NPOI.HSSF.Util;
  21. using EMIS.CommonLogic.Students;
  22. using EMIS.CommonLogic.SystemServices;
  23. namespace EMIS.Web.Controllers.ScoreManage
  24. {
  25. [Authorization]
  26. public class StudentScoreController : Controller
  27. {
  28. public Lazy<IStudentScoreServices> studentScoreServices { get; set; }
  29. public Lazy<ISchoolYearServices> SchoolYearServices { get; set; }
  30. public Lazy<IStudentsServices> StudentfileServices { get; set; }
  31. public IRoleServices RoleServices { get; set; }
  32. /// <summary>
  33. /// 学生成绩页面
  34. /// </summary>
  35. /// <returns></returns>
  36. public ActionResult List()
  37. {
  38. var schoolYear = SchoolYearServices.Value.GetSchoolYearIsCurrent(true);
  39. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  40. return View();
  41. }
  42. /// <summary>
  43. /// 查询列表
  44. /// </summary>
  45. /// <param name="pararms"></param>
  46. /// <returns></returns>
  47. [HttpPost]
  48. public ActionResult List(QueryParamsModel pararms)
  49. {
  50. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  51. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  52. var yearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  53. var standardID = pararms.getExtraInt("StandardID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardID");
  54. var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
  55. var departmentID = pararms.getExtraGuid("DepartmentComboGrid");
  56. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  57. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  58. var examsCategoryID = pararms.getExtraInt("DictionaryExamsCategory") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryExamsCategory");
  59. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  60. var starttermBegin = pararms.getExtraInt("DictionaryStarttermBegin") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStarttermBegin");
  61. var starttermEnd = pararms.getExtraInt("DictionaryStarttermEnd") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStarttermEnd");
  62. var handleModeID = pararms.getExtraInt("HandleModeDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("HandleModeDictionaryDropDown");
  63. var learningformID = pararms.getExtraInt("LearningformDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("LearningformDictionaryDropDown");
  64. var education = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  65. var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
  66. return Json(studentScoreServices.Value.GetStudentScoreViewGrid(configuretView, collegeID, departmentID, schoolyearID, coursematerialID, courseTypeID, examsCategoryID,
  67. standardID, classmajorID, starttermBegin, starttermEnd, yearID, learningformID, handleModeID, education, LearnSystem, (int)pararms.page, (int)pararms.rows));
  68. }
  69. public ActionResult StudentScoreReport(QueryParamsModel pararms)
  70. {
  71. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  72. var dataRange = RoleServices.GetDataRange();
  73. ViewBag.DataRange = dataRange;
  74. ViewBag.UserID = curUser.UserID.ToString();
  75. return View();
  76. }
  77. public ActionResult HBKDStudentScoreReport(QueryParamsModel pararms)
  78. {
  79. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  80. var dataRange = RoleServices.GetDataRange();
  81. var LoginCampusID = RoleServices.GetLoginCampusID(dataRange, curUser.UserID);
  82. var LoginCollegeID = RoleServices.GetLoginCollegeID(dataRange, curUser.UserID);
  83. var LoginClassmajorID = RoleServices.GetLoginClassmajorID(dataRange, curUser.UserID);
  84. ViewBag.LoginCampusID = LoginCampusID;
  85. ViewBag.LoginCollegeID = LoginCollegeID;
  86. ViewBag.LoginClassmajorID = LoginClassmajorID;
  87. return View();
  88. }
  89. public ActionResult GzzyStudentScoreReport(QueryParamsModel pararms)
  90. {
  91. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  92. var dataRange = RoleServices.GetDataRange();
  93. var LoginCampusID = RoleServices.GetLoginCampusID(dataRange, curUser.UserID);
  94. var LoginCollegeID = RoleServices.GetLoginCollegeID(dataRange, curUser.UserID);
  95. var LoginClassmajorID = RoleServices.GetLoginClassmajorID(dataRange, curUser.UserID);
  96. ViewBag.LoginCampusID = LoginCampusID;
  97. ViewBag.LoginCollegeID = LoginCollegeID;
  98. ViewBag.LoginClassmajorID = LoginClassmajorID;
  99. return View();
  100. }
  101. public ActionResult Add(Guid? submitedScoreID)
  102. {
  103. List<Dictionary<string, string>> listDictionary = new List<Dictionary<string, string>>();
  104. var scoreDynamicTypes = DictionaryHelper.GetDictionaryValue(DictionaryItem.CF_ScoreType);
  105. ViewBag.ScoreDynamicTypes = scoreDynamicTypes;
  106. StudentScoreView studentScoreView = new StudentScoreView();
  107. if (submitedScoreID.HasValue)
  108. {
  109. List<ER_SubmitedScoreDetail> listSubmitedScoreDetail = studentScoreServices.Value.GetSubmitedScore(submitedScoreID).ER_SubmitedScoreDetail.ToList();
  110. studentScoreView = studentScoreServices.Value.GetStudentScoreView(submitedScoreID);
  111. foreach (var scoreDynamicType in scoreDynamicTypes)
  112. {
  113. ER_SubmitedScoreDetail submitedScoreDetail = listSubmitedScoreDetail.Where(x => x.ScoreTypeID == scoreDynamicType.Value).FirstOrDefault();
  114. listDictionary.Add(new Dictionary<string, string> { { "Formula_" + submitedScoreDetail.ScoreTypeID, submitedScoreDetail.Score == null ? "0" : submitedScoreDetail.Score.ToString() } });
  115. }
  116. listDictionary.Add(new Dictionary<string, string> { { "TotalScore", studentScoreView.TotalScore == null ? "0" : studentScoreView.TotalScore.ToString() } });
  117. //listDictionary.Add(new Dictionary<string, string> { { "ScoreCredit", studentScoreView.ScoreCredit == null ? "0" : studentScoreView.ScoreCredit.ToString() } });
  118. //listDictionary.Add(new Dictionary<string, string> { { "GradePoint", studentScoreView.GradePoint == null ? "0" : studentScoreView.GradePoint.ToString() } });
  119. }
  120. else
  121. {
  122. foreach (var scoreDynamicType in scoreDynamicTypes)
  123. {
  124. listDictionary.Add(new Dictionary<string, string> { { "Formula_" + scoreDynamicType.Value, "0" } });
  125. }
  126. listDictionary.Add(new Dictionary<string, string> { { "TotalScore", "0" } });
  127. //listDictionary.Add(new Dictionary<string, string> { { "ScoreCredit", "0" } });
  128. //listDictionary.Add(new Dictionary<string, string> { { "GradePoint", "0" } });
  129. }
  130. ViewBag.ListDictionary = listDictionary;
  131. return View(studentScoreView);
  132. }
  133. /// <summary>
  134. /// 新增
  135. /// </summary>
  136. /// <param name="studentScoreView"></param>
  137. /// <returns></returns>
  138. [HttpPost]
  139. public ActionResult Add(StudentScoreView studentScoreView)
  140. {
  141. try
  142. {
  143. List<ExpandoObject> listExpandoObject = new List<ExpandoObject>();
  144. var scoreTypeList = DictionaryHelper.GetDictionaryValue(DictionaryItem.CF_ScoreType);
  145. foreach (var scoreType in scoreTypeList)
  146. {
  147. dynamic dyic = new ExpandoObject();
  148. dyic.ScoreTypeID = scoreType.Value;
  149. dyic.Score = Convert.ToDecimal(Request.Form["Formula_" + scoreType.Value]);
  150. listExpandoObject.Add(dyic);
  151. }
  152. studentScoreView.TotalScore = Convert.ToDecimal(Request.Form["TotalScore"]);
  153. studentScoreView.ScoreCredit = Convert.ToDecimal(Request.Form["ScoreCredit"]);
  154. studentScoreView.GradePoint = Convert.ToDecimal(Request.Form["GradePoint"]);
  155. //studentScoreView.StudentScoreRemark = Request.Form["Remark"];
  156. if (Request.Params["SaveType"] == "Add")//识别是否是复制性新增操作~~
  157. {
  158. studentScoreView.SubmitedScoreID = null;
  159. }
  160. studentScoreServices.Value.StudentScoreAdd(studentScoreView, listExpandoObject);
  161. return Json(new ReturnMessage()
  162. {
  163. IsSuccess = true,
  164. Message = "保存成功!"
  165. });
  166. }
  167. catch (Exception ex)
  168. {
  169. return Json(new ReturnMessage()
  170. {
  171. IsSuccess = false,
  172. Message = "保存失败,原因:" + ex.Message + "!"
  173. });
  174. }
  175. }
  176. public ActionResult Edit(Guid? submitedScoreID)
  177. {
  178. List<Dictionary<string, string>> listDictionary = new List<Dictionary<string, string>>();
  179. var scoreDynamicTypes = DictionaryHelper.GetDictionaryValue(DictionaryItem.CF_ScoreType);
  180. ViewBag.ScoreDynamicTypes = scoreDynamicTypes;
  181. StudentScoreView studentScoreView = new StudentScoreView();
  182. if (submitedScoreID.HasValue)
  183. {
  184. List<ER_SubmitedScoreDetail> listSubmitedScoreDetail = studentScoreServices.Value.GetSubmitedScore(submitedScoreID).ER_SubmitedScoreDetail.ToList();
  185. studentScoreView = studentScoreServices.Value.GetStudentScoreView(submitedScoreID);
  186. foreach (var scoreDynamicType in scoreDynamicTypes)
  187. {
  188. ER_SubmitedScoreDetail submitedScoreDetail = listSubmitedScoreDetail.Where(x => x.ScoreTypeID == scoreDynamicType.Value).FirstOrDefault();
  189. listDictionary.Add(new Dictionary<string, string> { { "Formula_" + submitedScoreDetail.ScoreTypeID, submitedScoreDetail.Score == null ? "0" : submitedScoreDetail.Score.ToString() } });
  190. }
  191. listDictionary.Add(new Dictionary<string, string> { { "TotalScore", studentScoreView.TotalScore == null ? "0" : studentScoreView.TotalScore.ToString() } });
  192. //listDictionary.Add(new Dictionary<string, string> { { "ScoreCredit", studentScoreView.ScoreCredit == null ? "0" : studentScoreView.ScoreCredit.ToString() } });
  193. //listDictionary.Add(new Dictionary<string, string> { { "GradePoint", studentScoreView.GradePoint == null ? "0" : studentScoreView.GradePoint.ToString() } });
  194. }
  195. else
  196. {
  197. foreach (var scoreDynamicType in scoreDynamicTypes)
  198. {
  199. listDictionary.Add(new Dictionary<string, string> { { "Formula_" + scoreDynamicType.Value, "0" } });
  200. }
  201. listDictionary.Add(new Dictionary<string, string> { { "TotalScore", "0" } });
  202. //listDictionary.Add(new Dictionary<string, string> { { "ScoreCredit", "0" } });
  203. //listDictionary.Add(new Dictionary<string, string> { { "GradePoint", "0" } });
  204. }
  205. ViewBag.ListDictionary = listDictionary;
  206. return View(studentScoreView);
  207. }
  208. /// <summary>
  209. /// 编辑
  210. /// </summary>
  211. /// <param name="studentScoreView"></param>
  212. /// <returns></returns>
  213. [HttpPost]
  214. public ActionResult Edit(StudentScoreView studentScoreView)
  215. {
  216. try
  217. {
  218. List<ExpandoObject> listExpandoObject = new List<ExpandoObject>();
  219. var scoreTypeList = DictionaryHelper.GetDictionaryValue(DictionaryItem.CF_ScoreType);
  220. foreach (var scoreType in scoreTypeList)
  221. {
  222. dynamic dyic = new ExpandoObject();
  223. dyic.ScoreTypeID = scoreType.Value;
  224. dyic.Score = Convert.ToDecimal(Request.Form["Formula_" + scoreType.Value]);
  225. listExpandoObject.Add(dyic);
  226. }
  227. studentScoreView.TotalScore = Convert.ToDecimal(Request.Form["TotalScore"]);
  228. studentScoreView.ScoreCredit = Convert.ToDecimal(Request.Form["ScoreCredit"]);
  229. studentScoreView.GradePoint = Convert.ToDecimal(Request.Form["GradePoint"]);
  230. //studentScoreView.StudentScoreRemark = Request.Form["Remark"];
  231. if (Request.Params["SaveType"] == "Add")//识别是否是复制性新增操作~~
  232. {
  233. studentScoreView.SubmitedScoreID = null;
  234. }
  235. studentScoreServices.Value.StudentScoreAdd(studentScoreView, listExpandoObject);
  236. return Json(new ReturnMessage()
  237. {
  238. IsSuccess = true,
  239. Message = "保存成功!"
  240. });
  241. }
  242. catch (Exception ex)
  243. {
  244. return Json(new ReturnMessage()
  245. {
  246. IsSuccess = false,
  247. Message = "保存失败,原因:" + ex.Message + "!"
  248. });
  249. }
  250. }
  251. [HttpPost]
  252. public ActionResult ValidateDuplicate(Guid? submitedScoreID, Guid? userID, Guid? coursematerialID, int? examsCategoryID, int? startTermID)
  253. {
  254. try
  255. {
  256. studentScoreServices.Value.ValidateDuplicate(submitedScoreID, userID, coursematerialID, examsCategoryID, startTermID);
  257. return Json(new ReturnMessage { IsSuccess = true });
  258. }
  259. catch (Exception ex)
  260. {
  261. return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message });
  262. }
  263. }
  264. /// <summary>
  265. /// 删除
  266. /// </summary>
  267. /// <param name="submitedScoreIDs"></param>
  268. /// <returns></returns>
  269. [HttpPost]
  270. public ActionResult Delete(string submitedScoreIDs)
  271. {
  272. try
  273. {
  274. List<Guid> list = new List<Guid>();
  275. for (int i = 0; i < submitedScoreIDs.Split(',').Length; i++)
  276. {
  277. if (!string.IsNullOrEmpty(submitedScoreIDs.Split(',')[i]))
  278. {
  279. Guid SubmitedScoreID = new Guid(submitedScoreIDs.Split(',')[i]);
  280. list.Add(SubmitedScoreID);
  281. }
  282. }
  283. studentScoreServices.Value.StudentScoreDelete(list);
  284. return this.Json("删除成功");
  285. }
  286. catch (Exception ex)
  287. {
  288. string mge = ex.Message;
  289. System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
  290. if (num != null)
  291. {
  292. if (num.Number == 547)
  293. mge = "请先删除所有关联的数据!";
  294. }
  295. return this.Json("删除失败,原因:" + mge);
  296. }
  297. }
  298. /// <summary>
  299. /// 导出Excel
  300. /// </summary>
  301. /// <returns></returns>
  302. [HttpPost]
  303. public ActionResult Excel()
  304. {
  305. NpoiExcelHelper neh = new NpoiExcelHelper();
  306. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  307. var submitedScoreID = Request.Form["SubmitedScoreID"];
  308. List<Guid?> submitedScoreIDList = new List<Guid?>();
  309. if (submitedScoreID != "")
  310. {
  311. submitedScoreIDList = submitedScoreID.SplitIDString();
  312. }
  313. else
  314. {
  315. submitedScoreIDList = null;
  316. }
  317. var collegeID = Request.Form["CollegeComboGrid"].ParseStrTo<Guid>();
  318. var departmentID = Request.Form["DepartmentComboGrid"].ParseStrTo<Guid>();
  319. var yearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  320. var grademajorID = Request.Form["GrademajorComboGrid"].ParseStrTo<Guid>();
  321. var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
  322. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
  323. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  324. var examsCategoryID = Request.Form["DictionaryExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryExamsCategory"].ParseStrTo<int>();
  325. var schoolyearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  326. var learningformID = Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>();
  327. var education = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  328. var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  329. Func<IWorkbook, HSSFCellStyle> noPassStyleFunc = (x =>
  330. {
  331. var style = (HSSFCellStyle)x.CreateCellStyle();
  332. var font = (HSSFFont)x.CreateFont();
  333. font.Color = HSSFColor.RED.index;
  334. style.SetFont(font);
  335. return style;
  336. });
  337. List<NpoiExcelCellStyle> styleList = new List<NpoiExcelCellStyle>();
  338. var dt = studentScoreServices.Value.GetStudentScoreViewList(configuretView, collegeID, departmentID, schoolyearID, coursematerialID, courseTypeID, examsCategoryID,
  339. grademajorID, classmajorID, yearID, learningformID, education, LearnSystem, submitedScoreIDList).Select(x => new
  340. {
  341. x.LoginID,
  342. x.UserName,
  343. x.ClassName,
  344. x.SchoolyearCode,
  345. x.CourseName,
  346. x.CourseCode,
  347. x.CourseTypeName,
  348. x.ExamsCategoryName,
  349. x.ExaminationModeName,
  350. x.ExamsStateName,
  351. x.StarttermName,
  352. x.Pingshi,
  353. x.Jishu,
  354. x.Lilun,
  355. TotalScore = x.TotalScoreStr,
  356. x.ScoreCredit,
  357. x.GradePoint,
  358. x.Remarks
  359. }).ToTable();
  360. for (int i = 0; i < dt.Rows.Count; i++)
  361. {
  362. decimal tmpPingshi;
  363. if (decimal.TryParse(Convert.ToString(dt.Rows[i]["Pingshi"]), out tmpPingshi))
  364. {
  365. if (tmpPingshi < 60)
  366. {
  367. styleList.Add(new NpoiExcelCellStyle { RowIndex = i, ColumnIndex = 11, StyleFunc = noPassStyleFunc });
  368. }
  369. }
  370. else
  371. {
  372. styleList.Add(new NpoiExcelCellStyle { RowIndex = i, ColumnIndex = 11, StyleFunc = noPassStyleFunc });
  373. }
  374. decimal tmpJishu;
  375. if (decimal.TryParse(Convert.ToString(dt.Rows[i]["Jishu"]), out tmpJishu))
  376. {
  377. if (tmpJishu < 60)
  378. {
  379. styleList.Add(new NpoiExcelCellStyle { RowIndex = i, ColumnIndex = 12, StyleFunc = noPassStyleFunc });
  380. }
  381. }
  382. else
  383. {
  384. styleList.Add(new NpoiExcelCellStyle { RowIndex = i, ColumnIndex = 12, StyleFunc = noPassStyleFunc });
  385. }
  386. decimal tmpLilun;
  387. if (decimal.TryParse(Convert.ToString(dt.Rows[i]["Lilun"]), out tmpLilun))
  388. {
  389. if (tmpLilun < 60)
  390. {
  391. styleList.Add(new NpoiExcelCellStyle { RowIndex = i, ColumnIndex = 13, StyleFunc = noPassStyleFunc });
  392. }
  393. }
  394. else
  395. {
  396. styleList.Add(new NpoiExcelCellStyle { RowIndex = i, ColumnIndex = 13, StyleFunc = noPassStyleFunc });
  397. }
  398. decimal tmpTotalScore;
  399. if (decimal.TryParse(Convert.ToString(dt.Rows[i]["TotalScore"]), out tmpTotalScore))
  400. {
  401. if (tmpTotalScore < 60)
  402. {
  403. styleList.Add(new NpoiExcelCellStyle { RowIndex = i, ColumnIndex = 14, StyleFunc = noPassStyleFunc });
  404. }
  405. }
  406. else
  407. {
  408. styleList.Add(new NpoiExcelCellStyle { RowIndex = i, ColumnIndex = 14, StyleFunc = noPassStyleFunc });
  409. }
  410. }
  411. string[] liststring = { "学号", "姓名", "班级名称", "学年学期", "课程名称","课程代码","课程类型", "考试性质","考试方式", "考试状态",
  412. "开课学期",@EMIS.Utility.RSL.Get("Peacetime"),@EMIS.Utility.RSL.Get("Technique"),@EMIS.Utility.RSL.Get("Theoretical"), "总成绩", "学分", "绩点","备注" };
  413. neh.PresetCellStyle(styleList);
  414. neh.Export(dt, liststring, "学生成绩信息");
  415. return RedirectToAction("MsgShow", "Common", new
  416. {
  417. msg = "导出成功!",
  418. url = Url.Action("List").AddMenuParameter()
  419. });
  420. }
  421. [HttpPost]
  422. public ActionResult RefreshFinallyScoreForBatchUpdate(string submitedScoreIDString)
  423. {
  424. var submitedScoreIDList = submitedScoreIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  425. try
  426. {
  427. this.studentScoreServices.Value.RefreshFinallyScoreBySubmitedScoreID(submitedScoreIDList);
  428. return Json(new ReturnMessage()
  429. {
  430. IsSuccess = true,
  431. Message = "更新成功。"
  432. });
  433. }
  434. catch (Exception ex)
  435. {
  436. this.studentScoreServices.Value.RefreshFinallyScoreBySubmitedScoreID(submitedScoreIDList);
  437. return Json(new ReturnMessage()
  438. {
  439. IsSuccess = true,
  440. Message = "更新失败:" + ex.Message
  441. });
  442. }
  443. }
  444. /// <summary>
  445. ///
  446. /// </summary>
  447. /// <param name="bindType"></param>
  448. /// <param name="collegeID"></param>
  449. /// <param name="year"></param>
  450. /// <param name="standardID"></param>
  451. /// <returns></returns>
  452. [HttpPost]
  453. public ActionResult BindDropdownListBySchoolyearNum(DropdownListBindType? bindType, int? year)
  454. {
  455. var StarttermList = this.studentScoreServices.Value.GetStarttermList(year);
  456. List<DropdownListItem> list = StarttermList.Select(x=> new DropdownListItem{ Text=x.StarttermName,Value=x.StarttermID }).ToList();
  457. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  458. DropdownList.FormatDropdownItemList(dbt, list);
  459. return base.Json(list);
  460. }
  461. }
  462. }