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.SelectCourse; using EMIS.ViewModel.SelectCourse; using Bowin.Common.Utility; using Bowin.Common.Data; namespace EMIS.Web.Controllers.SelectCourseManage { [Authorization] public class FreeSelectionCourseApproveController : Controller { public IFreeSelectionCourseServices FreeSelectionCourseServices { get; set; } public IFreeSelectionCourseApplyServices FreeSelectionCourseApplyServices { get; set; } /// /// 开课审核页面 /// /// public ActionResult List() { return View(); } /// /// 查询列表 /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var campusID = pararms.getExtraGuid("CampusDropdown"); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var departmentID = pararms.getExtraGuid("DepartmentDropdown"); var schoolyear = pararms.getExtraGuid("SchoolyearDropdown").ToString() == DropdownList.SELECT_ALL.ToString() ? null : pararms.getExtraGuid("SchoolyearDropdown"); var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus"); return this.Json(FreeSelectionCourseApplyServices.GetFreeSelectionCoursePlanApprovalViewGrid(configuretView, schoolyear, campusID, collegeID, departmentID, approvalStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 明细 /// /// /// public ActionResult Details(Guid? freeSelectionCourseApplyID) { FreeSelectionCourseApplyView freeSelectCourseApplyView = new FreeSelectionCourseApplyView(); if (freeSelectionCourseApplyID.HasValue) freeSelectCourseApplyView = FreeSelectionCourseApplyServices.GetFreeSelectionCourseApplyView(freeSelectionCourseApplyID); return View(freeSelectCourseApplyView); } /// /// 审核 /// /// /// /// /// [HttpPost] public ActionResult Approve(string formIDs, Guid actionID, string comment) { try { var formIDList = formIDs.Split(',').Select(x => new Guid(x)).ToList(); var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal; FreeSelectionCourseApplyServices.Approve(formIDList, user.UserID, 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(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var campusID = Request.Form["CampusDropdown"].ParseStrTo(); var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo(); var schoolyear = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo(); var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo(); var dt = FreeSelectionCourseApplyServices.GetFreeSelectionCoursePlanViewList(configuretView, schoolyear, campusID, collegeID, departmentID, approvalStatus).Select(x => new { x.SchoolyearCode, x.DepartmentName, x.DefaultClassName, x.CourseName, x.TeacherNames, x.PeopleNumlimit, x.PeopleNumlower, x.HandleModeName, x.IsNeedMaterialName, x.ApprovalStatusName }).ToTable(); string[] liststring = { "学年学期", "教研室", "选修任务班名称", "课程名称", "授课教师", "人数下限", "人数上限", "选修类型","是否需要教材","审批状态"}; neh.Export(dt, liststring, "开课审核信息"); return RedirectToAction("MsgShow", "Common", new { msg = "导出成功!", url = Url.Content("~/FreeSelectionCourseApprove/List").AddMenuParameter() }); } public ActionResult GetFreeSelectionCourseView(Guid? freeSelectionCourseID) { FreeSelectionCourseView freeSelectionCourseView = new FreeSelectionCourseView(); if (freeSelectionCourseID.HasValue) freeSelectionCourseView = FreeSelectionCourseServices.GetFreeSelectionCourseView(freeSelectionCourseID); return base.Json(freeSelectionCourseView); } } }