FreeSelectionCourseApproveController.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.Web.Controls;
  8. using Bowin.Web.Controls.Mvc;
  9. using EMIS.CommonLogic.SelectCourse;
  10. using EMIS.ViewModel.SelectCourse;
  11. using Bowin.Common.Utility;
  12. using Bowin.Common.Data;
  13. namespace EMIS.Web.Controllers.SelectCourseManage
  14. {
  15. [Authorization]
  16. public class FreeSelectionCourseApproveController : Controller
  17. {
  18. public IFreeSelectionCourseServices FreeSelectionCourseServices { get; set; }
  19. public IFreeSelectionCourseApplyServices FreeSelectionCourseApplyServices { get; set; }
  20. /// <summary>
  21. /// 开课审核页面
  22. /// </summary>
  23. /// <returns></returns>
  24. public ActionResult List()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 查询列表
  30. /// </summary>
  31. /// <param name="pararms"></param>
  32. /// <returns></returns>
  33. [HttpPost]
  34. public ActionResult List(QueryParamsModel pararms)
  35. {
  36. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  37. var campusID = pararms.getExtraGuid("CampusDropdown");
  38. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  39. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  40. var schoolyear = pararms.getExtraGuid("SchoolyearDropdown").ToString() == DropdownList.SELECT_ALL.ToString() ? null : pararms.getExtraGuid("SchoolyearDropdown");
  41. var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
  42. return this.Json(FreeSelectionCourseApplyServices.GetFreeSelectionCoursePlanApprovalViewGrid(configuretView,
  43. schoolyear, campusID, collegeID, departmentID, approvalStatus, (int)pararms.page, (int)pararms.rows));
  44. }
  45. /// <summary>
  46. /// 明细
  47. /// </summary>
  48. /// <param name="freeSelectionCourseApplyID"></param>
  49. /// <returns></returns>
  50. public ActionResult Details(Guid? freeSelectionCourseApplyID)
  51. {
  52. FreeSelectionCourseApplyView freeSelectCourseApplyView = new FreeSelectionCourseApplyView();
  53. if (freeSelectionCourseApplyID.HasValue)
  54. freeSelectCourseApplyView = FreeSelectionCourseApplyServices.GetFreeSelectionCourseApplyView(freeSelectionCourseApplyID);
  55. return View(freeSelectCourseApplyView);
  56. }
  57. /// <summary>
  58. /// 审核
  59. /// </summary>
  60. /// <param name="formIDs"></param>
  61. /// <param name="actionID"></param>
  62. /// <param name="comment"></param>
  63. /// <returns></returns>
  64. [HttpPost]
  65. public ActionResult Approve(string formIDs, Guid actionID, string comment)
  66. {
  67. try
  68. {
  69. var formIDList = formIDs.Split(',').Select(x => new Guid(x)).ToList();
  70. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  71. FreeSelectionCourseApplyServices.Approve(formIDList, user.UserID, actionID, comment);
  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. /// 导出Excel
  89. /// </summary>
  90. /// <returns></returns>
  91. [HttpPost]
  92. public ActionResult Excel()
  93. {
  94. NpoiExcelHelper neh = new NpoiExcelHelper();
  95. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  96. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  97. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  98. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  99. var schoolyear = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  100. var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>();
  101. var dt = FreeSelectionCourseApplyServices.GetFreeSelectionCoursePlanViewList(configuretView, schoolyear, campusID, collegeID, departmentID, approvalStatus).Select(x => new
  102. {
  103. x.SchoolyearCode,
  104. x.DepartmentName,
  105. x.DefaultClassName,
  106. x.CourseName,
  107. x.TeacherNames,
  108. x.PeopleNumlimit,
  109. x.PeopleNumlower,
  110. x.HandleModeName,
  111. x.IsNeedMaterialName,
  112. x.ApprovalStatusName
  113. }).ToTable();
  114. string[] liststring = { "学年学期", "教研室", "选修任务班名称",
  115. "课程名称",
  116. "授课教师", "人数下限", "人数上限", "选修类型","是否需要教材","审批状态"};
  117. neh.Export(dt, liststring, "开课审核信息");
  118. return RedirectToAction("MsgShow", "Common", new
  119. {
  120. msg = "导出成功!",
  121. url = Url.Content("~/FreeSelectionCourseApprove/List").AddMenuParameter()
  122. });
  123. }
  124. public ActionResult GetFreeSelectionCourseView(Guid? freeSelectionCourseID)
  125. {
  126. FreeSelectionCourseView freeSelectionCourseView = new FreeSelectionCourseView();
  127. if (freeSelectionCourseID.HasValue)
  128. freeSelectionCourseView = FreeSelectionCourseServices.GetFreeSelectionCourseView(freeSelectionCourseID);
  129. return base.Json(freeSelectionCourseView);
  130. }
  131. }
  132. }