using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.MinorGraduation.MinorGraduationSetting; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using EMIS.ViewModel.MinorGraduation.MinorGraduationSetting; using Bowin.Common.Utility; using Bowin.Common.Data; namespace EMIS.Web.Controllers.MinorGraduation.MinorGraduationSetting { public class MinorGraduationConditionController : Controller { // // GET: /MinorGraduationCondition/ public IMinorGraduationConditionServices minorGraduationConditionServices { get; set; } public ActionResult List() { return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var isCurrent = pararms.getExtraInt("IsCurrentDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsCurrentDropDown"); return base.Json(minorGraduationConditionServices.GetMinorGraduationConditionViewGrid(configuretView, isCurrent, (int)pararms.page, (int)pararms.rows)); } /// /// 编辑 /// /// /// [HttpGet] public ActionResult Edit(Guid? minorGraduationConditionID) { MinorGraduationConditionView minorGraduationConditionView = new MinorGraduationConditionView(); if (minorGraduationConditionID.HasValue && minorGraduationConditionID != Guid.Empty) { minorGraduationConditionView = minorGraduationConditionServices.GetMinorGraduationConditionView(minorGraduationConditionID); } else { minorGraduationConditionView.IsEnable = true; } return View(minorGraduationConditionView); } /// /// 编辑 /// /// /// [HttpPost] public ActionResult Edit(MinorGraduationConditionView minorGraduationConditionView) { try { minorGraduationConditionServices.MinorGraduationConditionEdit(minorGraduationConditionView); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败,原因:" + ex.Message + "。" }); } } [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); int? isCurrent = Request["IsCurrentDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["IsCurrentDropDown"].ParseStrTo(); var minorGraduationConditionIDString = Request.Form["SelectedID"]; var minorGraduationConditionIDList = minorGraduationConditionIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); var dt = minorGraduationConditionServices.GetGraduationViewList(configuretView, isCurrent, minorGraduationConditionIDList) .Select(x => new { x.Title, x.IsEnableName }).ToTable(); string[] liststring = { "条件名称", "启用状态" }; neh.Export(dt, liststring, "辅修毕业条件信息" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }