using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.CalendarManage; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using EMIS.CommonLogic.EducationManage; using EMIS.ViewModel.EducationManage; using Bowin.Common.Utility; using Bowin.Common.JSON; using Bowin.Common.Data; using Bowin.Common.Linq.Entity; namespace EMIS.Web.Controllers.EducationManage { [Authorization] public class EducationMissionClassCheckController : Controller { // // GET: /EducationMissionClassCheck/ public ISchoolYearServices schoolYearServices { get; set; } public IEducationMissionClassCheckServices educationMissionClassCheckServices { get; set; } [HttpGet] public ActionResult List() { var schoolYear = schoolYearServices.GetSchoolYearIsCurrent(true); ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年 return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown"); var weekNum = pararms.getExtraInt("ddlWeekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlWeekNum"); var weekDay = pararms.getExtraInt("WeekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("WeekDay"); var times = pararms.getExtraGuid("TimeComboGrid"); var classroomID = pararms.getExtraGuid("ClassroomDropdown"); var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid"); var staffID = pararms.getExtraGuid("StaffDropdown"); var opinionID = pararms.getExtraInt("Opinion") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("Opinion"); var checkWayID = pararms.getExtraInt("CheckWay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("CheckWay"); var result = educationMissionClassCheckServices.GetEducationMissionClassCheckViewGrid(configuretView, schoolyearID, weekNum, weekDay, times, classroomID, coursematerialID, staffID, opinionID, checkWayID, (int)pararms.page, (int)pararms.rows); return Json(result); } /// /// 复制新增 /// /// /// public ActionResult CopyAdd(Guid educationMissionClassCheckID) { EducationMissionClassCheckView educationMissionClassCheckView = new EducationMissionClassCheckView(); educationMissionClassCheckView = educationMissionClassCheckServices.GetEducationMissionClassCheckView(educationMissionClassCheckID); educationMissionClassCheckView.Weekday = -1; educationMissionClassCheckView.WeekNum = -1; educationMissionClassCheckView.CoursesTimeID = null; educationMissionClassCheckView.ClassroomID = null; return View("Edit", educationMissionClassCheckView); } /// /// 复制新增 /// /// /// [HttpPost] public ActionResult CopyAdd(EducationMissionClassCheckView educationMissionClassCheckView) { educationMissionClassCheckView.EducationMissionClassCheckID = Guid.Empty; return this.Edit(educationMissionClassCheckView); } [HttpGet] public ActionResult Edit(Guid? educationMissionClassCheckID) { EducationMissionClassCheckView educationMissionClassCheckView = new EducationMissionClassCheckView(); if (educationMissionClassCheckID.HasValue && educationMissionClassCheckID != Guid.Empty) { educationMissionClassCheckView = educationMissionClassCheckServices.GetEducationMissionClassCheckView(educationMissionClassCheckID); ViewBag.IsUpdate = "edit"; } else { var schoolYear = schoolYearServices.GetSchoolYearIsCurrent(true); ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年 } return View(educationMissionClassCheckView); } /// /// 编辑(新增、修改) /// /// /// [HttpPost] public ActionResult Edit(EducationMissionClassCheckView educationMissionClassCheckView) { try { var teacherList = DataGrid.GetTableData("dgTeacherList"); educationMissionClassCheckServices.EducationMissionClassCheckEdit(educationMissionClassCheckView, teacherList); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败,原因:" + ex.Message + "。" }); } } /// /// 删除 /// /// /// [HttpPost] public ActionResult Delete(string educationMissionClassCheckIDs) { try { List list = educationMissionClassCheckIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)) .Select(x => (Guid?)new Guid(x)).ToList(); educationMissionClassCheckServices.EducationMissionClassCheckDelete(list); return base.Json("删除成功。"); } catch (Exception ex) { string mge = ex.Message; return base.Json("删除失败,原因:" + mge + "。"); } } /// /// Excel导出 /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var schoolyearID = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo(); var weekNum = Request.Form["ddlWeekNum"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlWeekNum"].ParseStrTo(); var weekDay = Request.Form["WeekDay"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["WeekDay"].ParseStrTo(); var times = Request.Form["TimeComboGrid"].ParseStrTo(); var classroomID = Request.Form["ClassroomDropdown"].ParseStrTo(); var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo(); var staffID = Request.Form["StaffDropdown"].ParseStrTo(); var opinionID = Request.Form["Opinion"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["Opinion"].ParseStrTo(); var checkWayID = Request.Form["CheckWay"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["CheckWay"].ParseStrTo(); var educationMissionClassCheckID = Request.Form["EducationMissionClassCheckID"]; List educationMissionClassCheckIDList = new List(); if (educationMissionClassCheckID != "") { educationMissionClassCheckIDList = educationMissionClassCheckID.SplitIDString(); } else { educationMissionClassCheckIDList = null; } var dt = educationMissionClassCheckServices.GetEducationMissionClassCheckViewList(configuretView, schoolyearID, weekNum, weekDay, times, classroomID, coursematerialID, staffID, opinionID, checkWayID, educationMissionClassCheckIDList) .Select(x => new { x.SchoolyearCode, x.EducationMissionClassName, x.CourseName, x.TeacherName, x.WeekNum, x.WeekdayName, x.Times, x.ClassroomName, x.StudentComment, x.TeacherComment, x.DeviceComment, x.OpinionName, x.CheckWayName, x.CheckPersonName, x.Remark }).ToTable(); string[] liststring = { "学年学期", "任务班名称", "课程名称", "任课老师", "周", "星期", "节次", "课室", "学生情况", "教师情况", "设备及其他情况","处理意见", "检查方式", "检查人员", "备注" }; neh.Export(dt, liststring, "教学检查信息"); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } [HttpGet] public ActionResult TeacherSelect() { return View(); } /// /// 根据周次、星期、节次、场地获取任务班 /// /// /// /// /// /// /// public ActionResult GetEducationMissionClass(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var schoolyearID = pararms.getExtraGuid("schoolyearID"); var weekNum = pararms.getExtraInt("weekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekNum"); var weekDay = pararms.getExtraInt("weekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekDay"); var coursesTimeID = pararms.getExtraGuid("coursesTimeID"); var classroomID = pararms.getExtraGuid("classroomID"); var result = educationMissionClassCheckServices.GetEducationMissionClassViewByCondition(configuretView, schoolyearID, weekNum, weekDay, coursesTimeID, classroomID, (int)pararms.page, (int)pararms.rows); return Json(result); } /// /// 根据任务班获取课程 /// /// /// /// /// /// /// public ActionResult GetCoursematerial(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var educationID = pararms.getExtraGuid("educationID"); var schoolyearID = pararms.getExtraGuid("schoolyearID"); var weekNum = pararms.getExtraInt("weekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekNum"); var weekDay = pararms.getExtraInt("weekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekDay"); var coursesTimeID = pararms.getExtraGuid("coursesTimeID"); var classroomID = pararms.getExtraGuid("classroomID"); var result = educationMissionClassCheckServices.GetCoursematerialByCondition(configuretView, schoolyearID, weekNum, weekDay, coursesTimeID, classroomID, educationID, (int)pararms.page, (int)pararms.rows); return Json(result); } [HttpPost] public ActionResult GetTeacherNameByEducationMissionClassID(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var educationID = pararms.getExtraGuid("educationID"); var schoolyearID = pararms.getExtraGuid("schoolyearID"); var weekNum = pararms.getExtraInt("weekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekNum"); var weekDay = pararms.getExtraInt("weekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekDay"); var coursesTimeID = pararms.getExtraGuid("coursesTimeID"); var classroomID = pararms.getExtraGuid("classroomID"); string teacherNames = educationMissionClassCheckServices.GetTeacherByAll(configuretView, schoolyearID, weekNum, weekDay, coursesTimeID, classroomID, educationID); return Json(new ReturnMessage() { IsSuccess = true, Message = teacherNames }); } /// /// 获取教学检查人员 /// /// /// [HttpPost] public ActionResult TeacherList(Guid? educationMissionClassCheckID) { if (educationMissionClassCheckID.HasValue) { var teacherList = educationMissionClassCheckServices.GetCheckTeacherViewListByCheckID((Guid)educationMissionClassCheckID); return Json(new GridResultSet() { rows = teacherList, total = teacherList.Count }); } else { return null; } } } }