ExaminationTeacherController.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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.ExaminationManage;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Common.Data;
  10. using Bowin.Common.Utility;
  11. using EMIS.Utility;
  12. namespace EMIS.Web.Controllers.ExaminationManage
  13. {
  14. [Authorization]
  15. public class ExaminationTeacherController : Controller
  16. {
  17. public IExaminationTeacherServices ExaminationTeacherServices { get; set; }
  18. public ActionResult List()
  19. {
  20. return View();
  21. }
  22. /// <summary>
  23. /// 列表查询
  24. /// </summary>
  25. /// <param name="pararms"></param>
  26. /// <returns></returns>
  27. [HttpPost]
  28. public ActionResult List(QueryParamsModel pararms)
  29. {
  30. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  31. var campusID = pararms.getExtraGuid("CampusDropdown");
  32. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  33. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  34. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  35. return base.Json(ExaminationTeacherServices.GetStaffViewList(configuretView, campusID, collegeID, departmentID, (int)pararms.page, (int)pararms.rows));
  36. }
  37. [HttpPost]
  38. public ActionResult Excel()
  39. {
  40. NpoiExcelHelper neh = new NpoiExcelHelper();
  41. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  42. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  43. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  44. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  45. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  46. var dt = ExaminationTeacherServices.GetStaffViewList(configuretView, campusID, collegeID, departmentID).Select(x => new
  47. {
  48. x.StaffCode,
  49. x.Name,
  50. x.CampusName,
  51. x.CollegeName,
  52. x.DepartmentName,
  53. x.BirthDate,
  54. x.SexName,
  55. x.UsedName,
  56. x.NationName,
  57. x.Place,
  58. //x.EducationCodeName,
  59. x.Telephone,
  60. x.OfficeTelephone,
  61. x.Mobile,
  62. x.Email,
  63. x.QQ,
  64. x.Nationality,
  65. x.HealthStateName,
  66. x.HousePhone,
  67. x.Address,
  68. x.ZIPCode,
  69. x.HomeAddress,
  70. x.NowAddress,
  71. x.Residence,
  72. x.Speciality,
  73. x.WeChatNum,
  74. x.ReligionName,
  75. x.TeacherTypeName,
  76. x.IncumbencyStateName,
  77. x.CertificatesTypeName,
  78. x.CertificatesNum,
  79. x.SituationName,
  80. x.LiteracyLevelName,
  81. //x.DegreeStateName,
  82. x.LearnPositionName,
  83. x.TitleName,
  84. x.WorkDate,
  85. x.ComeSchoolDate,
  86. //x.TeachingDate,
  87. x.Profile,
  88. x.Remark
  89. }).ToTable();
  90. string[] liststring = { "教职工号", "姓名", RSL.Get("Campus"), RSL.Get("College"), "所在教研室", "出生日期", "性别",
  91. "曾用名", "民族", "籍贯", "学历", "家庭电话", "办公室电话", "移动电话", "电子邮箱", "QQ", "国籍",
  92. "健康状况", "住宅电话", "通信地址", "邮政编码", "家庭住址", "现住地址", "户口所在地", "特长", "微信号", "宗教信仰",
  93. "教师类别", "在职状态", "证件类型", "证件号码", "任课状况", "文化程度", "学位状况", "授予学位", "职称", "参加工作年月",
  94. "来校日期", "从教年月", "简介", "备注" };
  95. neh.Export(dt, liststring, "监考员信息");
  96. return RedirectToAction("MsgShow", "Common", new
  97. {
  98. msg = "导出成功!",
  99. url = Url.Content("~/ExaminationTeacher/List").AddMenuParameter()
  100. });
  101. }
  102. /// <summary>
  103. /// 添加
  104. /// </summary>
  105. /// <param name="userIDs"></param>
  106. /// <returns></returns>
  107. [HttpPost]
  108. public ActionResult Add(string userIDs)
  109. {
  110. try
  111. {
  112. var userIDList = userIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
  113. ExaminationTeacherServices.Add(userIDList);
  114. return base.Json("添加成功");
  115. }
  116. catch (Exception ex)
  117. {
  118. return base.Json("添加失败,原因:" + ex.Message + "!");
  119. }
  120. }
  121. /// <summary>
  122. /// 删除
  123. /// </summary>
  124. /// <param name="userIDs"></param>
  125. /// <returns></returns>
  126. [HttpPost]
  127. public ActionResult Delete(string userIDs)
  128. {
  129. try
  130. {
  131. var userIDList = userIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
  132. ExaminationTeacherServices.Delete(userIDList);
  133. return base.Json("删除成功");
  134. }
  135. catch (Exception ex)
  136. {
  137. return base.Json("删除失败,原因:" + ex.Message + "!");
  138. }
  139. }
  140. public ActionResult ExaminationTeacherSelect(Guid ExaminationPlanID)
  141. {
  142. return View();
  143. }
  144. public ActionResult ExaminationTeacherSelectGdss(Guid schoolyearID, Guid classroomID, DateTime examinationDate,
  145. TimeSpan startTime, TimeSpan endTime)
  146. {
  147. return View();
  148. }
  149. public ActionResult ExaminationAddTeacherSelect()
  150. {
  151. return View();
  152. }
  153. [HttpPost]
  154. public ActionResult AvailableList(QueryParamsModel pararms, Guid examinationPlanID, Guid classroomID)
  155. {
  156. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  157. var campusID = pararms.getExtraGuid("CampusDropdown");
  158. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  159. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  160. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  161. return base.Json(ExaminationTeacherServices.GetAvailableStaffViewList(configuretView, examinationPlanID, classroomID, campusID, collegeID, departmentID, (int)pararms.page, (int)pararms.rows));
  162. }
  163. [HttpPost]
  164. public ActionResult AvailableListGdss(QueryParamsModel pararms, Guid schoolyearID, DateTime examinationDate,
  165. TimeSpan startTime, TimeSpan endTime, Guid classroomID)
  166. {
  167. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  168. var campusID = pararms.getExtraGuid("CampusDropdown");
  169. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  170. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  171. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  172. return base.Json(ExaminationTeacherServices.GetAvailableStaffViewGdssList(configuretView, schoolyearID,
  173. examinationDate, startTime, endTime, classroomID, campusID, collegeID, departmentID, (int)pararms.page, (int)pararms.rows));
  174. }
  175. [HttpPost]
  176. public ActionResult AddAvailableList(QueryParamsModel pararms, Guid classroomID)
  177. {
  178. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  179. var campusID = pararms.getExtraGuid("CampusDropdown");
  180. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  181. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  182. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  183. return base.Json(ExaminationTeacherServices.GetAddAvailableStaffViewList(configuretView, classroomID, campusID, collegeID, departmentID, (int)pararms.page, (int)pararms.rows));
  184. }
  185. }
  186. }