using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.ViewModel; using EMIS.CommonLogic.SchedulingManage.SchedulingSettings; using EMIS.CommonLogic.Cultureplan; using Bowin.Web.Controls.Mvc; using EMIS.Entities; using EMIS.ViewModel.CalendarManage; using EMIS.ViewModel.Cultureplan; namespace EMIS.Web.Controllers.SchedulingManage.SchedulingSettings { [Authorization] public class CourseScheduleSettingController : Controller { public ICourseScheduleSettingServices courseScheduleSettingServices { get; set; } public ICoursematerialServices coursematerialServices { get; set; } // // GET: /CourseScheduleSetting/ public ActionResult List() { return View(); } /// /// 课程可排时间设置列表 /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid"); var courseLevelID = pararms.getExtraInt("DictionaryCourseLevel") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseLevel"); var courseScienceID = pararms.getExtraInt("DictionaryCourseScience") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseScience"); return Json(courseScheduleSettingServices.GetCourseScheduleSettingViewGrid(coursematerialID, courseLevelID, courseScienceID, (int)pararms.page, (int)pararms.rows)); } public ActionResult Edit(Guid? coursematerialID) { CoursematerialView coursematerial = coursematerialServices.GetCoursematerialView(coursematerialID); return View(coursematerial); } /// /// 保存 /// /// [HttpPost] public ActionResult Edit() { try { Guid? coursematerialID = new Guid(Request.Form["CoursematerialID"]); var arrangementsList = DataGrid.GetTableData("dgArrangementsList"); courseScheduleSettingServices.CourseScheduleSettingAdd(arrangementsList, coursematerialID); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功!" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = true, Message = "保存失败,原因:" + ex.Message + "!" }); } } /// /// 删除 /// /// /// [HttpPost] public ActionResult Delete(string coursematerialIDs) { try { List list = new List(); for (int i = 0; i < coursematerialIDs.Split(',').Length; i++) { if (!string.IsNullOrEmpty(coursematerialIDs.Split(',')[i])) { Guid coursematerialID = new Guid(coursematerialIDs.Split(',')[i]); list.Add(coursematerialID); } } courseScheduleSettingServices.CourseScheduleSettingDelete(list); return Json("删除成功"); } catch (Exception ex) { return Json("删除失败,原因:" + ex.Message); } } /// /// 查看是否设置的排课时间 /// /// /// [HttpPost] public ActionResult ArrangementsList(Guid? coursematerialID) { return Json(courseScheduleSettingServices.GetArrangementViewGrid(coursematerialID)); } } }