GraduationCourseController.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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.Utility;
  8. using Bowin.Common.Data;
  9. using Bowin.Common.JSON;
  10. using EMIS.Utility;
  11. using EMIS.ViewModel;
  12. using EMIS.Web.Controls;
  13. using EMIS.CommonLogic.CalendarManage;
  14. using EMIS.ViewModel.GraduationManage.GraduationRequirement;
  15. using EMIS.CommonLogic.GraduationManage.GraduationRequirement;
  16. namespace EMIS.Web.Controllers.GraduationManage.GraduationRequirement
  17. {
  18. [Authorization]
  19. public class GraduationCourseController : Controller
  20. {
  21. public IGraduationCourseServices GraduationCourseServices { 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 gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  40. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  41. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  42. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  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. //课程类型
  47. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  48. return base.Json(GraduationCourseServices.GetGraduationCourseViewGird(configuretView, gradSchoolyearID, collegeID, yearID,
  49. standardID, educationID, learningformID, learnSystem, courseTypeID, (int)pararms.page, (int)pararms.rows));
  50. }
  51. /// <summary>
  52. /// 计划生成(专业计划)
  53. /// </summary>
  54. /// <returns></returns>
  55. public ActionResult PlanCreate()
  56. {
  57. GraduationCourseView graduationCourseView = new GraduationCourseView();
  58. return View(graduationCourseView);
  59. }
  60. /// <summary>
  61. /// 计划生成(专业计划)
  62. /// </summary>
  63. /// <param name="graduationCourseView"></param>
  64. /// <returns></returns>
  65. [HttpPost]
  66. public ActionResult PlanCreate(GraduationCourseView graduationCourseView)
  67. {
  68. try
  69. {
  70. var gradSpecialtyPlanViewList = Request["SpecialtyPlan"].JsonToObject<List<GradSpecialtyPlanView>>();
  71. string result = GraduationCourseServices.GraduationCourseBatchAdd(graduationCourseView, gradSpecialtyPlanViewList);
  72. return Json(new ReturnMessage()
  73. {
  74. IsSuccess = true,
  75. Message = "生成成功" + result + "。"
  76. });
  77. }
  78. catch (Exception ex)
  79. {
  80. string mge = ex.Message;
  81. return Json(new ReturnMessage()
  82. {
  83. IsSuccess = false,
  84. Message = "生成失败,原因:" + ex.Message + "。"
  85. });
  86. }
  87. }
  88. /// <summary>
  89. /// 查询对应的专业计划信息(需与毕业课程信息进行对比)
  90. /// </summary>
  91. /// <param name="pararms"></param>
  92. /// <returns></returns>
  93. [HttpPost]
  94. public ActionResult GraduationSpecialtyPlanList(QueryParamsModel pararms)
  95. {
  96. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  97. var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  98. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  99. var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
  100. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
  101. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  102. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  103. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  104. var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
  105. //课程类型
  106. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  107. return base.Json(GraduationCourseServices.GetGradSpecialtyPlanViewGrid(configuretView, gradSchoolyearID, collegeID, yearID,
  108. standardID, educationID, learningformID, learnSystem, coursematerialID, courseTypeID, (int)pararms.page, (int)pararms.rows));
  109. }
  110. /// <summary>
  111. /// 复制新增
  112. /// </summary>
  113. /// <param name="GraduationConditionPackageID"></param>
  114. /// <returns></returns>
  115. public ActionResult CopyAdd(Guid graduationCourseID)
  116. {
  117. GraduationCourseView graduationCourseView = new GraduationCourseView();
  118. graduationCourseView = GraduationCourseServices.GetGraduationCourseView(graduationCourseID);
  119. return View("Edit", graduationCourseView);
  120. }
  121. /// <summary>
  122. /// 复制新增
  123. /// </summary>
  124. /// <param name="graduationConditionPackageView"></param>
  125. /// <returns></returns>
  126. [HttpPost]
  127. public ActionResult CopyAdd(GraduationCourseView graduationCourseView)
  128. {
  129. graduationCourseView.GraduationCourseID = Guid.Empty;
  130. return this.Edit(graduationCourseView);
  131. }
  132. /// <summary>
  133. /// 编辑(新增、修改,业务主键:年级专业、课程信息、课程类型、课程学分)
  134. /// </summary>
  135. /// <param name="graduationCourseID"></param>
  136. /// <returns></returns>
  137. [HttpGet]
  138. public ActionResult Edit(Guid? graduationCourseID)
  139. {
  140. GraduationCourseView graduationCourseView = new GraduationCourseView();
  141. if (graduationCourseID.HasValue && graduationCourseID != Guid.Empty)
  142. {
  143. graduationCourseView = GraduationCourseServices.GetGraduationCourseView(graduationCourseID);
  144. }
  145. return View(graduationCourseView);
  146. }
  147. /// <summary>
  148. /// 编辑(新增、修改,业务主键:年级专业、课程信息、课程类型、课程学分)
  149. /// </summary>
  150. /// <param name="graduationCourseView"></param>
  151. /// <returns></returns>
  152. [HttpPost]
  153. public ActionResult Edit(GraduationCourseView graduationCourseView)
  154. {
  155. try
  156. {
  157. GraduationCourseServices.GraduationCourseEdit(graduationCourseView);
  158. return Json(new ReturnMessage()
  159. {
  160. IsSuccess = true,
  161. Message = "保存成功。"
  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. /// <param name="graduationCourseIDs"></param>
  177. /// <returns></returns>
  178. [HttpPost]
  179. public ActionResult Delete(string graduationCourseIDs)
  180. {
  181. try
  182. {
  183. List<Guid?> list = graduationCourseIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  184. .Select(x => (Guid?)new Guid(x)).ToList();
  185. GraduationCourseServices.GraduationCourseDelete(list);
  186. return base.Json("删除成功。");
  187. }
  188. catch (Exception ex)
  189. {
  190. return base.Json("删除失败,原因:" + ex.Message);
  191. }
  192. }
  193. /// <summary>
  194. /// Excel导出
  195. /// </summary>
  196. /// <returns></returns>
  197. [HttpPost]
  198. public ActionResult Excel()
  199. {
  200. NpoiExcelHelper neh = new NpoiExcelHelper();
  201. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  202. var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
  203. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  204. var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
  205. var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
  206. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  207. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  208. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  209. //课程类型
  210. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  211. var dt = GraduationCourseServices.GetGraduationCourseViewList(configuretView, gradSchoolyearID, collegeID, yearID,
  212. standardID, educationID, learningformID, learnSystem, courseTypeID)
  213. .Select(x => new
  214. {
  215. x.GraduatingSemesterCode,
  216. x.GrademajorCode,
  217. x.GrademajorName,
  218. x.FacultymajorNo,
  219. x.FacultymajorName,
  220. x.CollegeNo,
  221. x.CollegeName,
  222. x.SchoolyearID,
  223. x.SchoolcodeName,
  224. x.EnteringSchoolYearCode,
  225. x.StandardID,
  226. x.StandardCode,
  227. x.StandardName,
  228. x.EducationName,
  229. x.LearningformName,
  230. x.LearnSystem,
  231. x.CourseCode,
  232. x.CourseName,
  233. x.CourseTypeName,
  234. x.CourseCredit
  235. }).ToTable();
  236. string[] liststring = {
  237. "毕业学期", "年级专业编号", "年级专业名称", "院系专业编号", "院系专业名称",
  238. RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "年级", "学期", "入学学年学期",
  239. "专业ID(Value)", "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式",
  240. "学制", "课程代码", "课程名称", "课程类型", "课程学分"
  241. };
  242. neh.Export(dt, liststring, "毕业课程信息" + DateTime.Now.ToString("yyyyMMdd"));
  243. return Json(new ReturnMessage()
  244. {
  245. IsSuccess = true,
  246. Message = "导出成功。"
  247. });
  248. }
  249. }
  250. }