ClassmajorScheduleSettingController.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.SchedulingManage.SchedulingSettings;
  7. using EMIS.ViewModel;
  8. using EMIS.CommonLogic.UniversityManage.SpecialtyClassManage;
  9. using EMIS.Entities;
  10. using EMIS.ViewModel.CalendarManage;
  11. using Bowin.Web.Controls.Mvc;
  12. namespace EMIS.Web.Controllers.SchedulingManage.SchedulingSettings
  13. {
  14. [Authorization]
  15. public class ClassmajorScheduleSettingController : Controller
  16. {
  17. public IClassmajorScheduleSettingServices classmajorScheduleSettingServices { get; set; }
  18. public IClassmajorServices classmajorServices { get; set; }
  19. //
  20. // GET: /ClassmajorScheduleSetting/
  21. public ActionResult List()
  22. {
  23. return View();
  24. }
  25. [HttpPost]
  26. public ActionResult List(QueryParamsModel pararms)
  27. {
  28. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  29. var StandardID = pararms.getExtraInt("DictionaryStandard");
  30. var gradeYearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  31. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  32. return Json(classmajorScheduleSettingServices.GetClassmajorScheduleSettingViewGrid(classmajorID, StandardID, collegeID, gradeYearID, (int)pararms.page, (int)pararms.rows));
  33. }
  34. public ActionResult Edit(Guid? classmajorID)
  35. {
  36. CF_Classmajor classmajor = classmajorServices.GetClassmajorInfo(classmajorID);
  37. return View(classmajor);
  38. }
  39. /// <summary>
  40. /// 保存
  41. /// </summary>
  42. /// <returns></returns>
  43. [HttpPost]
  44. public ActionResult Edit()
  45. {
  46. try
  47. {
  48. Guid? classmajorID = new Guid(Request.Form["ClassmajorID"]);
  49. var arrangementsList = DataGrid.GetTableData<ArrangementView>("dgArrangementsList");
  50. classmajorScheduleSettingServices.ClassmajorScheduleSettingAdd(arrangementsList, classmajorID);
  51. return Json(new ReturnMessage()
  52. {
  53. IsSuccess = true,
  54. Message = "保存成功!"
  55. });
  56. }
  57. catch (Exception ex)
  58. {
  59. return Json(new ReturnMessage()
  60. {
  61. IsSuccess = true,
  62. Message = "保存失败,原因:" + ex.Message + "!"
  63. });
  64. }
  65. }
  66. /// <summary>
  67. /// 删除
  68. /// </summary>
  69. /// <param name="userIDs"></param>
  70. /// <returns></returns>
  71. [HttpPost]
  72. public ActionResult Delete(string classmajorIDs)
  73. {
  74. try
  75. {
  76. List<Guid?> list = new List<Guid?>();
  77. for (int i = 0; i < classmajorIDs.Split(',').Length; i++)
  78. {
  79. if (!string.IsNullOrEmpty(classmajorIDs.Split(',')[i]))
  80. {
  81. Guid classmajorID = new Guid(classmajorIDs.Split(',')[i]);
  82. list.Add(classmajorID);
  83. }
  84. }
  85. classmajorScheduleSettingServices.ClassmajorScheduleSettingDelete(list);
  86. return Json("删除成功");
  87. }
  88. catch (Exception ex)
  89. {
  90. return Json("删除失败,原因:" + ex.Message);
  91. }
  92. }
  93. /// <summary>
  94. /// 查看是否设置的排课时间
  95. /// </summary>
  96. /// <param name="userID"></param>
  97. /// <returns></returns>
  98. [HttpPost]
  99. public ActionResult ArrangementsList(Guid? classmajorID)
  100. {
  101. return Json(classmajorScheduleSettingServices.GetArrangementViewGrid(classmajorID));
  102. }
  103. }
  104. }