MinorGraduationApplyController.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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.Web.Controls.Mvc;
  9. using EMIS.CommonLogic.MinorGraduation.MinorGraduationManage;
  10. using Bowin.Common.Exceptions;
  11. using Bowin.Common.Utility;
  12. using Bowin.Common.Data;
  13. using EMIS.ViewModel.MinorGraduation.MinorGraduationManage;
  14. using EMIS.CommonLogic.MinorGraduation.MinorGraduationSetting;
  15. namespace EMIS.Web.Controllers.MinorGraduation.MinorGraduationManage
  16. {
  17. [Authorization]
  18. public class MinorGraduationApplyController : Controller
  19. {
  20. //
  21. // GET: /MinorGraduationApply/
  22. public IMinorGraduationApplyServices minorGraduationApplyServices { get; set; }
  23. public IMinorGraduationConditionPackageServices minorGraduationConditionPackageServices { get; set; }
  24. public ActionResult List()
  25. {
  26. return View();
  27. }
  28. [HttpPost]
  29. public ActionResult List(QueryParamsModel pararms)
  30. {
  31. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  32. var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  33. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  34. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  35. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  36. //毕业类型
  37. var graduationTypeID = pararms.getExtraInt("DictionaryGraduationType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGraduationType");
  38. //在校状态
  39. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  40. //毕业结论
  41. var graduationResult = pararms.getExtraInt("DictionaryGraduationResult") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGraduationResult");
  42. //审核状态
  43. var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
  44. return base.Json(minorGraduationApplyServices.GetMinorGraduationApplyViewGrid(configuretView, gradSchoolyearID, collegeID, yearID,
  45. standardID, graduationTypeID, inSchoolStatus, graduationResult, approvalStatus, (int)pararms.page, (int)pararms.rows));
  46. }
  47. /// <summary>
  48. /// 生成
  49. /// </summary>
  50. /// <returns></returns>
  51. [HttpGet]
  52. public ActionResult Generate()
  53. {
  54. return View();
  55. }
  56. /// <summary>
  57. /// 生成
  58. /// </summary>
  59. /// <param name="pararms"></param>
  60. /// <returns></returns>
  61. [HttpPost]
  62. public ActionResult Generate(QueryParamsModel pararms)
  63. {
  64. try
  65. {
  66. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  67. var yearID = Request.Form["YearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["YearDropDown"].ParseStrTo<int>();
  68. minorGraduationApplyServices.MinorGraduationApplyGenerate(yearID);
  69. return Json(new ReturnMessage()
  70. {
  71. IsSuccess = true,
  72. Message = "生成成功。"
  73. });
  74. }
  75. catch (Exception ex)
  76. {
  77. return Json(new ReturnMessage()
  78. {
  79. IsSuccess = false,
  80. Message = "生成失败,原因:" + ex.Message
  81. });
  82. }
  83. }
  84. [HttpPost]
  85. public ActionResult Delete(string minorGraduationApplyIDs)
  86. {
  87. try
  88. {
  89. List<Guid?> list = minorGraduationApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  90. .Select(x => (Guid?)new Guid(x)).ToList();
  91. minorGraduationApplyServices.MinorGraduationApplyDelete(list);
  92. return base.Json("删除成功。");
  93. }
  94. catch (Exception ex)
  95. {
  96. return base.Json("删除失败,原因:" + ex.Message);
  97. }
  98. }
  99. [HttpGet]
  100. public ActionResult Submit()
  101. {
  102. MinorGraduationApplyView minorGraduationApplyView = new MinorGraduationApplyView();
  103. //查询对应的默认毕业公式
  104. var minorGraduationConditionPackageView = minorGraduationConditionPackageServices
  105. .GetDefaultMinorGraduationConditionPackageView();
  106. if (minorGraduationConditionPackageView != null)
  107. {
  108. minorGraduationApplyView.MinorGraduationConditionPackageID = minorGraduationConditionPackageView.MinorGraduationConditionPackageID;
  109. minorGraduationApplyView.StudentTypeID = minorGraduationConditionPackageView.StudentTypeID;
  110. }
  111. return View(minorGraduationApplyView);
  112. }
  113. [HttpPost]
  114. public ActionResult Submit(string minorGraduationApplyIDs, MinorGraduationApplyView minorGraduationApplyView)
  115. {
  116. try
  117. {
  118. List<Guid?> list = minorGraduationApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  119. .Select(x => (Guid?)new Guid(x)).ToList();
  120. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  121. var result = minorGraduationApplyServices.MinorGraduationApplySubmit(list, user.UserID, minorGraduationApplyView);
  122. return Json(new ReturnMessage()
  123. {
  124. IsSuccess = true,
  125. Message = "提交成功" + result + "。"
  126. });
  127. }
  128. catch (Exception ex)
  129. {
  130. return Json(new ReturnMessage()
  131. {
  132. IsSuccess = false,
  133. Message = "提交失败,原因:" + ex.Message + "。"
  134. });
  135. }
  136. }
  137. [HttpPost]
  138. public ActionResult Excel()
  139. {
  140. NpoiExcelHelper neh = new NpoiExcelHelper();
  141. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  142. //var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
  143. var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
  144. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  145. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  146. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  147. //毕业类型
  148. var graduationTypeID = Request.Form["DictionaryGraduationType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGraduationType"].ParseStrTo<int>();
  149. //在校状态
  150. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  151. //毕业结论
  152. var graduationResult = Request.Form["DictionaryGraduationResult"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGraduationResult"].ParseStrTo<int>();
  153. //审核状态
  154. var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>();
  155. var minorGraduationApplyIDString = Request.Form["SelectedID"];
  156. var minorGraduationApplyIDList = minorGraduationApplyIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  157. var dt = minorGraduationApplyServices.GetMinorGraduationApplyViewList(configuretView, gradSchoolyearID, collegeID, yearID,
  158. standardID, graduationTypeID, inSchoolStatus, graduationResult, approvalStatus, minorGraduationApplyIDList)
  159. .Select(x => new
  160. {
  161. x.GraduatingSemesterCode,
  162. x.StudentNo,
  163. x.UserName,
  164. x.SexName,
  165. x.GraduationTypeName,
  166. x.ClassminorName,
  167. x.InSchoolStatusName,
  168. x.CollegeName,
  169. x.MinorGraduationResultName,
  170. x.ApprovalResult,
  171. x.Remark,
  172. x.ApprovalStatusName
  173. }).ToTable();
  174. string[] liststring = {
  175. "毕业学期", "学号", "姓名", "性别", "毕业类型", "辅修班级", "在校状态", "院系所", "毕业结论", "预审说明", "备注", "审核状态"
  176. };
  177. neh.Export(dt, liststring, "辅修毕业申请信息" + DateTime.Now.ToString("yyyyMMdd"));
  178. return Json(new ReturnMessage()
  179. {
  180. IsSuccess = true,
  181. Message = "导出成功。"
  182. });
  183. }
  184. }
  185. }