ChangeApplyController.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Bowin.Common.Utility;
  7. using Bowin.Common.Data;
  8. using Bowin.Web.Controls.Mvc;
  9. using EMIS.Utility;
  10. using EMIS.Web.Controls;
  11. using EMIS.ViewModel;
  12. using EMIS.ViewModel.StudentManage.StudentChange;
  13. using EMIS.CommonLogic.StudentManage.StudentChange;
  14. using EMIS.CommonLogic.StudentManage.StudentProfile;
  15. namespace EMIS.Web.Controllers.StudentManage.StudentChange
  16. {
  17. [Authorization]
  18. public class ChangeApplyController : Controller
  19. {
  20. public Lazy<IChangeApplyServices> ChangeApplyServices { get; set; }
  21. public Lazy<IStudentServices> StudentServices { 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. var campusID = pararms.getExtraGuid("CampusDropdown");
  40. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  41. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  42. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  43. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  44. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  45. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  46. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  47. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  48. var changeTypeID = pararms.getExtraInt("DictionaryChangeType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryChangeType");
  49. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  50. var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
  51. return base.Json(ChangeApplyServices.Value.GetChangeApplyViewGrid(configuretView, campusID, collegeID, gradeID, standardID,
  52. educationID, learningformID, learnSystem, classmajorID, schoolyearID, changeTypeID, inSchoolStatus, approvalStatus, (int)pararms.page, (int)pararms.rows));
  53. }
  54. /// <summary>
  55. /// 复制新增
  56. /// </summary>
  57. /// <param name="studentChangeID"></param>
  58. /// <returns></returns>
  59. public ActionResult CopyAdd(Guid studentChangeID)
  60. {
  61. StudentChangeView studentChangeView = new StudentChangeView();
  62. studentChangeView = ChangeApplyServices.Value.GetStudentChangeView(studentChangeID);
  63. return View("Edit", studentChangeView);
  64. }
  65. /// <summary>
  66. /// 复制新增
  67. /// </summary>
  68. /// <param name="studentChangeView"></param>
  69. /// <returns></returns>
  70. [HttpPost]
  71. public ActionResult CopyAdd(StudentChangeView studentChangeView)
  72. {
  73. studentChangeView.StudentChangeID = Guid.Empty;
  74. studentChangeView.SchoolyearID = BaseExtensions.GetCurrentSchoolYearID();
  75. return this.Edit(studentChangeView);
  76. }
  77. /// <summary>
  78. /// 编辑
  79. /// </summary>
  80. /// <param name="studentChangeID"></param>
  81. /// <returns></returns>
  82. [HttpGet]
  83. public ActionResult Edit(Guid? studentChangeID)
  84. {
  85. StudentChangeView studentChangeView = new StudentChangeView();
  86. if (studentChangeID.HasValue && studentChangeID != Guid.Empty)
  87. {
  88. studentChangeView = ChangeApplyServices.Value.GetStudentChangeView(studentChangeID);
  89. }
  90. return View(studentChangeView);
  91. }
  92. /// <summary>
  93. /// 编辑
  94. /// </summary>
  95. /// <param name="studentChangeView"></param>
  96. /// <returns></returns>
  97. [HttpPost]
  98. public ActionResult Edit(StudentChangeView studentChangeView)
  99. {
  100. try
  101. {
  102. ChangeApplyServices.Value.ChangeApplyEdit(studentChangeView);
  103. return Json(new ReturnMessage()
  104. {
  105. IsSuccess = true,
  106. Message = "保存成功。"
  107. });
  108. }
  109. catch (Exception ex)
  110. {
  111. return Json(new ReturnMessage()
  112. {
  113. IsSuccess = false,
  114. Message = "保存失败,原因:" + ex.Message
  115. });
  116. }
  117. }
  118. /// <summary>
  119. /// 删除
  120. /// </summary>
  121. /// <param name="studentChangeIDs"></param>
  122. /// <returns></returns>
  123. [HttpPost]
  124. public ActionResult Delete(string studentChangeIDs)
  125. {
  126. try
  127. {
  128. List<Guid?> list = studentChangeIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  129. ChangeApplyServices.Value.ChangeApplyDelete(list);
  130. return Json(new ReturnMessage()
  131. {
  132. IsSuccess = true,
  133. Message = "删除成功。"
  134. });
  135. }
  136. catch (Exception ex)
  137. {
  138. return Json(new ReturnMessage()
  139. {
  140. IsSuccess = false,
  141. Message = "删除失败,原因:" + ex.Message
  142. });
  143. }
  144. }
  145. /// <summary>
  146. /// 提交
  147. /// </summary>
  148. /// <param name="studentChangeIDs"></param>
  149. /// <returns></returns>
  150. [HttpPost]
  151. public ActionResult ChangeApplySubmit(string studentChangeIDs)
  152. {
  153. try
  154. {
  155. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  156. List<Guid> list = studentChangeIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  157. string result = ChangeApplyServices.Value.ChangeApplySubmit(list, user.UserID, "");
  158. return Json(new ReturnMessage()
  159. {
  160. IsSuccess = true,
  161. Message = "提交成功" + result + "。"
  162. });
  163. }
  164. catch (Exception ex)
  165. {
  166. return Json(new ReturnMessage()
  167. {
  168. IsSuccess = false,
  169. Message = "提交失败,原因:" + ex.Message
  170. });
  171. }
  172. }
  173. /// <summary>
  174. /// 申请表报表
  175. /// </summary>
  176. /// <returns></returns>
  177. public ActionResult ApplyReport()
  178. {
  179. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  180. ViewBag.LoginUserID = curUser.UserID.ToString();
  181. var dataRangeID = StudentServices.Value.GetDataRangeID();
  182. ViewBag.DataRangeID = dataRangeID;
  183. return View();
  184. }
  185. /// <summary>
  186. /// Excel导出
  187. /// </summary>
  188. /// <returns></returns>
  189. [HttpPost]
  190. public ActionResult Excel()
  191. {
  192. NpoiExcelHelper neh = new NpoiExcelHelper();
  193. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  194. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  195. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  196. var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  197. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  198. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  199. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  200. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  201. var classmajorID = Request.Form["ClassmajorComboGrid"].ParseStrTo<Guid>();
  202. var schoolyearID = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  203. var changeTypeID = Request.Form["DictionaryChangeType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryChangeType"].ParseStrTo<int>();
  204. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  205. var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>();
  206. var dt = ChangeApplyServices.Value.GetChangeApplyViewList(configuretView, campusID, collegeID, gradeID, standardID, educationID, learningformID,
  207. learnSystem, classmajorID, schoolyearID, changeTypeID, inSchoolStatus, approvalStatus)
  208. .Select(x => new
  209. {
  210. x.StudentNo,
  211. x.Name,
  212. x.SexName,
  213. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : ""),
  214. x.NationName,
  215. x.PoliticsName,
  216. x.InSchoolStatusName,
  217. x.StudentStatusName,
  218. x.GradeID,
  219. x.SemesterName,
  220. x.StandardCode,
  221. x.StandardID,
  222. x.StandardName,
  223. x.EducationName,
  224. x.LearningformName,
  225. LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : "",
  226. x.ClassNum,
  227. x.ClassmajorNo,
  228. x.ClassmajorName,
  229. x.GrademajorCode,
  230. x.GrademajorName,
  231. x.FacultymajorCode,
  232. x.FacultymajorName,
  233. x.CollegeNo,
  234. x.CollegeName,
  235. x.CampusCode,
  236. x.CampusName,
  237. x.StartSchoolyearCode,
  238. x.SchoolyearCode,
  239. x.GraduateSchoolyearCode,
  240. x.ChangeTypeName,
  241. x.BeforeStandardName,
  242. x.BeforeClassmajorName,
  243. x.BeforeInSchoolStatusName,
  244. x.BeforeStudentStatusName,
  245. x.AfterStandardName,
  246. x.AfterClassmajorName,
  247. x.AfterInSchoolStatusName,
  248. x.AfterStudentStatusName,
  249. x.ReturnSchoolyearCode,
  250. x.ChangeApplyTypeName,
  251. x.ChangeReasonName,
  252. ChangeDate = (x.ChangeDate.HasValue ? x.ChangeDate.Value.ToString("yyyyMMdd") : ""),
  253. x.Description,
  254. x.ReportStatusName,
  255. x.ApprovalStatusName,
  256. x.Remark
  257. }).ToTable();
  258. string[] liststring = {
  259. "学号", "姓名", "性别", "出生日期", "民族", "政治面貌", "在校状态", "学籍状态", "年级", "入学学期",
  260. "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"), "学习形式", "学制", "班序",
  261. "班级编号", "班级名称", "年级专业编号", "年级专业名称", "院系专业编号", "院系专业名称",
  262. RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("Campus"), "入学学年学期",
  263. "异动学期", "毕业学期", "异动类型", "异动前专业", "异动前班级", "在校状态(前)", "学籍状态(前)",
  264. "异动后专业", "异动后班级", "在校状态(后)", "学籍状态(后)", "返校学期", "异动渠道", "异动原因", "异动日期",
  265. "申请说明", "注册状态", "审核状态", "备注"
  266. };
  267. neh.Export(dt, liststring, "异动申请信息" + DateTime.Now.ToString("yyyyMMdd"));
  268. return Json(new ReturnMessage()
  269. {
  270. IsSuccess = true,
  271. Message = "导出成功。"
  272. });
  273. }
  274. }
  275. }