EducationMissionClassCheckController.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.CalendarManage;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.CommonLogic.EducationManage;
  11. using EMIS.ViewModel.EducationManage;
  12. using Bowin.Common.Utility;
  13. using Bowin.Common.JSON;
  14. using Bowin.Common.Data;
  15. using Bowin.Common.Linq.Entity;
  16. namespace EMIS.Web.Controllers.EducationManage
  17. {
  18. [Authorization]
  19. public class EducationMissionClassCheckController : Controller
  20. {
  21. //
  22. // GET: /EducationMissionClassCheck/
  23. public ISchoolYearServices schoolYearServices { get; set; }
  24. public IEducationMissionClassCheckServices educationMissionClassCheckServices { get; set; }
  25. [HttpGet]
  26. public ActionResult List()
  27. {
  28. var schoolYear = schoolYearServices.GetSchoolYearIsCurrent(true);
  29. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  30. return View();
  31. }
  32. [HttpPost]
  33. public ActionResult List(QueryParamsModel pararms)
  34. {
  35. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  36. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  37. var weekNum = pararms.getExtraInt("ddlWeekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlWeekNum");
  38. var weekDay = pararms.getExtraInt("WeekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("WeekDay");
  39. var times = pararms.getExtraGuid("TimeComboGrid");
  40. var classroomID = pararms.getExtraGuid("ClassroomDropdown");
  41. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  42. var staffID = pararms.getExtraGuid("StaffDropdown");
  43. var opinionID = pararms.getExtraInt("Opinion") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("Opinion");
  44. var checkWayID = pararms.getExtraInt("CheckWay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("CheckWay");
  45. var result = educationMissionClassCheckServices.GetEducationMissionClassCheckViewGrid(configuretView, schoolyearID, weekNum, weekDay, times, classroomID, coursematerialID, staffID, opinionID, checkWayID, (int)pararms.page, (int)pararms.rows);
  46. return Json(result);
  47. }
  48. /// <summary>
  49. /// 复制新增
  50. /// </summary>
  51. /// <param name="graduationApplyID"></param>
  52. /// <returns></returns>
  53. public ActionResult CopyAdd(Guid educationMissionClassCheckID)
  54. {
  55. EducationMissionClassCheckView educationMissionClassCheckView = new EducationMissionClassCheckView();
  56. educationMissionClassCheckView = educationMissionClassCheckServices.GetEducationMissionClassCheckView(educationMissionClassCheckID);
  57. educationMissionClassCheckView.Weekday = -1;
  58. educationMissionClassCheckView.WeekNum = -1;
  59. educationMissionClassCheckView.CoursesTimeID = null;
  60. educationMissionClassCheckView.ClassroomID = null;
  61. return View("Edit", educationMissionClassCheckView);
  62. }
  63. /// <summary>
  64. /// 复制新增
  65. /// </summary>
  66. /// <param name="graduationApplyView"></param>
  67. /// <returns></returns>
  68. [HttpPost]
  69. public ActionResult CopyAdd(EducationMissionClassCheckView educationMissionClassCheckView)
  70. {
  71. educationMissionClassCheckView.EducationMissionClassCheckID = Guid.Empty;
  72. return this.Edit(educationMissionClassCheckView);
  73. }
  74. [HttpGet]
  75. public ActionResult Edit(Guid? educationMissionClassCheckID)
  76. {
  77. EducationMissionClassCheckView educationMissionClassCheckView = new EducationMissionClassCheckView();
  78. if (educationMissionClassCheckID.HasValue && educationMissionClassCheckID != Guid.Empty)
  79. {
  80. educationMissionClassCheckView = educationMissionClassCheckServices.GetEducationMissionClassCheckView(educationMissionClassCheckID);
  81. ViewBag.IsUpdate = "edit";
  82. }
  83. else
  84. {
  85. var schoolYear = schoolYearServices.GetSchoolYearIsCurrent(true);
  86. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  87. }
  88. return View(educationMissionClassCheckView);
  89. }
  90. /// <summary>
  91. /// 编辑(新增、修改)
  92. /// </summary>
  93. /// <param name="graduationApplyView"></param>
  94. /// <returns></returns>
  95. [HttpPost]
  96. public ActionResult Edit(EducationMissionClassCheckView educationMissionClassCheckView)
  97. {
  98. try
  99. {
  100. var teacherList = DataGrid.GetTableData<EducationMissionClassCheckTeacherView>("dgTeacherList");
  101. educationMissionClassCheckServices.EducationMissionClassCheckEdit(educationMissionClassCheckView, teacherList);
  102. return Json(new ReturnMessage()
  103. {
  104. IsSuccess = true,
  105. Message = "保存成功。"
  106. });
  107. }
  108. catch (Exception ex)
  109. {
  110. return Json(new ReturnMessage()
  111. {
  112. IsSuccess = false,
  113. Message = "保存失败,原因:" + ex.Message + "。"
  114. });
  115. }
  116. }
  117. /// <summary>
  118. /// 删除
  119. /// </summary>
  120. /// <param name="graduationApplyIDs"></param>
  121. /// <returns></returns>
  122. [HttpPost]
  123. public ActionResult Delete(string educationMissionClassCheckIDs)
  124. {
  125. try
  126. {
  127. List<Guid?> list = educationMissionClassCheckIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  128. .Select(x => (Guid?)new Guid(x)).ToList();
  129. educationMissionClassCheckServices.EducationMissionClassCheckDelete(list);
  130. return base.Json("删除成功。");
  131. }
  132. catch (Exception ex)
  133. {
  134. string mge = ex.Message;
  135. return base.Json("删除失败,原因:" + mge + "。");
  136. }
  137. }
  138. /// <summary>
  139. /// Excel导出
  140. /// </summary>
  141. /// <returns></returns>
  142. [HttpPost]
  143. public ActionResult Excel()
  144. {
  145. NpoiExcelHelper neh = new NpoiExcelHelper();
  146. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  147. var schoolyearID = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  148. var weekNum = Request.Form["ddlWeekNum"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlWeekNum"].ParseStrTo<int>();
  149. var weekDay = Request.Form["WeekDay"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["WeekDay"].ParseStrTo<int>();
  150. var times = Request.Form["TimeComboGrid"].ParseStrTo<Guid>();
  151. var classroomID = Request.Form["ClassroomDropdown"].ParseStrTo<Guid>();
  152. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
  153. var staffID = Request.Form["StaffDropdown"].ParseStrTo<Guid>();
  154. var opinionID = Request.Form["Opinion"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["Opinion"].ParseStrTo<int>();
  155. var checkWayID = Request.Form["CheckWay"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CheckWay"].ParseStrTo<int>();
  156. var educationMissionClassCheckID = Request.Form["EducationMissionClassCheckID"];
  157. List<Guid?> educationMissionClassCheckIDList = new List<Guid?>();
  158. if (educationMissionClassCheckID != "")
  159. {
  160. educationMissionClassCheckIDList = educationMissionClassCheckID.SplitIDString();
  161. }
  162. else
  163. {
  164. educationMissionClassCheckIDList = null;
  165. }
  166. var dt = educationMissionClassCheckServices.GetEducationMissionClassCheckViewList(configuretView, schoolyearID, weekNum, weekDay,
  167. times, classroomID, coursematerialID, staffID, opinionID, checkWayID, educationMissionClassCheckIDList)
  168. .Select(x => new
  169. {
  170. x.SchoolyearCode,
  171. x.EducationMissionClassName,
  172. x.CourseName,
  173. x.TeacherName,
  174. x.WeekNum,
  175. x.WeekdayName,
  176. x.Times,
  177. x.ClassroomName,
  178. x.StudentComment,
  179. x.TeacherComment,
  180. x.DeviceComment,
  181. x.OpinionName,
  182. x.CheckWayName,
  183. x.CheckPersonName,
  184. x.Remark
  185. }).ToTable();
  186. string[] liststring = {
  187. "学年学期", "任务班名称", "课程名称", "任课老师", "周", "星期", "节次", "课室", "学生情况",
  188. "教师情况", "设备及其他情况","处理意见", "检查方式", "检查人员", "备注"
  189. };
  190. neh.Export(dt, liststring, "教学检查信息");
  191. return Json(new ReturnMessage()
  192. {
  193. IsSuccess = true,
  194. Message = "导出成功。"
  195. });
  196. }
  197. [HttpGet]
  198. public ActionResult TeacherSelect()
  199. {
  200. return View();
  201. }
  202. /// <summary>
  203. /// 根据周次、星期、节次、场地获取任务班
  204. /// </summary>
  205. /// <param name="pararms"></param>
  206. /// <param name="weekNum"></param>
  207. /// <param name="weekDay"></param>
  208. /// <param name="goursesTimeID"></param>
  209. /// <param name="classroomID"></param>
  210. /// <returns></returns>
  211. public ActionResult GetEducationMissionClass(QueryParamsModel pararms)
  212. {
  213. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  214. var schoolyearID = pararms.getExtraGuid("schoolyearID");
  215. var weekNum = pararms.getExtraInt("weekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekNum");
  216. var weekDay = pararms.getExtraInt("weekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekDay");
  217. var coursesTimeID = pararms.getExtraGuid("coursesTimeID");
  218. var classroomID = pararms.getExtraGuid("classroomID");
  219. var result = educationMissionClassCheckServices.GetEducationMissionClassViewByCondition(configuretView, schoolyearID, weekNum, weekDay, coursesTimeID, classroomID, (int)pararms.page, (int)pararms.rows);
  220. return Json(result);
  221. }
  222. /// <summary>
  223. /// 根据任务班获取课程
  224. /// </summary>
  225. /// <param name="pararms"></param>
  226. /// <param name="weekNum"></param>
  227. /// <param name="weekDay"></param>
  228. /// <param name="goursesTimeID"></param>
  229. /// <param name="classroomID"></param>
  230. /// <returns></returns>
  231. public ActionResult GetCoursematerial(QueryParamsModel pararms)
  232. {
  233. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  234. var educationID = pararms.getExtraGuid("educationID");
  235. var schoolyearID = pararms.getExtraGuid("schoolyearID");
  236. var weekNum = pararms.getExtraInt("weekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekNum");
  237. var weekDay = pararms.getExtraInt("weekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekDay");
  238. var coursesTimeID = pararms.getExtraGuid("coursesTimeID");
  239. var classroomID = pararms.getExtraGuid("classroomID");
  240. var result = educationMissionClassCheckServices.GetCoursematerialByCondition(configuretView, schoolyearID, weekNum, weekDay, coursesTimeID, classroomID, educationID, (int)pararms.page, (int)pararms.rows);
  241. return Json(result);
  242. }
  243. [HttpPost]
  244. public ActionResult GetTeacherNameByEducationMissionClassID(QueryParamsModel pararms)
  245. {
  246. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  247. var educationID = pararms.getExtraGuid("educationID");
  248. var schoolyearID = pararms.getExtraGuid("schoolyearID");
  249. var weekNum = pararms.getExtraInt("weekNum") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekNum");
  250. var weekDay = pararms.getExtraInt("weekDay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("weekDay");
  251. var coursesTimeID = pararms.getExtraGuid("coursesTimeID");
  252. var classroomID = pararms.getExtraGuid("classroomID");
  253. string teacherNames = educationMissionClassCheckServices.GetTeacherByAll(configuretView, schoolyearID, weekNum, weekDay, coursesTimeID, classroomID, educationID);
  254. return Json(new ReturnMessage()
  255. {
  256. IsSuccess = true,
  257. Message = teacherNames
  258. });
  259. }
  260. /// <summary>
  261. /// 获取教学检查人员
  262. /// </summary>
  263. /// <param name="educationMissionClassID"></param>
  264. /// <returns></returns>
  265. [HttpPost]
  266. public ActionResult TeacherList(Guid? educationMissionClassCheckID)
  267. {
  268. if (educationMissionClassCheckID.HasValue)
  269. {
  270. var teacherList = educationMissionClassCheckServices.GetCheckTeacherViewListByCheckID((Guid)educationMissionClassCheckID);
  271. return Json(new GridResultSet<EducationMissionClassCheckTeacherView>() { rows = teacherList, total = teacherList.Count });
  272. }
  273. else
  274. {
  275. return null;
  276. }
  277. }
  278. }
  279. }