using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Bowin.Web.Controls.Mvc; using EMIS.Entities; using EMIS.ViewModel; using EMIS.ViewModel.CalendarManage; using EMIS.CommonLogic.SchedulingManage.SchedulingSettings; using EMIS.CommonLogic.UniversityManage.TeacherManage; namespace EMIS.Web.Controllers.SchedulingManage.SchedulingSettings { [Authorization] public class TeacherScheduleSettingController : Controller { public ITeacherScheduleSettingServices teacherScheduleSettingServices { get; set; } public IStaffServices staffServices { get; set; } // // GET: /TeacherScheduleSetting/ public ActionResult List() { return View(); } /// /// 教师可排时间设置列表 /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { var userID = pararms.getExtraGuid("StaffComboGrid"); var collegeID = pararms.getExtraGuid("CollegeComboGrid"); var teacherTypeID = pararms.getExtraInt("DictionaryTeacherType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeacherType"); var incumbencyStateID = pararms.getExtraInt("DictionaryIncumbencyState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIncumbencyState"); var titleID = pararms.getExtraInt("DictionaryTitle") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTitle"); return Json(teacherScheduleSettingServices.GetTeacherScheduleSettingViewGrid(userID, teacherTypeID, incumbencyStateID, titleID, collegeID, (int)pararms.page, (int)pararms.rows)); } public ActionResult Edit(Guid? userID) { CF_Staff staff = staffServices.GetStaff(userID); return View(staff); } /// /// 保存 /// /// [HttpPost] public ActionResult Edit() { try { Guid? userID = new Guid(Request.Form["UserID"]); var arrangementsList = DataGrid.GetTableData("dgArrangementsList"); teacherScheduleSettingServices.TeacherScheduleSettingAdd(arrangementsList, userID); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功!" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = true, Message = "保存失败,原因:" + ex.Message + "!" }); } } /// /// 删除 /// /// /// [HttpPost] public ActionResult Delete(string userIDs) { try { List list = new List(); for (int i = 0; i < userIDs.Split(',').Length; i++) { if (!string.IsNullOrEmpty(userIDs.Split(',')[i])) { Guid userID = new Guid(userIDs.Split(',')[i]); list.Add(userID); } } teacherScheduleSettingServices.TeacherScheduleSettingDelete(list); return Json("删除成功"); } catch (Exception ex) { return Json("删除失败,原因:" + ex.Message); } } /// /// 查看是否设置的排课时间 /// /// /// [HttpPost] public ActionResult ArrangementsList(Guid? userID) { return Json(teacherScheduleSettingServices.GetArrangementViewGrid(userID)); } } }