using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using EMIS.ViewModel;
using EMIS.CommonLogic.RetakeManage;
using EMIS.ViewModel.RetakeManage;
namespace EMIS.Web.Controllers.RetakeManage
{
[Authorization]
public class RetakeConditionController : Controller
{
public IRetakeConditionServices RetakeConditionServices { get; set; }
///
/// 条件限定页面
///
///
public ActionResult Index()
{
RetakeConditionPageView model = new RetakeConditionPageView();
//查询重修条件信息View
var nopassConditionView = RetakeConditionServices.GetRetakeConditionView(ER_RetakeConditionType.NotPassCount);
//查询重修条件参数最小不及格门数
var minNoPassCount = RetakeConditionServices.GetParameter(ER_RetakeParameterType.MinNoPassCount);
//查询重修条件参数最大不及格门数
var maxNoPassCount = RetakeConditionServices.GetParameter(ER_RetakeParameterType.MaxNoPassCount);
if (nopassConditionView != null)
{
model.NoPassConditionTitle = nopassConditionView.Title;
}
else
{
model.NoPassConditionTitle = "不及格门数";
}
model.MinNoPassCount = minNoPassCount ?? 1;
model.MaxNoPassCount = maxNoPassCount ?? 100;
return View(model);
}
///
/// 保存
///
///
///
[HttpPost]
public ActionResult Index(RetakeConditionPageView conditionPageView)
{
try
{
RetakeConditionServices.SetParameter(ER_RetakeParameterType.MinNoPassCount, conditionPageView.MinNoPassCount);
RetakeConditionServices.SetParameter(ER_RetakeParameterType.MaxNoPassCount, conditionPageView.MaxNoPassCount);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "保存失败:" + ex.Message
});
}
}
}
}