RetakePlanPrescanController.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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.Web.Controls;
  8. using Bowin.Common.Utility;
  9. using EMIS.CommonLogic.RetakeManage;
  10. using Bowin.Web.Controls.Mvc;
  11. using Bowin.Common.Data;
  12. namespace EMIS.Web.Controllers.RetakeManage
  13. {
  14. [Authorization]
  15. public class RetakePlanPrescanController : Controller
  16. {
  17. public IRetakePlanServices RetakePlanServices { get; set; }
  18. public IRetakePlanStudentServices RetakePlanStudentServices { get; set; }
  19. public ActionResult List()
  20. {
  21. return View();
  22. }
  23. public ActionResult Add()
  24. {
  25. return View();
  26. }
  27. [HttpPost]
  28. public ActionResult List(QueryParamsModel pararms)
  29. {
  30. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  31. var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
  32. var collegeID = pararms.getExtraGuid("cbgCollege");
  33. var gradeYearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  34. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  35. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  36. var isNoAssears = pararms.getExtraInt("ddlIsNoAssears") == DropdownList.SELECT_ALL ? (bool?)null : (pararms.getExtraInt("ddlIsNoAssears") == (int)CF_GeneralPurpose.IsYes);
  37. var learningformID = pararms.getExtraInt("LearningformDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("LearningformDictionaryDropDown");
  38. var education = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  39. var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
  40. return Json(RetakePlanStudentServices.GetRetakeStudentListViewList(configuretView, schoolyearID, collegeID,
  41. gradeYearID, standardID, classmajorID, isNoAssears,learningformID,education,LearnSystem, (int)pararms.page, (int)pararms.rows));
  42. }
  43. public ActionResult StudentDetail()
  44. {
  45. var userID = Request["userID"].ParseStrTo<Guid>();
  46. var schoolyearID = Request["schoolyearID"].ParseStrTo<Guid>();
  47. ViewBag.userID = userID;
  48. ViewBag.schoolyearID = schoolyearID;
  49. return View();
  50. }
  51. [HttpPost]
  52. public ActionResult StudentDetail(QueryParamsModel pararms)
  53. {
  54. var userID = Request["userID"].ParseStrTo<Guid>() ;
  55. var schoolyearID = Request["schoolyearID"].ParseStrTo<Guid>();
  56. ViewBag.userID = userID;
  57. ViewBag.schoolyearID = schoolyearID;
  58. return Json(RetakePlanStudentServices.GetRetakeStudentDetailListView(userID, schoolyearID, (int)pararms.page, (int)pararms.rows));
  59. }
  60. [HttpPost]
  61. public ActionResult Generate()
  62. {
  63. try
  64. {
  65. RetakePlanServices.Generate();
  66. return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
  67. }
  68. catch (Exception ex)
  69. {
  70. return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
  71. }
  72. }
  73. [HttpPost]
  74. public ActionResult Charge(string planStudentIDs)
  75. {
  76. List<Guid?> list = planStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  77. try
  78. {
  79. RetakePlanStudentServices.ChargePush(list);
  80. return Json(new ReturnMessage { IsSuccess = true, Message = "推送成功。" });
  81. }
  82. catch (Exception ex)
  83. {
  84. return Json(new ReturnMessage { IsSuccess = false, Message = "推送失败:" + ex.Message });
  85. }
  86. }
  87. [HttpPost]
  88. public ActionResult Delete(string planStudentIDs)
  89. {
  90. List<Guid?> list = planStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  91. try
  92. {
  93. RetakePlanStudentServices.DeleteStudent(list);
  94. return Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  95. }
  96. catch (Exception ex)
  97. {
  98. return Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message });
  99. }
  100. }
  101. [HttpPost]
  102. public ActionResult Add(Guid userID)
  103. {
  104. try
  105. {
  106. RetakePlanStudentServices.AddStudent(userID);
  107. return Json(new ReturnMessage { IsSuccess = true, Message = "添加成功。" });
  108. }
  109. catch (Exception ex)
  110. {
  111. return Json(new ReturnMessage { IsSuccess = false, Message = "添加失败:" + ex.Message });
  112. }
  113. }
  114. //导出
  115. [HttpPost]
  116. public ActionResult Excel()
  117. {
  118. NpoiExcelHelper neh = new NpoiExcelHelper();
  119. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  120. var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
  121. var collegeID = Request.Form["cbgCollege"].ParseStrTo<Guid>();
  122. var gradeYearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  123. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  124. var isNoAssears = Request.Form["ddlIsNoAssears"];
  125. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  126. var learningformID = Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>();
  127. var education = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  128. var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  129. bool? isAssears = null;
  130. if (Convert.ToInt32(isNoAssears) == (int)CF_GeneralPurpose.IsYes)
  131. {
  132. isAssears = true;
  133. }
  134. if (Convert.ToInt32(isNoAssears) == (int)CF_GeneralPurpose.IsNo)
  135. {
  136. isAssears = false;
  137. }
  138. var dt = RetakePlanStudentServices.GetRetakeExcelList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, classmajorID, isAssears, learningformID, education, LearnSystem).Select(x => new
  139. {
  140. x.SchoolyearCode,
  141. x.LoginID,
  142. x.UserName,
  143. x.CollegeName,
  144. x.Gradeyear,
  145. x.StandardDesc,
  146. x.ClassName,
  147. x.NoPassCount,
  148. x.IsNoArrearsDesc
  149. }).ToTable();
  150. string[] liststring = { "学年学期", "学号","姓名", "教学点", "年级", "专业",
  151. "班级名称", "不及格门数", "是否已缴费"};
  152. neh.Export(dt, liststring, "补考重修名单");
  153. return Json(new ReturnMessage()
  154. {
  155. IsSuccess = true,
  156. Message = "导出成功!"
  157. });
  158. }
  159. }
  160. }