CourseScheduleSettingController.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.CommonLogic.SchedulingManage.SchedulingSettings;
  8. using EMIS.CommonLogic.Cultureplan;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.Entities;
  11. using EMIS.ViewModel.CalendarManage;
  12. using EMIS.ViewModel.Cultureplan;
  13. namespace EMIS.Web.Controllers.SchedulingManage.SchedulingSettings
  14. {
  15. [Authorization]
  16. public class CourseScheduleSettingController : Controller
  17. {
  18. public ICourseScheduleSettingServices courseScheduleSettingServices { get; set; }
  19. public ICoursematerialServices coursematerialServices { get; set; }
  20. //
  21. // GET: /CourseScheduleSetting/
  22. public ActionResult List()
  23. {
  24. return View();
  25. }
  26. /// <summary>
  27. /// 课程可排时间设置列表
  28. /// </summary>
  29. /// <param name="pararms"></param>
  30. /// <returns></returns>
  31. [HttpPost]
  32. public ActionResult List(QueryParamsModel pararms)
  33. {
  34. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  35. var courseLevelID = pararms.getExtraInt("DictionaryCourseLevel") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseLevel");
  36. var courseScienceID = pararms.getExtraInt("DictionaryCourseScience") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseScience");
  37. return Json(courseScheduleSettingServices.GetCourseScheduleSettingViewGrid(coursematerialID, courseLevelID, courseScienceID, (int)pararms.page, (int)pararms.rows));
  38. }
  39. public ActionResult Edit(Guid? coursematerialID)
  40. {
  41. CoursematerialView coursematerial = coursematerialServices.GetCoursematerialView(coursematerialID);
  42. return View(coursematerial);
  43. }
  44. /// <summary>
  45. /// 保存
  46. /// </summary>
  47. /// <returns></returns>
  48. [HttpPost]
  49. public ActionResult Edit()
  50. {
  51. try
  52. {
  53. Guid? coursematerialID = new Guid(Request.Form["CoursematerialID"]);
  54. var arrangementsList = DataGrid.GetTableData<ArrangementView>("dgArrangementsList");
  55. courseScheduleSettingServices.CourseScheduleSettingAdd(arrangementsList, coursematerialID);
  56. return Json(new ReturnMessage()
  57. {
  58. IsSuccess = true,
  59. Message = "保存成功!"
  60. });
  61. }
  62. catch (Exception ex)
  63. {
  64. return Json(new ReturnMessage()
  65. {
  66. IsSuccess = true,
  67. Message = "保存失败,原因:" + ex.Message + "!"
  68. });
  69. }
  70. }
  71. /// <summary>
  72. /// 删除
  73. /// </summary>
  74. /// <param name="userIDs"></param>
  75. /// <returns></returns>
  76. [HttpPost]
  77. public ActionResult Delete(string coursematerialIDs)
  78. {
  79. try
  80. {
  81. List<Guid?> list = new List<Guid?>();
  82. for (int i = 0; i < coursematerialIDs.Split(',').Length; i++)
  83. {
  84. if (!string.IsNullOrEmpty(coursematerialIDs.Split(',')[i]))
  85. {
  86. Guid coursematerialID = new Guid(coursematerialIDs.Split(',')[i]);
  87. list.Add(coursematerialID);
  88. }
  89. }
  90. courseScheduleSettingServices.CourseScheduleSettingDelete(list);
  91. return Json("删除成功");
  92. }
  93. catch (Exception ex)
  94. {
  95. return Json("删除失败,原因:" + ex.Message);
  96. }
  97. }
  98. /// <summary>
  99. /// 查看是否设置的排课时间
  100. /// </summary>
  101. /// <param name="userID"></param>
  102. /// <returns></returns>
  103. [HttpPost]
  104. public ActionResult ArrangementsList(Guid? coursematerialID)
  105. {
  106. return Json(courseScheduleSettingServices.GetArrangementViewGrid(coursematerialID));
  107. }
  108. }
  109. }