CheckingResultController.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using System.IO;
  7. using System.Text;
  8. using System.Data;
  9. using Bowin.Web.Controls.Mvc;
  10. using Bowin.Common.Data;
  11. using Bowin.Common.Utility;
  12. using Bowin.Common.Exceptions;
  13. using EMIS.Utility;
  14. using EMIS.Web.Controls;
  15. using EMIS.ViewModel;
  16. using EMIS.ViewModel.StudentManage.OnlineChecking;
  17. using EMIS.CommonLogic.StudentWeb.InfoCenter;
  18. namespace EMIS.Web.Controllers.StudentWeb.InfoCenter
  19. {
  20. [Authorization]
  21. public class CheckingResultController : Controller
  22. {
  23. public Lazy<ICheckingResultServices> CheckingResultServices { 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 user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  42. var checkingTypeID = pararms.getExtraInt("DictionaryCheckingType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCheckingType");
  43. var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
  44. return base.Json(CheckingResultServices.Value.GetStudentCheckingResultViewGrid(configuretView, user.UserID, checkingTypeID, approvalStatus, (int)pararms.page, (int)pararms.rows));
  45. }
  46. /// <summary>
  47. /// 编辑
  48. /// </summary>
  49. /// <param name="studentRecordChangeHistoryID"></param>
  50. /// <returns></returns>
  51. [HttpGet]
  52. public ActionResult Edit(Guid? studentRecordChangeHistoryID)
  53. {
  54. CheckingHistoryView checkingHistoryView = new CheckingHistoryView();
  55. if (studentRecordChangeHistoryID.HasValue && studentRecordChangeHistoryID != Guid.Empty)
  56. {
  57. checkingHistoryView = CheckingResultServices.Value.GetStudentCheckingResultView(studentRecordChangeHistoryID);
  58. }
  59. return View(checkingHistoryView);
  60. }
  61. /// <summary>
  62. /// 编辑
  63. /// </summary>
  64. /// <param name="checkingHistoryView"></param>
  65. /// <returns></returns>
  66. [HttpPost]
  67. public ActionResult Edit(CheckingHistoryView checkingHistoryView)
  68. {
  69. try
  70. {
  71. //CheckingResultServices.Value.CheckingResultEdit(checkingHistoryView);
  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. /// 撤消
  89. /// </summary>
  90. /// <param name="studentRecordChangeHistoryIDs"></param>
  91. /// <returns></returns>
  92. [HttpPost]
  93. public ActionResult Cancel(string studentRecordChangeHistoryIDs)
  94. {
  95. try
  96. {
  97. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  98. List<Guid?> list = studentRecordChangeHistoryIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  99. CheckingResultServices.Value.StudentCheckingResultCancel(list, user.UserID);
  100. return base.Json(new ReturnMessage { IsSuccess = true, Message = "撤消成功。" });
  101. }
  102. catch (Exception ex)
  103. {
  104. return base.Json(new ReturnMessage { IsSuccess = false, Message = "撤消失败,原因:" + ex.Message });
  105. }
  106. }
  107. /// <summary>
  108. /// Excel导出
  109. /// </summary>
  110. /// <returns></returns>
  111. [HttpPost]
  112. public ActionResult Excel()
  113. {
  114. NpoiExcelHelper neh = new NpoiExcelHelper();
  115. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  116. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  117. var checkingTypeID = Request.Form["DictionaryCheckingType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCheckingType"].ParseStrTo<int>();
  118. var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>();
  119. var dt = CheckingResultServices.Value.GetStudentCheckingResultViewList(configuretView, user.UserID, checkingTypeID, approvalStatus)
  120. .Select(x => new
  121. {
  122. x.StudentNo,
  123. x.Name,
  124. x.SexName,
  125. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""),
  126. x.NationName,
  127. x.PoliticsName,
  128. x.ClassmajorName,
  129. x.Description,
  130. x.CheckingTypeName,
  131. x.CheckingBeforeContent,
  132. x.CheckingAfterContent,
  133. x.IP,
  134. x.ApprovalStatusName,
  135. x.Comment,
  136. ApprovalTime = (x.ApprovalTime.HasValue ? x.ApprovalTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
  137. }).ToTable();
  138. string[] liststring = {
  139. "学号", "姓名", "性别", "出生日期", "民族", "政治面貌", "班级名称", "校对名称",
  140. "校对类型", "校对前内容", "校对后内容", "IP地址", "状态", "处理意见", "审核时间"
  141. };
  142. neh.Export(dt, liststring, "校对结果信息" + DateTime.Now.ToString("yyyyMMdd"));
  143. return Json(new ReturnMessage()
  144. {
  145. IsSuccess = true,
  146. Message = "导出成功。"
  147. });
  148. }
  149. }
  150. }