123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- 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();
- }
- /// <summary>
- /// 教师可排时间设置列表
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [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);
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit()
- {
- try
- {
- Guid? userID = new Guid(Request.Form["UserID"]);
- var arrangementsList = DataGrid.GetTableData<ArrangementView>("dgArrangementsList");
- teacherScheduleSettingServices.TeacherScheduleSettingAdd(arrangementsList, userID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存失败,原因:" + ex.Message + "!"
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="userIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string userIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- 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);
- }
- }
- /// <summary>
- /// 查看是否设置的排课时间
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ArrangementsList(Guid? userID)
- {
- return Json(teacherScheduleSettingServices.GetArrangementViewGrid(userID));
- }
- }
- }
|