TeacherScheduleSettingController.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.TeacherManage;
  12. namespace EMIS.Web.Controllers.SchedulingManage.SchedulingSettings
  13. {
  14. [Authorization]
  15. public class TeacherScheduleSettingController : Controller
  16. {
  17. public ITeacherScheduleSettingServices teacherScheduleSettingServices { get; set; }
  18. public IStaffServices staffServices { get; set; }
  19. //
  20. // GET: /TeacherScheduleSetting/
  21. public ActionResult List()
  22. {
  23. return View();
  24. }
  25. /// <summary>
  26. /// 教师可排时间设置列表
  27. /// </summary>
  28. /// <param name="pararms"></param>
  29. /// <returns></returns>
  30. [HttpPost]
  31. public ActionResult List(QueryParamsModel pararms)
  32. {
  33. var userID = pararms.getExtraGuid("StaffComboGrid");
  34. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  35. var teacherTypeID = pararms.getExtraInt("DictionaryTeacherType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeacherType");
  36. var incumbencyStateID = pararms.getExtraInt("DictionaryIncumbencyState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIncumbencyState");
  37. var titleID = pararms.getExtraInt("DictionaryTitle") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTitle");
  38. return Json(teacherScheduleSettingServices.GetTeacherScheduleSettingViewGrid(userID, teacherTypeID, incumbencyStateID, titleID, collegeID, (int)pararms.page, (int)pararms.rows));
  39. }
  40. public ActionResult Edit(Guid? userID)
  41. {
  42. CF_Staff staff = staffServices.GetStaff(userID);
  43. return View(staff);
  44. }
  45. /// <summary>
  46. /// 保存
  47. /// </summary>
  48. /// <returns></returns>
  49. [HttpPost]
  50. public ActionResult Edit()
  51. {
  52. try
  53. {
  54. Guid? userID = new Guid(Request.Form["UserID"]);
  55. var arrangementsList = DataGrid.GetTableData<ArrangementView>("dgArrangementsList");
  56. teacherScheduleSettingServices.TeacherScheduleSettingAdd(arrangementsList, userID);
  57. return Json(new ReturnMessage()
  58. {
  59. IsSuccess = true,
  60. Message = "保存成功!"
  61. });
  62. }
  63. catch (Exception ex)
  64. {
  65. return Json(new ReturnMessage()
  66. {
  67. IsSuccess = true,
  68. Message = "保存失败,原因:" + ex.Message + "!"
  69. });
  70. }
  71. }
  72. /// <summary>
  73. /// 删除
  74. /// </summary>
  75. /// <param name="userIDs"></param>
  76. /// <returns></returns>
  77. [HttpPost]
  78. public ActionResult Delete(string userIDs)
  79. {
  80. try
  81. {
  82. List<Guid?> list = new List<Guid?>();
  83. for (int i = 0; i < userIDs.Split(',').Length; i++)
  84. {
  85. if (!string.IsNullOrEmpty(userIDs.Split(',')[i]))
  86. {
  87. Guid userID = new Guid(userIDs.Split(',')[i]);
  88. list.Add(userID);
  89. }
  90. }
  91. teacherScheduleSettingServices.TeacherScheduleSettingDelete(list);
  92. return Json("删除成功");
  93. }
  94. catch (Exception ex)
  95. {
  96. return Json("删除失败,原因:" + ex.Message);
  97. }
  98. }
  99. /// <summary>
  100. /// 查看是否设置的排课时间
  101. /// </summary>
  102. /// <param name="userID"></param>
  103. /// <returns></returns>
  104. [HttpPost]
  105. public ActionResult ArrangementsList(Guid? userID)
  106. {
  107. return Json(teacherScheduleSettingServices.GetArrangementViewGrid(userID));
  108. }
  109. }
  110. }