RetakePlanPrescanGeneralController.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 Bowin.Common.Utility;
  9. using EMIS.CommonLogic.RetakeManage;
  10. using Bowin.Web.Controls.Mvc;
  11. using Bowin.Common.Data;
  12. using EMIS.ViewModel.RetakeManage;
  13. using EMIS.CommonLogic.RetakeManage.General;
  14. using EMIS.Utility;
  15. namespace EMIS.Web.Controllers.RetakeManage.General
  16. {
  17. [Authorization]
  18. public class RetakePlanPrescanGeneralController : Controller
  19. {
  20. public IRetakePlanTaskServices RetakePlanServices { get; set; }
  21. /// <summary>
  22. /// 学生预查页面(网上报名版本)
  23. /// </summary>
  24. /// <returns></returns>
  25. public ActionResult List()
  26. {
  27. return View();
  28. }
  29. /// <summary>
  30. /// 学生预查(网上报名版本)列表查询
  31. /// </summary>
  32. /// <param name="pararms"></param>
  33. /// <returns></returns>
  34. [HttpPost]
  35. public ActionResult List(QueryParamsModel pararms)
  36. {
  37. try
  38. {
  39. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  40. var schoolyearID = pararms.getExtraGuid("SchoolYearDropdown").ToString() == DropdownList.SELECT_ALL.ToString() ? null : pararms.getExtraGuid("SchoolYearDropdown");
  41. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  42. //开课教研室
  43. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  44. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  45. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  46. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  47. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  48. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  49. var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
  50. //在校状态
  51. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  52. //考试性质
  53. var examsCategoryID = pararms.getExtraInt("DictionaryExamsCategory") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryExamsCategory");
  54. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  55. //课程类型List
  56. var courseTypeIDs = pararms.getExtraString("CourseTypeID");
  57. return Json(RetakePlanServices.GetRetakePreStudentView(configuretView, schoolyearID, collegeID, departmentID, yearID,
  58. standardID, educationID, learningformID, learnSystem, classmajorID, inSchoolStatus, examsCategoryID,
  59. coursematerialID, courseTypeIDs, (int)pararms.page, (int)pararms.rows));
  60. }
  61. catch (Exception ex)
  62. {
  63. //页面弹出消息框
  64. return base.Json("查询失败,原因:" + ex.Message);
  65. }
  66. }
  67. /// <summary>
  68. /// 重修任务生成页面
  69. /// </summary>
  70. /// <returns></returns>
  71. public ActionResult Generate()
  72. {
  73. RetakeStudentListView retakeStudentListView = new RetakeStudentListView();
  74. retakeStudentListView.RetakeTypeID = (int)ER_RetakeType.Retake; //重修类型默认为正常重修
  75. return View(retakeStudentListView);
  76. }
  77. /// <summary>
  78. /// 重修任务生成确定
  79. /// </summary>
  80. /// <param name="finallyScoreIDs"></param>
  81. /// <param name="retakeStudentListView"></param>
  82. /// <returns></returns>
  83. [HttpPost]
  84. public ActionResult Generate(string finallyScoreIDs, RetakeStudentListView retakeStudentListView)
  85. {
  86. try
  87. {
  88. //最终成绩信息IDList
  89. var finallyScoreIDList = finallyScoreIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  90. .Select(x => (Guid?)new Guid(x)).ToList();
  91. string result = RetakePlanServices.Generate(finallyScoreIDList, retakeStudentListView.RetakeTypeID);
  92. return Json(new ReturnMessage()
  93. {
  94. IsSuccess = true,
  95. Message = "生成成功" + result + "。"
  96. });
  97. }
  98. catch (Exception ex)
  99. {
  100. return Json(new ReturnMessage()
  101. {
  102. IsSuccess = false,
  103. Message = "生成失败,原因:" + ex.Message + "。"
  104. });
  105. }
  106. }
  107. /// <summary>
  108. /// Excel导出
  109. /// </summary>
  110. /// <returns></returns>
  111. [HttpPost]
  112. public ActionResult Excel()
  113. {
  114. try
  115. {
  116. NpoiExcelHelper neh = new NpoiExcelHelper();
  117. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  118. var schoolyearID = Request.Form["SchoolYearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  119. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  120. //开课教研室
  121. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  122. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  123. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  124. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  125. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  126. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  127. var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
  128. //在校状态
  129. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  130. var examsCategoryID = Request.Form["DictionaryExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryExamsCategory"].ParseStrTo<int>();
  131. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
  132. var courseTypeIDs = Request.Form["CourseTypeID"].ToString();
  133. var dt = RetakePlanServices.GetRetakePreStudentViewList(configuretView, schoolyearID, collegeID, departmentID, yearID,
  134. standardID, educationID, learningformID, learnSystem, classmajorID, inSchoolStatus, examsCategoryID,
  135. coursematerialID, courseTypeIDs)
  136. .Select(x => new
  137. {
  138. x.LoginID,
  139. x.UserName,
  140. x.SexName,
  141. x.ClassmajorCode,
  142. x.ClassmajorName,
  143. x.GrademajorCode,
  144. x.GrademajorName,
  145. x.CollegeNo,
  146. x.CollegeName,
  147. x.Gradeyear,
  148. x.StandardID,
  149. x.StandardCode,
  150. x.StandardDesc,
  151. x.EducationName,
  152. x.LearningformName,
  153. x.LearnSystem,
  154. x.SchoolyearCode,
  155. x.CourseCode,
  156. x.CourseName,
  157. x.CourseTypeDesc,
  158. x.CourseCredit,
  159. x.ExamsCategoryDesc,
  160. x.ExamsStateDesc,
  161. x.SchoolyearNumDesc,
  162. x.StarttermDesc,
  163. x.TotalScore,
  164. x.DepartmentCode,
  165. x.DepartmentName,
  166. x.InSchoolStatusName,
  167. x.StudentStatusName
  168. }).ToTable();
  169. string[] liststring = {
  170. "学号", "姓名", "性别", "班级编号", "班级名称", "年级专业编号", "年级专业名称",
  171. RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "年级", "专业ID(Value)", "专业代码",
  172. "专业名称", RSL.Get("EducationID"), "学习形式", "学制", "学年学期", "课程代码",
  173. "课程名称", "课程类型", "课程学分", "考试性质", "考试状态", "开课学年", "开课学期",
  174. "总成绩", "开课教研室代码", "开课教研室", "在校状态", "学籍状态"
  175. };
  176. neh.Export(dt, liststring, "学生预查信息" + DateTime.Now.ToString("yyyyMMddhhmmss"));
  177. return Json(new ReturnMessage()
  178. {
  179. IsSuccess = true,
  180. Message = "导出成功。"
  181. });
  182. }
  183. catch (Exception ex)
  184. {
  185. //页面弹出消息框
  186. return base.Json("导出失败,原因:" + ex.Message);
  187. }
  188. }
  189. }
  190. }