using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.MinorManage.MinorSetting; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using EMIS.ViewModel.MinorManage.MinorSetting; namespace EMIS.Web.Controllers.MinorManage.MinorSetting { [Authorization] public class MinorControlController : Controller { // // GET: /MinorControl/ public IMinorControlServices minorControlServices { get; set; } /// /// 辅修控制列表查询 /// /// public ActionResult List() { return View(); } /// /// 重修控制列表查询 /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); Guid? schoolyearID = pararms.getExtraGuid("ddlSchoolYear"); Guid? collegeID = pararms.getExtraGuid("CollegeComboGrid"); int? gradeID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown"); return base.Json(minorControlServices.GetMinorControlViewList(configuretView, schoolyearID, gradeID, collegeID, (int)pararms.page, (int)pararms.rows)); } /// /// 复制新增 /// /// /// public ActionResult CopyAdd(Guid minorControlID) { MinorControlView minorControlView = new MinorControlView(); minorControlView = minorControlServices.GetMinorControlView(minorControlID); return View("Edit", minorControlView); } /// /// 复制新增 /// /// /// [HttpPost] public ActionResult CopyAdd(MinorControlView minorControlView) { minorControlView.MinorControlID = Guid.Empty; return this.Edit(minorControlView); } public ActionResult Edit(Guid? minorControlID) { MinorControlView minorControlView = new MinorControlView(); if (minorControlID.HasValue) { minorControlView = minorControlServices.GetMinorControlView(minorControlID); } return View(minorControlView); } /// /// 编辑(新增、修改) /// /// /// [HttpPost] public ActionResult Edit(MinorControlView minorControlView) { try { minorControlServices.MinorControlEdit(minorControlView); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败,原因:" + ex.Message }); } } /// /// 删除 /// /// /// [HttpPost] public ActionResult Delete(string minorControlIDs) { try { List list = minorControlIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)) .Select(x => (Guid?)new Guid(x)).ToList(); minorControlServices.MinorControlDelete(list); return base.Json("删除成功。"); } catch (Exception ex) { return base.Json("删除失败,原因:" + ex.Message); } } } }