EducationMissionClassScheduleController.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. using Bowin.Common.Utility;
  2. using Bowin.Web.Controls.Mvc;
  3. using EMIS.CommonLogic.EducationManagement;
  4. using EMIS.CommonLogic.EducationSchedule;
  5. using EMIS.ViewModel;
  6. using EMIS.Web.Controls;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Web;
  11. using System.Web.Mvc;
  12. using Bowin.Common.Data;
  13. using EMIS.CommonLogic.CalendarManage;
  14. namespace EMIS.Web.Controllers.EducationSchedule
  15. {
  16. [Authorization]
  17. public class EducationMissionClassScheduleController : Controller
  18. {
  19. public ISchoolYearServices SchoolYearServices { get; set; }
  20. //任务班排课
  21. #region 0.0--定义--
  22. public IEducationMissionClassScheduleServices educationMissionClassScheduleServices { get; set; }
  23. #endregion
  24. #region 1.0 任务班排课列表数据加载
  25. public ActionResult List()
  26. {
  27. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  28. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  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("SchoolyearDropdownList");
  41. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  42. var campusID = pararms.getExtraGuid("ComboGridCampus");
  43. var collegeID = pararms.getExtraGuid("ComboGridCollege");
  44. var StandardID = pararms.getExtraInt("DictionaryStandard");
  45. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  46. var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
  47. var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  48. var approvalStatus = pararms.getExtraInt("ApprovalStatusDropdownList") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ApprovalStatusDropdownList");
  49. var teachingMode = pararms.getExtraInt("DictionaryTeachingMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMode");
  50. var result = educationMissionClassScheduleServices.GetEducationMissionClassScheduleViewGrid(configuretView, campusID, collegeID, schoolyearID, departmentID, coursematerialID, approvalStatus, teachingMode, grademajorID, gradeYearID, StandardID, (int)pararms.page, (int)pararms.rows);
  51. return Json(result);
  52. }
  53. #endregion
  54. #region 2.0 Excel导出
  55. /// <summary>
  56. /// 导出Excel
  57. /// </summary>
  58. /// <param name="pararms"></param>
  59. /// <returns></returns>
  60. [HttpPost]
  61. public ActionResult Excel()
  62. {
  63. NpoiExcelHelper neh = new NpoiExcelHelper();
  64. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  65. var campusID = Request.Form["ComboGridCampus"].ParseStrTo<Guid>();
  66. var collegeID = Request.Form["ComboGridCollege"].ParseStrTo<Guid>();
  67. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
  68. var grademajorID = Request.Form["GrademajorComboGrid"].ParseStrTo<Guid>();
  69. var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  70. var schoolyearID = Request.Form["SchoolyearDropdownList"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDropdownList"].ParseStrTo<Guid>();
  71. var approvalStatus = Request.Form["ApprovalStatusDropdownList"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ApprovalStatusDropdownList"].ParseStrTo<int>();
  72. var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo<int>();
  73. var dt = educationMissionClassScheduleServices.GetEducationMissionClassScheduleViewList(configuretView, campusID, collegeID, schoolyearID, null, coursematerialID,
  74. approvalStatus, teachingModeID, grademajorID, gradeYearID).Select(x => new
  75. {
  76. x.OrderNo,
  77. x.Name,
  78. // x.SchoolyearCode,
  79. x.CourseCode,
  80. x.CourseName,
  81. x.DepartmentName,
  82. // x.CollegeName,
  83. x.ClassroomTypeName,
  84. x.StartStopWeeklyNum,
  85. x.Totalhours,
  86. x.CourseProcessTimes,
  87. x.ScheduledTimes,
  88. //x.SchedulingClassNum,
  89. x.ClassNum,
  90. x.TeacherName,
  91. x.ApprovalStatusName
  92. }).ToTable();
  93. string[] liststring = { "排课序号", "任务班名称","课程代码", "课程名称", "教研室", "教室类型",
  94. "执行周次", "总学时", "执行学时","已排学时", "班级人数","授课老师", "状态" };
  95. neh.Export(dt, liststring, "教学任务班基础信息");
  96. return Json(new ReturnMessage()
  97. {
  98. IsSuccess = true,
  99. Message = "导出成功!"
  100. });
  101. }
  102. #endregion
  103. #region 3.0 删除排课信息
  104. [HttpPost]
  105. public ActionResult Delete(string educationMissionClassIDs)
  106. {
  107. try
  108. {
  109. List<Guid?> list = new List<Guid?>();
  110. var educationMissionClassArray = educationMissionClassIDs.Split(',');
  111. for (int i = 0; i < educationMissionClassArray.Length; i++)
  112. {
  113. if (!string.IsNullOrEmpty(educationMissionClassArray[i]))
  114. {
  115. Guid? educationMissionClassID = new Guid(educationMissionClassArray[i]);
  116. list.Add(educationMissionClassID);
  117. }
  118. }
  119. educationMissionClassScheduleServices.Delete(list);
  120. return Json(new ReturnMessage { IsSuccess = true, Message = "撤销成功 " });
  121. }
  122. catch (Exception ex)
  123. {
  124. return Json(new ReturnMessage { IsSuccess = false, Message = "撤销失败:" + ex.Message });
  125. }
  126. }
  127. #endregion
  128. }
  129. }