RetakePlanResultController.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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.Web.Controls.Mvc;
  9. using EMIS.CommonLogic.RetakeManage;
  10. using Bowin.Common.Utility;
  11. using Bowin.Common.Data;
  12. using EMIS.CommonLogic.RetakeManage.General;
  13. using EMIS.ViewModel.RetakeManage;
  14. using EMIS.Utility.FormValidate;
  15. using Bowin.Common.Linq.Entity;
  16. using Bowin.Common.JSON;
  17. using EMIS.Utility;
  18. namespace EMIS.Web.Controllers.RetakeManage.General
  19. {
  20. [Authorization]
  21. public class RetakePlanResultController : Controller
  22. {
  23. public IRetakePlanResultServices RetakePlanResultServices { get; set; }
  24. /// <summary>
  25. /// 重修名单页面
  26. /// </summary>
  27. /// <returns></returns>
  28. public ActionResult List()
  29. {
  30. return View();
  31. }
  32. /// <summary>
  33. /// 重修名单列表查询
  34. /// </summary>
  35. /// <param name="pararms"></param>
  36. /// <returns></returns>
  37. [HttpPost]
  38. public ActionResult List(QueryParamsModel pararms)
  39. {
  40. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  41. var schoolyearID = pararms.getExtraGuid("SchoolYearDropdown").ToString() == DropdownList.SELECT_ALL.ToString() ? null : pararms.getExtraGuid("SchoolYearDropdown");
  42. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  43. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  44. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  45. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  46. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  47. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  48. var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
  49. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  50. //在校状态
  51. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  52. //重修任务状态
  53. var retakePlanStatusID = pararms.getExtraInt("DictionaryRetakePlanStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryRetakePlanStatus");
  54. //报名状态
  55. var generalPurposeID = pararms.getExtraInt("DictionaryGeneralPurpose") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGeneralPurpose");
  56. return Json(RetakePlanResultServices.GetRetakePlanResultStudentView(configuretView, schoolyearID, collegeID, yearID, standardID,
  57. educationID, learningformID, learnSystem, classmajorID, coursematerialID, inSchoolStatus, retakePlanStatusID,
  58. generalPurposeID, (int)pararms.page, (int)pararms.rows));
  59. }
  60. /// <summary>
  61. /// 取消报名(删除)
  62. /// </summary>
  63. /// <param name="RetakePlanStudentIDs"></param>
  64. /// <returns></returns>
  65. [HttpPost]
  66. public ActionResult Delete(string RetakePlanStudentIDs)
  67. {
  68. try
  69. {
  70. RetakePlanResultServices.RetakePlanResultDelete(RetakePlanStudentIDs);
  71. return Json(new ReturnMessage()
  72. {
  73. IsSuccess = true,
  74. Message = "取消报名成功。"
  75. });
  76. }
  77. catch (Exception ex)
  78. {
  79. return Json(new ReturnMessage()
  80. {
  81. IsSuccess = false,
  82. Message = "取消报名失败,原因:" + ex.Message
  83. });
  84. }
  85. }
  86. /// <summary>
  87. /// Excel导出
  88. /// </summary>
  89. /// <returns></returns>
  90. [HttpPost]
  91. public ActionResult Excel()
  92. {
  93. NpoiExcelHelper neh = new NpoiExcelHelper();
  94. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  95. var schoolyearID = Request.Form["SchoolYearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  96. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  97. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  98. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  99. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  100. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  101. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  102. var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
  103. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
  104. //在校状态
  105. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  106. //重修任务状态
  107. var retakePlanStatusID = Request.Form["DictionaryRetakePlanStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryRetakePlanStatus"].ParseStrTo<int>();
  108. //报名状态
  109. var generalPurposeID = Request.Form["DictionaryGeneralPurpose"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGeneralPurpose"].ParseStrTo<int>();
  110. var dt = RetakePlanResultServices.GetRetakePlanResultStudentViewList(configuretView, schoolyearID, collegeID, yearID, standardID,
  111. educationID, learningformID, learnSystem, classmajorID, coursematerialID, inSchoolStatus,
  112. retakePlanStatusID, generalPurposeID)
  113. .Select(x => new
  114. {
  115. x.SchoolyearCode,
  116. x.ClassName,
  117. x.RetakeTypeName,
  118. x.LoginID,
  119. x.UserName,
  120. x.SexName,
  121. x.Gradeyear,
  122. x.StandardID,
  123. x.StandardCode,
  124. x.StandardDesc,
  125. x.EducationName,
  126. x.LearningformName,
  127. x.LearnSystem,
  128. x.ClassmajorCode,
  129. x.ClassmajorName,
  130. x.GrademajorCode,
  131. x.GrademajorName,
  132. x.CollegeNo,
  133. x.CollegeName,
  134. x.CourseCode,
  135. x.CourseName,
  136. x.CourseTypeDesc,
  137. x.CourseCredit,
  138. x.SchoolyearNumDesc,
  139. x.StarttermDesc,
  140. x.DepartmentCode,
  141. x.DepartmentName,
  142. x.InSchoolStatusName,
  143. x.StudentStatusName,
  144. x.RecordStatusName,
  145. x.ApplyStatusName
  146. }).ToTable();
  147. string[] liststring = {
  148. "重修学年学期", "重修班级名称", "重修类型", "学号", "姓名", "性别", "年级", "专业ID(Value)",
  149. "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式", "学制", "班级编号", "班级名称",
  150. "年级专业编号", "年级专业名称", RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "课程代码",
  151. "课程名称", "课程类型", "课程学分", "开课学年", "开课学期", "开课教研室代码", "开课教研室",
  152. "在校状态", "学籍状态", "重修任务状态", "报名状态"
  153. };
  154. neh.Export(dt, liststring, "重修班级名单信息" + DateTime.Now.ToString("yyyyMMddhhmmss"));
  155. return RedirectToAction("MsgShow", "Common", new
  156. {
  157. msg = "导出成功。",
  158. url = Url.Content("~/RetakePlanResult/List").AddMenuParameter()
  159. });
  160. }
  161. }
  162. }