RetakePlanListController.cs 8.9 KB

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