using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using EMIS.CommonLogic.MinorManage.MinorPlanManage; using EMIS.Utility.FormValidate; using Bowin.Common.Utility; using Bowin.Common.Data; using EMIS.Utility; namespace EMIS.Web.Controllers.MinorManage.MinorPlanManage { [Authorization] public class MinorPlanApproveController : Controller { // // GET: /MinorPlanApprove/ public IMinorPlanApproveServices MinorPlanApproveServices { get; set; } public ActionResult List() { return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown"); var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown"); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus"); return this.Json(MinorPlanApproveServices.GetMinorPlanApplyViewGrid(configuretView, yearID, standardID, collegeID, approvalStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 审批确定(批量) /// /// /// /// /// [HttpPost] public ActionResult Approve(string GradeMinorApplicationIDs, Guid actionID, string comment) { var GradeMinorApplicationIDList = GradeMinorApplicationIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList(); var curUserID = CustomPrincipal.Current.UserID; if (GradeMinorApplicationIDList.Count == 0) { return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行审核。" }); } try { MinorPlanApproveServices.Approve(GradeMinorApplicationIDList, curUserID, actionID, comment); return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" }); } catch (Exception ex) { return Json(new ReturnMessage { IsSuccess = false, Message = "审核失败:" + ex.Message }); } } /// /// 导出Excel /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); var GradeMinorApplicationID = Request.Form["GradeMinorApplicationID"]; ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo(); var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo(); var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); var approvalStatus = Request.Form["GrademinorStatusDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["GrademinorStatusDictionaryDropDown"].ParseStrTo(); List GradeMinorApplicationIDList = new List(); if (GradeMinorApplicationID != "") { GradeMinorApplicationIDList = GradeMinorApplicationID.SplitIDString(); } else { GradeMinorApplicationIDList = null; } var dt = MinorPlanApproveServices.GetMinorPlanApplyViewList(configuretView, yearID, standardID, collegeID, approvalStatus, GradeMinorApplicationIDList).Select(x => new { x.YearID, x.StandardCode, x.StandardName, x.CollegeName, x.StudentLimit, x.CreateTime, x.CreateUserName, x.ApprovalStatusName }).ToTable(); string[] liststring = { "年级", "专业代码", "专业名称", RSL.Get("College"), "人数上限","申请时间", "申请人","状态"}; neh.Export(dt, liststring, "辅修申请审核信息"); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }