TeacherEvaluationController.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.Web.Controls;
  7. using EMIS.ViewModel;
  8. using EMIS.ViewModel.EvaluationManage;
  9. using Bowin.Common.Exceptions;
  10. using Bowin.Web.Controls.Mvc;
  11. using EMIS.CommonLogic.EvaluationManage;
  12. namespace EMIS.Web.Controllers.EvaluationManage
  13. {
  14. /// <summary>
  15. /// 教师评价
  16. /// </summary>
  17. [Authorization]
  18. public class TeacherEvaluationController : Controller
  19. {
  20. public ITeacherEvaluationServices TeacherEvaluationServices { get; set; }
  21. public IEvaluationTypeServices EvaluationTypeServices { get; set; }
  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 configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  35. var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期
  36. var campusID = pararms.getExtraGuid("CampusDropdown"); //校区
  37. var collegeID = pararms.getExtraGuid("CollegeDropdown"); //院系所
  38. var openStatus = CheckIsSelectAll(pararms.getExtraInt("DictionaryOpenStatus")); //开放状态
  39. var result = TeacherEvaluationServices.GetTeacherEvaluationViewGrid(configuretView, schoolYearID, campusID, collegeID, openStatus, (int)pararms.page, (int)pararms.rows);
  40. return Json(result);
  41. }
  42. public ActionResult Edit(Guid? id)
  43. {
  44. var vm = new TeacherEvaluationView();
  45. if (id != null && id != Guid.Empty)
  46. vm = TeacherEvaluationServices.GetTeacherEvaluationView(id);
  47. var evaluationType = EvaluationTypeServices.GetEvaluationType("学生评");
  48. //var isView = (vm.EntityApprovalStatus.HasValue && vm.EntityApprovalStatus != (int)CF_DifferentDynamicStatus.NotSubmitted) ? true : false;
  49. //ViewBag.IsView = isView;
  50. ViewBag.EvaluationTypeId = evaluationType.EvaluationTypeID;
  51. return View(vm);
  52. }
  53. /// <summary>
  54. /// 新增或更新
  55. /// </summary>
  56. /// <param name="vm"></param>
  57. /// <returns></returns>
  58. [HttpPost]
  59. public ActionResult Edit(TeacherEvaluationView vm)
  60. {
  61. try
  62. {
  63. TeacherEvaluationServices.AddOrUpdateTeacherEvaluation(vm);
  64. return RedirectToAction("MsgShow", "Common", new
  65. {
  66. msg = "保存成功!",
  67. url = Url.Action("List").AddMenuParameter()
  68. });
  69. }
  70. catch (Exception ex)
  71. {
  72. return RedirectToAction("MsgShow", "Common", new
  73. {
  74. msg = "保存失败!" + ex.Message,
  75. url = Url.Action("List").AddMenuParameter()
  76. });
  77. }
  78. }
  79. /// <summary>
  80. /// 删除
  81. /// </summary>
  82. /// <param name="ids"></param>
  83. /// <returns></returns>
  84. [HttpPost]
  85. public ActionResult Delete(string ids)
  86. {
  87. try
  88. {
  89. var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList();
  90. TeacherEvaluationServices.DeleteTeacherEvaluation(list);
  91. return base.Json("删除成功");
  92. }
  93. catch (Exception ex)
  94. {
  95. string mge = ex.Message;
  96. System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
  97. if (num != null)
  98. {
  99. if (num.Number == 547)
  100. //mge = "请先删除所有关联的数据,如:专业计划、选修计划等!";
  101. mge = "请先删除所有关联的数据!";
  102. }
  103. return base.Json("删除失败,原因:" + mge);
  104. }
  105. }
  106. /// <summary>
  107. /// 添加更新前验证
  108. /// </summary>
  109. /// <param name="activitiesID"></param>
  110. /// <param name="Name"></param>
  111. /// <returns></returns>
  112. [HttpPost]
  113. public ActionResult Verification(Guid? id, Guid? educationMissionClassID, Guid? tableID)
  114. {
  115. if (id.HasValue && id != Guid.Empty) //编辑状态
  116. {
  117. }
  118. else //新增状态
  119. {
  120. }
  121. return Json("成功");
  122. }
  123. protected static int? CheckIsSelectAll(int? argment)
  124. {
  125. return argment == DropdownList.SELECT_ALL ? null : argment;
  126. }
  127. }
  128. }