123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- 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);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="graduationApplyID"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="graduationApplyView"></param>
- /// <returns></returns>
- [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);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="graduationApplyView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(EducationMissionClassCheckView educationMissionClassCheckView)
- {
- try
- {
- var teacherList = DataGrid.GetTableData<EducationMissionClassCheckTeacherView>("dgTeacherList");
- educationMissionClassCheckServices.EducationMissionClassCheckEdit(educationMissionClassCheckView, teacherList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="graduationApplyIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string educationMissionClassCheckIDs)
- {
- try
- {
- List<Guid?> 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 + "。");
- }
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [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<Guid>();
- var weekNum = Request.Form["ddlWeekNum"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlWeekNum"].ParseStrTo<int>();
- var weekDay = Request.Form["WeekDay"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["WeekDay"].ParseStrTo<int>();
- var times = Request.Form["TimeComboGrid"].ParseStrTo<Guid>();
- var classroomID = Request.Form["ClassroomDropdown"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
- var staffID = Request.Form["StaffDropdown"].ParseStrTo<Guid>();
- var opinionID = Request.Form["Opinion"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["Opinion"].ParseStrTo<int>();
- var checkWayID = Request.Form["CheckWay"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CheckWay"].ParseStrTo<int>();
- var educationMissionClassCheckID = Request.Form["EducationMissionClassCheckID"];
- List<Guid?> educationMissionClassCheckIDList = new List<Guid?>();
- 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();
- }
- /// <summary>
- /// 根据周次、星期、节次、场地获取任务班
- /// </summary>
- /// <param name="pararms"></param>
- /// <param name="weekNum"></param>
- /// <param name="weekDay"></param>
- /// <param name="goursesTimeID"></param>
- /// <param name="classroomID"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// 根据任务班获取课程
- /// </summary>
- /// <param name="pararms"></param>
- /// <param name="weekNum"></param>
- /// <param name="weekDay"></param>
- /// <param name="goursesTimeID"></param>
- /// <param name="classroomID"></param>
- /// <returns></returns>
- 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
- });
- }
- /// <summary>
- /// 获取教学检查人员
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult TeacherList(Guid? educationMissionClassCheckID)
- {
- if (educationMissionClassCheckID.HasValue)
- {
- var teacherList = educationMissionClassCheckServices.GetCheckTeacherViewListByCheckID((Guid)educationMissionClassCheckID);
- return Json(new GridResultSet<EducationMissionClassCheckTeacherView>() { rows = teacherList, total = teacherList.Count });
- }
- else
- {
- return null;
- }
- }
- }
- }
|