RetakeConditionController.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.RetakeManage;
  8. using EMIS.ViewModel.RetakeManage;
  9. namespace EMIS.Web.Controllers.RetakeManage
  10. {
  11. [Authorization]
  12. public class RetakeConditionController : Controller
  13. {
  14. public IRetakeConditionServices RetakeConditionServices { get; set; }
  15. /// <summary>
  16. /// 条件限定页面
  17. /// </summary>
  18. /// <returns></returns>
  19. public ActionResult Index()
  20. {
  21. RetakeConditionPageView model = new RetakeConditionPageView();
  22. //查询重修条件信息View
  23. var nopassConditionView = RetakeConditionServices.GetRetakeConditionView(ER_RetakeConditionType.NotPassCount);
  24. //查询重修条件参数最小不及格门数
  25. var minNoPassCount = RetakeConditionServices.GetParameter<int>(ER_RetakeParameterType.MinNoPassCount);
  26. //查询重修条件参数最大不及格门数
  27. var maxNoPassCount = RetakeConditionServices.GetParameter<int>(ER_RetakeParameterType.MaxNoPassCount);
  28. if (nopassConditionView != null)
  29. {
  30. model.NoPassConditionTitle = nopassConditionView.Title;
  31. }
  32. else
  33. {
  34. model.NoPassConditionTitle = "不及格门数";
  35. }
  36. model.MinNoPassCount = minNoPassCount ?? 1;
  37. model.MaxNoPassCount = maxNoPassCount ?? 100;
  38. return View(model);
  39. }
  40. /// <summary>
  41. /// 保存
  42. /// </summary>
  43. /// <param name="conditionPageView"></param>
  44. /// <returns></returns>
  45. [HttpPost]
  46. public ActionResult Index(RetakeConditionPageView conditionPageView)
  47. {
  48. try
  49. {
  50. RetakeConditionServices.SetParameter(ER_RetakeParameterType.MinNoPassCount, conditionPageView.MinNoPassCount);
  51. RetakeConditionServices.SetParameter(ER_RetakeParameterType.MaxNoPassCount, conditionPageView.MaxNoPassCount);
  52. return Json(new ReturnMessage()
  53. {
  54. IsSuccess = true,
  55. Message = "保存成功。"
  56. });
  57. }
  58. catch (Exception ex)
  59. {
  60. return Json(new ReturnMessage()
  61. {
  62. IsSuccess = false,
  63. Message = "保存失败:" + ex.Message
  64. });
  65. }
  66. }
  67. }
  68. }