GrademajorRequirementController.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.GraduationManage.GraduationRequirement;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.ViewModel.GraduationManage.GraduationRequirement;
  11. using Bowin.Common.Utility;
  12. using Bowin.Common.Data;
  13. using EMIS.Utility;
  14. namespace EMIS.Web.Controllers.GraduationManage.GraduationRequirement
  15. {
  16. [Authorization]
  17. public class GrademajorRequirementController : Controller
  18. {
  19. public IGrademajorRequirementServices GrademajorRequirementServices { get; set; }
  20. /// <summary>
  21. /// 类型学分页面(课程类型学分)
  22. /// </summary>
  23. /// <returns></returns>
  24. public ActionResult List()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 类型学分列表查询(课程类型学分)
  30. /// </summary>
  31. /// <param name="pararms"></param>
  32. /// <returns></returns>
  33. [HttpPost]
  34. public ActionResult List(QueryParamsModel pararms)
  35. {
  36. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  37. var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  38. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  39. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  40. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  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. return base.Json(GrademajorRequirementServices.GetGradGrademajorRequirementViewGird(configuretView, gradSchoolyearID, collegeID, yearID,
  45. standardID, educationID, learningformID, learnSystem, (int)pararms.page, (int)pararms.rows));
  46. }
  47. /// <summary>
  48. /// 复制新增
  49. /// </summary>
  50. /// <param name="graduationRequirementID"></param>
  51. /// <returns></returns>
  52. public ActionResult CopyAdd(Guid graduationRequirementID)
  53. {
  54. GrademajorRequirementView grademajorRequirementView = new GrademajorRequirementView();
  55. grademajorRequirementView = GrademajorRequirementServices.GetGradGrademajorRequirementView(graduationRequirementID);
  56. return View("Edit", grademajorRequirementView);
  57. }
  58. /// <summary>
  59. /// 复制新增
  60. /// </summary>
  61. /// <param name="grademajorRequirementView"></param>
  62. /// <returns></returns>
  63. [HttpPost]
  64. public ActionResult CopyAdd(GrademajorRequirementView grademajorRequirementView)
  65. {
  66. grademajorRequirementView.GraduationRequirementID = Guid.Empty;
  67. return this.Edit(grademajorRequirementView);
  68. }
  69. /// <summary>
  70. /// 编辑(新增、修改,业务主键:年级专业)
  71. /// </summary>
  72. /// <param name="graduationRequirementID"></param>
  73. /// <returns></returns>
  74. [HttpGet]
  75. public ActionResult Edit(Guid? graduationRequirementID)
  76. {
  77. GrademajorRequirementView grademajorRequirementView = new GrademajorRequirementView();
  78. if (graduationRequirementID.HasValue && graduationRequirementID != Guid.Empty)
  79. {
  80. grademajorRequirementView = GrademajorRequirementServices.GetGradGrademajorRequirementView(graduationRequirementID);
  81. }
  82. return View(grademajorRequirementView);
  83. }
  84. /// <summary>
  85. /// 编辑(新增、修改,业务主键:年级专业)
  86. /// </summary>
  87. /// <param name="grademajorRequirementView"></param>
  88. /// <returns></returns>
  89. [HttpPost]
  90. public ActionResult Edit(GrademajorRequirementView grademajorRequirementView)
  91. {
  92. try
  93. {
  94. GrademajorRequirementServices.GradGrademajorRequirementEdit(grademajorRequirementView);
  95. return Json(new ReturnMessage()
  96. {
  97. IsSuccess = true,
  98. Message = "保存成功。"
  99. });
  100. }
  101. catch (Exception ex)
  102. {
  103. return Json(new ReturnMessage()
  104. {
  105. IsSuccess = false,
  106. Message = "保存失败,原因:" + ex.Message + "。"
  107. });
  108. }
  109. }
  110. /// <summary>
  111. /// 删除
  112. /// </summary>
  113. /// <param name="graduationRequirementIDs"></param>
  114. /// <returns></returns>
  115. [HttpPost]
  116. public ActionResult Delete(string graduationRequirementIDs)
  117. {
  118. try
  119. {
  120. List<Guid?> list = graduationRequirementIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  121. .Select(x => (Guid?)new Guid(x)).ToList();
  122. GrademajorRequirementServices.GradGrademajorRequirementDelete(list);
  123. return base.Json("删除成功。");
  124. }
  125. catch (Exception ex)
  126. {
  127. return base.Json("删除失败,原因:" + ex.Message);
  128. }
  129. }
  130. /// <summary>
  131. /// Excel导出
  132. /// </summary>
  133. /// <returns></returns>
  134. [HttpPost]
  135. public ActionResult Excel()
  136. {
  137. NpoiExcelHelper neh = new NpoiExcelHelper();
  138. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  139. var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
  140. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  141. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  142. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  143. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  144. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  145. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  146. var dt = GrademajorRequirementServices.GetGradGrademajorRequirementViewList(configuretView, gradSchoolyearID, collegeID, yearID,
  147. standardID, educationID, learningformID, learnSystem)
  148. .Select(x => new
  149. {
  150. x.GraduatingSemesterCode,
  151. x.GrademajorCode,
  152. x.GrademajorName,
  153. x.FacultymajorNo,
  154. x.FacultymajorName,
  155. x.CollegeNo,
  156. x.CollegeName,
  157. x.SchoolyearID,
  158. x.SchoolcodeName,
  159. x.EnteringSchoolYearCode,
  160. x.StandardID,
  161. x.StandardCode,
  162. x.StandardName,
  163. x.EducationName,
  164. x.LearningformName,
  165. x.LearnSystem,
  166. x.OptionalCourseCredit,
  167. x.RequiredCredit,
  168. x.TotalCredit,
  169. x.SpecialCredit
  170. }).ToTable();
  171. string[] liststring = {
  172. "毕业学期", "年级专业编号", "年级专业名称", "院系专业编号", "院系专业名称",
  173. RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "年级", "学期", "入学学年学期",
  174. "专业ID(Value)", "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式",
  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. }