StudentBatchQuitController.cs 7.5 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 Bowin.Web.Controls.Mvc;
  7. using Bowin.Common.Utility;
  8. using Bowin.Common.Data;
  9. using EMIS.CommonLogic.Students;
  10. using EMIS.ViewModel;
  11. using EMIS.Web.Controls;
  12. namespace EMIS.Web.Controllers.StudentManage.StudentChange
  13. {
  14. [Authorization]
  15. public class StudentBatchQuitController : Controller
  16. {
  17. public IDifferentDynamicServices DifferentDynamicServices { get; set; }
  18. public IBatchQuitServices BatchQuitServices { get; set; }
  19. /// <summary>
  20. ///
  21. /// </summary>
  22. /// <returns></returns>
  23. public ActionResult List()
  24. {
  25. return View();
  26. }
  27. /// <summary>
  28. /// 列表查询
  29. /// </summary>
  30. /// <param name="pararms"></param>
  31. /// <returns></returns>
  32. [HttpPost]
  33. public ActionResult List(QueryParamsModel pararms)
  34. {
  35. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  36. var schoolYearID = pararms.getExtraGuid("ddlSchoolYear"); //学年学期
  37. var campusID = pararms.getExtraGuid("cbgCampus"); //校区
  38. var collegeID = pararms.getExtraGuid("cbgCollege"); //院系所
  39. var education = pararms.getExtraInt("ddlEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlEducation"); //培养层次
  40. var year = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear"); //年级
  41. var standard = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard"); //专业名称
  42. var learningform = pararms.getExtraInt("ddlLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlLearningform"); //学习形式
  43. var differentDynamicStatus = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus"); //审批状态
  44. var result = BatchQuitServices.GetDifferentDynamicViewGrid(configuretView, schoolYearID, campusID, collegeID, year, standard, education,
  45. learningform, differentDynamicStatus, (int)pararms.page, (int)pararms.rows);
  46. return Json(result);
  47. }
  48. [HttpPost]
  49. public ActionResult Delete(string differentDynamicIDs)
  50. {
  51. var idList = differentDynamicIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  52. try
  53. {
  54. DifferentDynamicServices.DeleteDifferentDynamic(idList);
  55. return Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  56. }
  57. catch (Exception ex)
  58. {
  59. return Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message });
  60. }
  61. }
  62. [HttpPost]
  63. public ActionResult BatchAdd(string studentIDs)
  64. {
  65. var studentIDList = studentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  66. try
  67. {
  68. BatchQuitServices.BatchAddStudents(studentIDList);
  69. return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
  70. }
  71. catch (Exception ex)
  72. {
  73. return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
  74. }
  75. }
  76. /// <summary>
  77. /// 提交
  78. /// </summary>
  79. /// <param name="planApplicationIDs"></param>
  80. /// <returns></returns>
  81. [HttpPost]
  82. public ActionResult Submit(string differentDynamicIDs)
  83. {
  84. try
  85. {
  86. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  87. var idList = differentDynamicIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  88. DifferentDynamicServices.Submit(idList, user.UserID);
  89. return Json(new ReturnMessage { IsSuccess = true, Message = "提交成功。" });
  90. }
  91. catch (Exception ex)
  92. {
  93. return Json(new ReturnMessage { IsSuccess = false, Message = "提交失败:" + ex.Message });
  94. }
  95. }
  96. /// <summary>
  97. /// 审核
  98. /// </summary>
  99. /// <param name="planApplicationIDs"></param>
  100. /// <returns></returns>
  101. [HttpPost]
  102. public ActionResult Approve(string differentDynamicIDs)
  103. {
  104. try
  105. {
  106. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  107. var idList = differentDynamicIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  108. BatchQuitServices.Approve(idList);
  109. return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" });
  110. }
  111. catch (Exception ex)
  112. {
  113. return Json(new ReturnMessage { IsSuccess = false, Message = "审核失败:" + ex.Message });
  114. }
  115. }
  116. [HttpPost]
  117. public ActionResult Excel()
  118. {
  119. NpoiExcelHelper neh = new NpoiExcelHelper();
  120. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  121. var schoolYearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>(); //学年学期
  122. var campusID = Request.Form["cbgCampus"].ParseStrTo<Guid>(); //校区
  123. var collegeID = Request.Form["cbgCollege"].ParseStrTo<Guid>(); //院系所
  124. var education = Request.Form["ddlEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlEducation"].ParseStrTo<int>(); //培养层次
  125. var year = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>(); //年级
  126. var standard = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>(); //专业名称
  127. var learningform = Request.Form["ddlLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlLearningform"].ParseStrTo<int>(); //学习形式
  128. var differentDynamicStatus = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>(); //审批状态
  129. var result = BatchQuitServices.GetDifferentDynamicViewList(configuretView, schoolYearID, campusID, collegeID, year, standard, education,
  130. learningform, differentDynamicStatus);
  131. var dt = result.Select(s => new
  132. {
  133. s.LoginID,
  134. s.Name,
  135. s.SchoolyearCode,
  136. s.DifferentDynamicTypeName,
  137. s.ReasonName,
  138. s.ApprovalStatusName,
  139. s.Remark
  140. }).ToTable();
  141. string[] liststring = { "学号", "姓名", "学年学期", "异动类型", "异动原因", "状态", "备注" };
  142. neh.Export(dt, liststring, "批量退学申请");
  143. return RedirectToAction("MsgShow", "Common", new
  144. {
  145. msg = "导出成功!",
  146. url = Url.Action("List").AddMenuParameter()
  147. });
  148. }
  149. public ActionResult DifferentDynamicBatchQuitReport(string LoginID)
  150. {
  151. return View();
  152. }
  153. }
  154. }