ClassroomScheduleSettingController.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 EMIS.Entities;
  8. using EMIS.ViewModel;
  9. using EMIS.ViewModel.CalendarManage;
  10. using EMIS.CommonLogic.SchedulingManage.SchedulingSettings;
  11. using EMIS.CommonLogic.UniversityManage.ClassroomManage;
  12. namespace EMIS.Web.Controllers.SchedulingManage.SchedulingSettings
  13. {
  14. [Authorization]
  15. public class ClassroomScheduleSettingController : Controller
  16. {
  17. public IClassroomScheduleSettingServices classroomScheduleSettingServices { get; set; }
  18. public IClassroomServices classroomServices { 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. var classroomID = pararms.getExtraGuid("ClassroomComboGrid");
  36. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  37. var classroomTypeID = pararms.getExtraInt("DictionaryClassroomType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryClassroomType");
  38. return Json(classroomScheduleSettingServices.GetClassroomScheduleSettingViewGrid(classroomID, collegeID, classroomTypeID, (int)pararms.page, (int)pararms.rows));
  39. }
  40. /// <summary>
  41. /// 设置
  42. /// </summary>
  43. /// <param name="classroomID"></param>
  44. /// <returns></returns>
  45. public ActionResult Edit(Guid? classroomID)
  46. {
  47. CF_Classroom classroom = classroomServices.GetClassroomInfo(classroomID);
  48. return View(classroom);
  49. }
  50. /// <summary>
  51. /// 保存
  52. /// </summary>
  53. /// <returns></returns>
  54. [HttpPost]
  55. public ActionResult Edit()
  56. {
  57. try
  58. {
  59. Guid? classroomID = new Guid(Request.Form["ClassroomID"]);
  60. var arrangementsList = DataGrid.GetTableData<ArrangementView>("dgArrangementsList");
  61. classroomScheduleSettingServices.ClassroomScheduleSettingAdd(arrangementsList, classroomID);
  62. return Json(new ReturnMessage()
  63. {
  64. IsSuccess = true,
  65. Message = "保存成功!"
  66. });
  67. }
  68. catch (Exception ex)
  69. {
  70. return Json(new ReturnMessage()
  71. {
  72. IsSuccess = true,
  73. Message = "保存失败,原因:" + ex.Message + "!"
  74. });
  75. }
  76. }
  77. /// <summary>
  78. /// 删除
  79. /// </summary>
  80. /// <param name="userIDs"></param>
  81. /// <returns></returns>
  82. [HttpPost]
  83. public ActionResult Delete(string classroomIDs)
  84. {
  85. try
  86. {
  87. List<Guid?> list = new List<Guid?>();
  88. for (int i = 0; i < classroomIDs.Split(',').Length; i++)
  89. {
  90. if (!string.IsNullOrEmpty(classroomIDs.Split(',')[i]))
  91. {
  92. Guid classroomID = new Guid(classroomIDs.Split(',')[i]);
  93. list.Add(classroomID);
  94. }
  95. }
  96. classroomScheduleSettingServices.ClassroomScheduleSettingDelete(list);
  97. return Json("删除成功");
  98. }
  99. catch (Exception ex)
  100. {
  101. return Json("删除失败,原因:" + ex.Message);
  102. }
  103. }
  104. /// <summary>
  105. /// 查看是否设置的排课时间
  106. /// </summary>
  107. /// <param name="userID"></param>
  108. /// <returns></returns>
  109. [HttpPost]
  110. public ActionResult ArrangementsList(Guid? classroomID)
  111. {
  112. return Json(classroomScheduleSettingServices.GetArrangementViewGrid(classroomID));
  113. }
  114. }
  115. }