StudentBatchSuspendController.cs 7.6 KB

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