StudentBatchRepeatController.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 StudentBatchRepeatController : Controller
  16. {
  17. public IDifferentDynamicServices DifferentDynamicServices { get; set; }
  18. public IBatchRepeatServices BatchRepeatServices { 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 = BatchRepeatServices.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. BatchRepeatServices.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 Process(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. BatchRepeatServices.Process(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. /// <summary>
  117. /// 审核
  118. /// </summary>
  119. /// <param name="planApplicationIDs"></param>
  120. /// <returns></returns>
  121. [HttpPost]
  122. public ActionResult Approve(string differentDynamicIDs)
  123. {
  124. try
  125. {
  126. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  127. var idList = differentDynamicIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  128. BatchRepeatServices.Approve(idList);
  129. return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" });
  130. }
  131. catch (Exception ex)
  132. {
  133. return Json(new ReturnMessage { IsSuccess = false, Message = "审核失败:" + ex.Message });
  134. }
  135. }
  136. [HttpPost]
  137. public ActionResult Excel()
  138. {
  139. NpoiExcelHelper neh = new NpoiExcelHelper();
  140. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  141. var schoolYearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>(); //学年学期
  142. var campusID = Request.Form["cbgCampus"].ParseStrTo<Guid>(); //校区
  143. var collegeID = Request.Form["cbgCollege"].ParseStrTo<Guid>(); //院系所
  144. var education = Request.Form["ddlEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlEducation"].ParseStrTo<int>(); //培养层次
  145. var year = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>(); //年级
  146. var standard = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>(); //专业名称
  147. var learningform = Request.Form["ddlLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlLearningform"].ParseStrTo<int>(); //学习形式
  148. var differentDynamicStatus = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>(); //审批状态
  149. var result = BatchRepeatServices.GetDifferentDynamicViewList(configuretView, schoolYearID, campusID, collegeID, year, standard, education,
  150. learningform, differentDynamicStatus);
  151. var dt = result.Select(s => new
  152. {
  153. s.LoginID,
  154. s.Name,
  155. s.SchoolyearCode,
  156. s.DifferentDynamicTypeName,
  157. s.ReasonName,
  158. s.ClassmajorName,
  159. s.AfterClassmajorName,
  160. s.ApprovalStatusName,
  161. s.Remark
  162. }).ToTable();
  163. string[] liststring = { "学号", "姓名", "学年学期", "异动类型", "异动原因", "异动前班级", "异动后班级", "状态", "备注" };
  164. neh.Export(dt, liststring, "批量留级申请");
  165. return RedirectToAction("MsgShow", "Common", new
  166. {
  167. msg = "导出成功!",
  168. url = Url.Action("List").AddMenuParameter()
  169. });
  170. }
  171. }
  172. }