RetakePlanController.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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.RetakeManage;
  7. using EMIS.ViewModel;
  8. using EMIS.Utility.FormValidate;
  9. using Bowin.Common.Linq.Entity;
  10. using EMIS.ViewModel.RetakeManage;
  11. using EMIS.ViewModel.EducationManage;
  12. using EMIS.Web.Controls;
  13. using Bowin.Common.Data;
  14. using Bowin.Web.Controls.Mvc;
  15. using Bowin.Common.Utility;
  16. namespace EMIS.Web.Controllers.RetakeManage
  17. {
  18. [Authorization]
  19. public class RetakePlanController : Controller
  20. {
  21. public IRetakePlanServices RetakePlanServices { get; set; }
  22. public IRetakePlanStudentServices RetakePlanStudentServices { get; set; }
  23. public ActionResult StudentList()
  24. {
  25. return View();
  26. }
  27. public ActionResult ApproveList()
  28. {
  29. return View();
  30. }
  31. public ActionResult List()
  32. {
  33. return View();
  34. }
  35. public ActionResult SelectMission(Guid coursematerialID)
  36. {
  37. return View();
  38. }
  39. [HttpPost]
  40. public ActionResult StudentList(QueryParamsModel pararms)
  41. {
  42. var userID = CustomPrincipal.Current.UserID;
  43. var list = RetakePlanStudentServices.GetRetakeStudentApplyViewStudentList(userID);
  44. return Json(new GridResultSet<RetakeStudentApplyView> { rows = list, total = list.Count });
  45. }
  46. [HttpPost]
  47. public ActionResult EducationMissionList(QueryParamsModel pararms, Guid coursematerialID)
  48. {
  49. var list = RetakePlanStudentServices.GetEducationMissionImportClassViewList(coursematerialID);
  50. return Json(new GridResultSet<EducationMissionImportClassView> { rows = list, total = list.Count });
  51. }
  52. [HttpPost]
  53. public ActionResult CheckCanSubmit(Guid retakePlanStudentID)
  54. {
  55. try
  56. {
  57. RetakePlanStudentServices.CheckCanSubmit(retakePlanStudentID);
  58. return Json(new ReturnMessage { IsSuccess = true, Message = "校验成功。" });
  59. }
  60. catch (Exception ex)
  61. {
  62. return Json(new ReturnMessage { IsSuccess = false, Message = "申请失败:" + ex.Message });
  63. }
  64. }
  65. [HttpPost]
  66. public ActionResult Submit(Guid retakePlanStudentID, Guid educationMissionID)
  67. {
  68. try
  69. {
  70. RetakePlanStudentServices.Submit(retakePlanStudentID, educationMissionID);
  71. return Json(new ReturnMessage { IsSuccess = true, Message = "提交成功。" });
  72. }
  73. catch (Exception ex)
  74. {
  75. return Json(new ReturnMessage { IsSuccess = false, Message = "提交失败:" + ex.Message });
  76. }
  77. }
  78. [HttpPost]
  79. public ActionResult ApproveList(QueryParamsModel pararms)
  80. {
  81. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  82. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  83. var collegeID = pararms.getExtraGuid("cbgCollege");
  84. var gradeYearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  85. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  86. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  87. var learningformID = pararms.getExtraInt("LearningformDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("LearningformDictionaryDropDown");
  88. var education = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  89. var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
  90. var list = RetakePlanStudentServices.GetRetakeStudentApproveViewList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, classmajorID,
  91. learningformID, education, LearnSystem,pararms.page.Value, pararms.rows.Value);
  92. return Json(list);
  93. }
  94. [HttpPost]
  95. public ActionResult ApproveStudent(string retakePlanStudentIDs, Guid actionID, string comment)
  96. {
  97. var retakePlanStudentIDList = retakePlanStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  98. var curUserID = CustomPrincipal.Current.UserID;
  99. if (retakePlanStudentIDList.Count == 0)
  100. {
  101. return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行审核。" });
  102. }
  103. try
  104. {
  105. this.RetakePlanStudentServices.Approve(retakePlanStudentIDList, curUserID, actionID, comment);
  106. return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" });
  107. }
  108. catch (Exception ex)
  109. {
  110. return Json(new ReturnMessage { IsSuccess = false, Message = "审核失败:" + ex.Message });
  111. }
  112. }
  113. /// <summary>
  114. /// 导出Excel
  115. /// </summary>
  116. /// <returns></returns>
  117. [HttpPost]
  118. public ActionResult StudentExcel()
  119. {
  120. NpoiExcelHelper neh = new NpoiExcelHelper();
  121. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  122. var retakePlanStudentIDString = Request.Form["SelectedID"];
  123. var retakePlanStudentIDList = retakePlanStudentIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  124. var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
  125. var collegeID = Request.Form["cbgCollege"].ParseStrTo<Guid>();
  126. var gradeYearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  127. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  128. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  129. var dt = RetakePlanStudentServices.GetRetakeStudentApproveViewList(configuretView, retakePlanStudentIDList, schoolyearID, collegeID, gradeYearID, standardID,
  130. classmajorID).Select(x => new
  131. {
  132. x.SchoolyearCode,
  133. x.LoginID,
  134. x.UserName,
  135. x.ClassmajorName,
  136. x.CourseCode,
  137. x.CourseName,
  138. x.ClassName,
  139. x.TeacherName,
  140. x.ScheduleDateString,
  141. x.CourseTimeDesc,
  142. x.Credit,
  143. ScheduledTimes = x.TotalHours,
  144. x.ClassroomName
  145. }).ToTable();
  146. string[] liststring = { "学年学期", "学号", "姓名", "班级名称", "课程代码", "课程名称", "重修班级", "任课教师", "上课日期",
  147. "课时类别", "学分", "总学时", "课室" };
  148. neh.Export(dt, liststring, "重修审核列表");
  149. return RedirectToAction("MsgShow", "Common", new
  150. {
  151. msg = "导出成功!",
  152. url = Url.Action("AporoveList").AddMenuParameter()
  153. });
  154. }
  155. [HttpPost]
  156. public ActionResult List(QueryParamsModel pararms)
  157. {
  158. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  159. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  160. var collegeID = pararms.getExtraGuid("cbgCollege");
  161. var gradeYearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  162. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  163. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  164. var learningformID = pararms.getExtraInt("LearningformDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("LearningformDictionaryDropDown");
  165. var education = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  166. var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
  167. var list = RetakePlanStudentServices.GetFinalRetakeStudentApproveViewList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, classmajorID,
  168. learningformID, education, LearnSystem,pararms.page.Value, pararms.rows.Value);
  169. return Json(list);
  170. }
  171. /// <summary>
  172. /// 导出Excel
  173. /// </summary>
  174. /// <returns></returns>
  175. [HttpPost]
  176. public ActionResult StudentListExcel()
  177. {
  178. NpoiExcelHelper neh = new NpoiExcelHelper();
  179. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  180. var retakePlanStudentIDString = Request.Form["SelectedID"];
  181. var retakePlanStudentIDList = retakePlanStudentIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  182. var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
  183. var collegeID = Request.Form["cbgCollege"].ParseStrTo<Guid>();
  184. var gradeYearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  185. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  186. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  187. var learningformID = Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>();
  188. var education = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  189. var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  190. var dt = RetakePlanStudentServices.GetFinalRetakeStudentApproveViewList(configuretView, retakePlanStudentIDList, schoolyearID, collegeID, gradeYearID, standardID,
  191. classmajorID, learningformID, education, LearnSystem).Select(x => new
  192. {
  193. x.SchoolyearCode,
  194. x.LoginID,
  195. x.UserName,
  196. x.ClassmajorName,
  197. x.CourseCode,
  198. x.CourseName,
  199. x.ClassName,
  200. x.TeacherName,
  201. x.ScheduleDateString,
  202. x.CourseTimeDesc,
  203. x.Credit,
  204. ScheduledTimes = x.TotalHours,
  205. x.ClassroomName
  206. }).ToTable();
  207. string[] liststring = { "学年学期", "学号", "姓名", "班级名称", "课程代码", "课程名称", "重修班级", "任课教师", "上课日期",
  208. "课时类别", "学分", "总学时", "课室" };
  209. neh.Export(dt, liststring, "重修审核列表");
  210. return RedirectToAction("MsgShow", "Common", new
  211. {
  212. msg = "导出成功!",
  213. url = Url.Action("AporoveList").AddMenuParameter()
  214. });
  215. }
  216. }
  217. }