RetakePlanStudentApplyController.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.CommonLogic.RetakeManage.General;
  8. using EMIS.Utility.FormValidate;
  9. using EMIS.CommonLogic.RetakeManage;
  10. using EMIS.Web.Controls;
  11. using Bowin.Web.Controls.Mvc;
  12. using Bowin.Common.Utility;
  13. using Bowin.Common.Data;
  14. using EMIS.Utility;
  15. namespace EMIS.Web.Controllers.RetakeManage.General
  16. {
  17. [Authorization]
  18. public class RetakePlanStudentApplyController : Controller
  19. {
  20. public IRetakePlanStudentApplyServices RetakePlanStudentApplyServices { get; set; }
  21. public IRetakeOpenControlServices IRetakeOpenControlServices { get; set; }
  22. /// <summary>
  23. /// 进入报名页面(学生平台-网上报名版本)
  24. /// </summary>
  25. /// <returns></returns>
  26. public ActionResult List()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 进入报名页面列表查询(学生平台-网上报名版本)
  32. /// </summary>
  33. /// <param name="pararms"></param>
  34. /// <returns></returns>
  35. [HttpPost]
  36. public ActionResult List(QueryParamsModel pararms)
  37. {
  38. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  39. Guid UserID = EMIS.Utility.FormValidate.CustomPrincipal.Current.UserID;
  40. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  41. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  42. //报名状态
  43. var generalPurposeID = pararms.getExtraInt("DictionaryGeneralPurpose") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGeneralPurpose");
  44. return base.Json(RetakePlanStudentApplyServices.GetRetakePlanStudentApplyView(configuretView, UserID, schoolyearID,
  45. coursematerialID, generalPurposeID, pararms.page, pararms.rows));
  46. }
  47. /// <summary>
  48. /// 查询重修报名时间
  49. /// </summary>
  50. /// <returns></returns>
  51. public ActionResult RetakeOpenControl(QueryParamsModel pararms)
  52. {
  53. try
  54. {
  55. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  56. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  57. var retakeOpenTime = IRetakeOpenControlServices.GetRetakeApplyDateTime(schoolyearID);
  58. return Json(new ReturnMessage()
  59. {
  60. IsSuccess = true,
  61. Message = retakeOpenTime
  62. });
  63. }
  64. catch (Exception ex)
  65. {
  66. return Json(new ReturnMessage()
  67. {
  68. IsSuccess = false,
  69. Message = ex.Message
  70. });
  71. }
  72. }
  73. /// <summary>
  74. /// 学生平台重修报名(注:1、检测重修开放时间,2、检测人数上限,3、检测重修课程重复,4、检测重修收费控制-暂时不考虑,5、检测排课冲突)
  75. /// </summary>
  76. /// <param name="RetakePlanStudentID"></param>
  77. /// <returns></returns>
  78. [HttpPost]
  79. public ActionResult Apply(Guid RetakePlanStudentID)
  80. {
  81. try
  82. {
  83. this.RetakePlanStudentApplyServices.Apply(RetakePlanStudentID, CustomPrincipal.Current.UserID);
  84. return Json(new ReturnMessage()
  85. {
  86. IsSuccess = true,
  87. Message = "报名成功。"
  88. });
  89. }
  90. catch (Exception ex)
  91. {
  92. return Json(new ReturnMessage()
  93. {
  94. IsSuccess = false,
  95. Message = "报名失败,原因:" + ex.Message + "。"
  96. });
  97. }
  98. }
  99. /// <summary>
  100. /// 学生平台重修取消报名(注:1、检测重修开放时间,2、取消报名控制-暂时不考虑)
  101. /// </summary>
  102. /// <param name="RetakePlanStudentID"></param>
  103. /// <returns></returns>
  104. [HttpPost]
  105. public ActionResult CancelApply(Guid RetakePlanStudentID)
  106. {
  107. try
  108. {
  109. this.RetakePlanStudentApplyServices.CancleApply(RetakePlanStudentID, CustomPrincipal.Current.UserID);
  110. return Json(new ReturnMessage
  111. {
  112. IsSuccess = true,
  113. Message = "取消报名成功。"
  114. });
  115. }
  116. catch (Exception ex)
  117. {
  118. return Json(new ReturnMessage
  119. {
  120. IsSuccess = false,
  121. Message = "取消报名失败,原因:" + ex.Message + "。"
  122. });
  123. }
  124. }
  125. /// <summary>
  126. /// Excel导出(学生平台进入报名页面Excel导出)
  127. /// </summary>
  128. /// <returns></returns>
  129. [HttpPost]
  130. public ActionResult Excel()
  131. {
  132. return null;
  133. }
  134. /// <summary>
  135. /// 重修课程页面(学生平台)
  136. /// </summary>
  137. /// <returns></returns>
  138. public ActionResult StudentRetakeCourseList()
  139. {
  140. return View();
  141. }
  142. /// <summary>
  143. /// 重修课程页面列表查询(学生平台)
  144. /// </summary>
  145. /// <param name="pararms"></param>
  146. /// <returns></returns>
  147. [HttpPost]
  148. public ActionResult StudentRetakeCourseList(QueryParamsModel pararms)
  149. {
  150. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  151. Guid UserID = CustomPrincipal.Current.UserID;
  152. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  153. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  154. //重修任务状态
  155. var retakePlanStatusID = pararms.getExtraInt("DictionaryRetakePlanStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryRetakePlanStatus");
  156. return base.Json(RetakePlanStudentApplyServices.GetStudentRetakeCourseView(configuretView, UserID, schoolyearID,
  157. coursematerialID, retakePlanStatusID, pararms.page, pararms.rows));
  158. }
  159. /// <summary>
  160. /// Excel导出(学生平台重修课程页面Excel导出)
  161. /// </summary>
  162. /// <returns></returns>
  163. [HttpPost]
  164. public ActionResult StudentRetakeCourse_Excel()
  165. {
  166. NpoiExcelHelper neh = new NpoiExcelHelper();
  167. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  168. Guid UserID = CustomPrincipal.Current.UserID;
  169. var schoolyearID = Request.Form["ddlSchoolYear"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
  170. var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
  171. //重修任务状态
  172. var retakePlanStatusID = Request.Form["DictionaryRetakePlanStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryRetakePlanStatus"].ParseStrTo<int>();
  173. var dt = RetakePlanStudentApplyServices.GetStudentRetakeCourseView(configuretView, UserID, schoolyearID,
  174. coursematerialID, retakePlanStatusID)
  175. .Select(x => new
  176. {
  177. x.LoginID,
  178. x.UserName,
  179. x.SexName,
  180. x.ClassmajorName,
  181. x.SchoolyearCode,
  182. x.ClassName,
  183. x.RetakeTypeName,
  184. x.CourseCode,
  185. x.CourseName,
  186. x.CourseTypeName,
  187. x.Credit,
  188. x.Totalhours,
  189. x.StartEndWeeklyNum,
  190. x.WeekdayTimesSegmentName,
  191. x.ClassroomName,
  192. x.TeacherName,
  193. x.DepartmentName,
  194. x.CourseCollegeName,
  195. x.RecordStatusName,
  196. x.ApplyStatusName
  197. }).ToTable();
  198. string[] liststring = {
  199. "学号", "姓名", "性别", "班级名称", "重修学年学期", "重修班级名称",
  200. "重修类型", "课程代码", "课程名称", "课程类型", "课程学分", "总学时",
  201. "起止周次", "上课时间", "教室", "任课教师", "开课教研室",
  202. "开课" + RSL.Get("CollegeName"), "重修任务状态", "报名状态"
  203. };
  204. neh.Export(dt, liststring, "重修课程信息" + DateTime.Now.ToString("yyyyMMddhhmmss"));
  205. return RedirectToAction("MsgShow", "Common", new
  206. {
  207. msg = "导出成功。",
  208. url = Url.Content("~/RetakePlanStudentApply/StudentRetakeCourseList").AddMenuParameter()
  209. });
  210. }
  211. }
  212. }