CheckingControlController.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.Web.Controls;
  10. using EMIS.ViewModel;
  11. using EMIS.ViewModel.StudentManage.OnlineChecking;
  12. using EMIS.CommonLogic.StudentManage.OnlineChecking;
  13. namespace EMIS.Web.Controllers.StudentManage.OnlineChecking
  14. {
  15. [Authorization]
  16. public class CheckingControlController : Controller
  17. {
  18. public Lazy<ICheckingControlServices> CheckingControlServices { 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 checkingTypeID = pararms.getExtraInt("DictionaryCheckingType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCheckingType");
  37. return base.Json(CheckingControlServices.Value.GetStudentEditControlViewGrid(configuretView, checkingTypeID, (int)pararms.page, (int)pararms.rows));
  38. }
  39. /// <summary>
  40. /// 学生校对控制设置
  41. /// </summary>
  42. /// <returns></returns>
  43. [HttpPost]
  44. public ActionResult StudentEditControlSet()
  45. {
  46. try
  47. {
  48. var checkingControlViewList = DataGrid.GetTableData<CheckingControlView>("dgStudentEditControlList");
  49. CheckingControlServices.Value.StudentEditControlSet(checkingControlViewList.Select(x => x.ColumnName).ToList(), checkingControlViewList.Select(x => x.CheckingTypeID).ToList());
  50. return Json(new ReturnMessage()
  51. {
  52. IsSuccess = true,
  53. Message = "设置成功。"
  54. });
  55. }
  56. catch (Exception ex)
  57. {
  58. return Json(new ReturnMessage()
  59. {
  60. IsSuccess = false,
  61. Message = "设置失败,原因:" + ex.Message
  62. });
  63. }
  64. }
  65. /// <summary>
  66. /// Excel导出
  67. /// </summary>
  68. /// <returns></returns>
  69. [HttpPost]
  70. public ActionResult Excel()
  71. {
  72. NpoiExcelHelper neh = new NpoiExcelHelper();
  73. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  74. var checkingTypeID = Request.Form["DictionaryCheckingType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCheckingType"].ParseStrTo<int>();
  75. var dt = CheckingControlServices.Value.GetStudentEditControlViewList(configuretView, checkingTypeID)
  76. .Select(x => new
  77. {
  78. x.OrderNo,
  79. x.ColumnName,
  80. x.DisplayColumnName,
  81. x.Description,
  82. x.CheckingTypeName,
  83. x.CreateUserName,
  84. x.ModifyUserName,
  85. x.ModifyTime
  86. }).ToTable();
  87. string[] liststring = {
  88. "序号", "校对代码", "校对列名", "校对名称", "校对类型", "创建人", "修改人", "修改时间"
  89. };
  90. neh.Export(dt, liststring, "校对控制信息" + DateTime.Now.ToString("yyyyMMdd"));
  91. return Json(new ReturnMessage()
  92. {
  93. IsSuccess = true,
  94. Message = "导出成功。"
  95. });
  96. }
  97. }
  98. }