GraduateCardListController.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Bowin.Web.Controls.Mvc;
  7. using Bowin.Common.Data;
  8. using Bowin.Common.Utility;
  9. using EMIS.Utility;
  10. using EMIS.Web.Controls;
  11. using EMIS.ViewModel;
  12. using EMIS.CommonLogic.GraduationManage.GraduateCardManage;
  13. namespace EMIS.Web.Controllers.GraduationManage.GraduateCardManage
  14. {
  15. [Authorization]
  16. public class GraduateCardListController : Controller
  17. {
  18. public IGraduateCardListServices GraduateCardListServices { get; set; }
  19. /// <summary>
  20. /// 去向名单页面
  21. /// </summary>
  22. /// <returns></returns>
  23. public ActionResult List()
  24. {
  25. return View();
  26. }
  27. /// <summary>
  28. /// 去向名单列表查询
  29. /// </summary>
  30. /// <param name="pararms"></param>
  31. /// <returns></returns>
  32. [HttpPost]
  33. public ActionResult List(QueryParamsModel pararms)
  34. {
  35. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  36. var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  37. var campusID = pararms.getExtraGuid("CampusDropdown");
  38. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  39. var yearID = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
  40. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  41. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  42. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  43. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  44. //毕业类型
  45. var graduationTypeID = pararms.getExtraInt("DictionaryGraduationType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGraduationType");
  46. //在校状态
  47. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  48. //去向结论
  49. var needCardResult = pararms.getExtraInt("DictionaryNeedCardResult") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryNeedCardResult");
  50. return base.Json(GraduateCardListServices.GetGraduateCardListViewGrid(configuretView, gradSchoolyearID, campusID, collegeID,
  51. yearID, standardID, educationID, learningformID, learnSystem, graduationTypeID, inSchoolStatus, needCardResult, (int)pararms.page, (int)pararms.rows));
  52. }
  53. /// <summary>
  54. /// 删除
  55. /// </summary>
  56. /// <param name="graduateCardApplyIDs"></param>
  57. /// <returns></returns>
  58. [HttpPost]
  59. public ActionResult Delete(string graduateCardApplyIDs)
  60. {
  61. try
  62. {
  63. List<Guid?> list = graduateCardApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  64. .Select(x => (Guid?)new Guid(x)).ToList();
  65. GraduateCardListServices.GraduateCardListDelete(list);
  66. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  67. }
  68. catch (Exception ex)
  69. {
  70. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
  71. }
  72. }
  73. /// <summary>
  74. /// Excel导出
  75. /// </summary>
  76. /// <returns></returns>
  77. [HttpPost]
  78. public ActionResult Excel()
  79. {
  80. NpoiExcelHelper neh = new NpoiExcelHelper();
  81. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  82. var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
  83. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  84. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  85. var yearID = Request.Form["DictionarySchoolyear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySchoolyear"].ParseStrTo<int>();
  86. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  87. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  88. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  89. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  90. //毕业类型
  91. var graduationTypeID = Request.Form["DictionaryGraduationType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGraduationType"].ParseStrTo<int>();
  92. //在校状态
  93. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  94. //去向结论
  95. var needCardResult = Request.Form["DictionaryNeedCardResult"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryNeedCardResult"].ParseStrTo<int>();
  96. var dt = GraduateCardListServices.GetGraduateCardListViewList(configuretView, gradSchoolyearID, campusID, collegeID, yearID,
  97. standardID, educationID, learningformID, learnSystem, graduationTypeID, inSchoolStatus, needCardResult)
  98. .Select(x => new
  99. {
  100. x.GraduatingSemesterCode,
  101. x.StudentNo,
  102. x.UserName,
  103. x.SexName,
  104. x.GraduationTypeName,
  105. BirthDate = x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyyMMdd") : "",
  106. x.StandardID,
  107. x.StandardCode,
  108. x.StandardName,
  109. x.SchoolyearID,
  110. x.CampusName,
  111. x.CollegeNo,
  112. x.CollegeName,
  113. x.GrademajorCode,
  114. x.GrademajorName,
  115. x.ClassNo,
  116. x.ClassName,
  117. x.EducationName,
  118. x.LearningformName,
  119. LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : null,
  120. x.ExamineeNum,
  121. x.NationName,
  122. x.PoliticsName,
  123. x.IDNumber,
  124. EntranceDate = x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyyMMdd") : "",
  125. x.ZIPCode,
  126. x.Telephone,
  127. x.Address,
  128. x.InSchoolStatusName,
  129. x.StudentStatusName,
  130. x.FinallyScoreCount,
  131. x.NeedCardResultName,
  132. x.ApprovalStatusName,
  133. x.Remark
  134. }).ToTable();
  135. string[] liststring = {
  136. "毕业学期", "学号", "姓名", "性别", "毕业类型", "出生日期", "专业ID(Value)", "专业代码", "专业名称",
  137. "年级", RSL.Get("CampusName"), RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "年级专业编号",
  138. "年级专业名称", "班级编号", "班级名称", RSL.Get("EducationID"), "学习形式", "学制",
  139. "考生号", "民族", "政治面貌", "身份证号", "入学日期", "邮政编码", "联系电话", "通讯地址",
  140. "在校状态", "学籍状态", "已修门数", "去向结论", "审核状态", "备注"
  141. };
  142. neh.Export(dt, liststring, "去向名单信息" + DateTime.Now.ToString("yyyyMMdd"));
  143. return Json(new ReturnMessage()
  144. {
  145. IsSuccess = true,
  146. Message = "导出成功。"
  147. });
  148. }
  149. }
  150. }