SpecialityScoreSumController.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using System.Data;
  7. using EMIS.CommonLogic.ScoreManage;
  8. using Bowin.Common.Utility;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.Web.Controls;
  11. using Bowin.Common.JSON;
  12. using System.Dynamic;
  13. using EMIS.Utility;
  14. using EMIS.ViewModel;
  15. using System.Text.RegularExpressions;
  16. using System.Web.Script.Serialization;
  17. using System.Text;
  18. using EMIS.CommonLogic.CalendarManage;
  19. namespace EMIS.Web.Controllers.ScoreManage
  20. {
  21. [Authorization]
  22. public class SpecialityScoreSumController : Controller
  23. {
  24. public Lazy<ISpecialityScoreSumServices> specialityScoreSumServices { get; set; }
  25. public Lazy<ISpecialityScoreByFinalScoreServices> specialityScoreByFinalScoreServices { get; set; }
  26. public Lazy<ISchoolYearServices> schoolYearServices { get; set; }
  27. /// <summary>
  28. /// 专业成绩汇总
  29. /// </summary>
  30. /// <returns></returns>
  31. public ActionResult List()
  32. {
  33. return View();
  34. }
  35. /// <summary>
  36. /// 个人成绩报表(适用于松山、工大、科大等)
  37. /// </summary>
  38. /// <returns></returns>
  39. public ActionResult StudentScoreReport()
  40. {
  41. return View();
  42. }
  43. /// <summary>
  44. /// 广体版本专业成绩汇总
  45. /// </summary>
  46. /// <returns></returns>
  47. [HttpGet]
  48. public ActionResult NewList()
  49. {
  50. var schoolYear = schoolYearServices.Value.GetSchoolYearIsCurrent(true);
  51. ViewBag.Years = schoolYear == null ? "-1" : schoolYear.Years.ToString();//默认当前学年
  52. return View();
  53. }
  54. /// <summary>
  55. /// 学生个人成绩报表(适用于广体等)
  56. /// </summary>
  57. /// <returns></returns>
  58. public ActionResult StudentScoreNewReport()
  59. {
  60. return View();
  61. }
  62. [HttpPost]
  63. public ActionResult SpecialityScoreSumList()
  64. {
  65. var collegeID = Request["collegeID"].ParseStrTo<Guid>();
  66. var standardID = Request["standardID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["standardID"].ParseStrTo<int>();
  67. var classmajorID = Request["classmajorID"].ParseStrTo<Guid>();
  68. var yearID = Request["yearID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["yearID"].ParseStrTo<int>();
  69. var schoolyearNumID = Request["schoolyearNumID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["schoolyearNumID"].ParseStrTo<int>();
  70. var schoolcodeID = Request["schoolcodeID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["schoolcodeID"].ParseStrTo<int>();
  71. var inSchoolStatus = Request["InSchoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["InSchoolStatus"].ParseStrTo<int>();
  72. var specialtyScoreSummaryView = specialityScoreSumServices.Value.SpecialityScoreSumTable(collegeID, yearID, standardID, schoolyearNumID, schoolcodeID, classmajorID, inSchoolStatus);
  73. return Json(specialtyScoreSummaryView);
  74. }
  75. protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
  76. {
  77. return new ConfigurableJsonResult { Data = data, ContentType = contentType, ContentEncoding = contentEncoding, JsonRequestBehavior = behavior };
  78. }
  79. [HttpPost]
  80. public ActionResult SpecialityScoreByScoreList(string CourseTypeID)
  81. {
  82. //var courseType = pararms.getExtraInt("CourseTypeID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("CourseTypeID");
  83. var collegeID = Request["collegeID"].ParseStrTo<Guid>();
  84. var standardID = Request["standardID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["standardID"].ParseStrTo<int>();
  85. var classmajorID = Request["classmajorID"].ParseStrTo<Guid>();
  86. var yearID = Request["yearID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["yearID"].ParseStrTo<int>();
  87. var schoolyearNumID = Request["schoolyearNumID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["schoolyearNumID"].ParseStrTo<int>();
  88. var schoolcodeID = Request["schoolcodeID"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["schoolcodeID"].ParseStrTo<int>();
  89. var inSchoolStatus = Request["InSchoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["InSchoolStatus"].ParseStrTo<int>();
  90. int count = Regex.Matches(CourseTypeID, ",").Count;
  91. List<int> CourseTypeIDList = new List<int>();
  92. for (int i = 0; i < count; i++)
  93. {
  94. string courseType = CourseTypeID.Split(',')[i];
  95. CourseTypeIDList.Add(int.Parse(courseType));
  96. }
  97. var specialtyScoreSummaryView = specialityScoreByFinalScoreServices.Value.SpecialityScoreSumTable(collegeID, yearID, standardID, schoolyearNumID, schoolcodeID, classmajorID, CourseTypeIDList);
  98. return Json(specialtyScoreSummaryView, "text/json", Encoding.UTF8, JsonRequestBehavior.AllowGet);
  99. }
  100. /// <summary>
  101. /// 导出Excel
  102. /// </summary>
  103. /// <param name="pararms"></param>
  104. /// <returns></returns>
  105. [HttpPost]
  106. public ActionResult Excel()
  107. {
  108. try
  109. {
  110. var collegeID = Request["CollegeDropdown"].ParseStrTo<Guid>();
  111. var standardID = Request["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["DictionaryStandard"].ParseStrTo<int>();
  112. var classmajorID = Request["ClassmajorDropdown"].ParseStrTo<Guid>();
  113. var yearID = Request["DictionarySchoolyear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolyear"].ParseStrTo<int>();
  114. var schoolyearNumID = Request["DictionarySchoolyearNum"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolyearNum"].ParseStrTo<int>();
  115. var schoolcodeID = Request["DictionarySchoolcode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolcode"].ParseStrTo<int>();
  116. var inSchoolStatus = Request["InSchoolStatusDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["InSchoolStatusDictionaryDropDown"].ParseStrTo<int>();
  117. specialityScoreSumServices.Value.ExportSpecialityScoreSumTable(collegeID, yearID, standardID, schoolyearNumID, schoolcodeID, classmajorID, inSchoolStatus);
  118. }
  119. catch (Exception)
  120. {
  121. throw;
  122. }
  123. return Json(new ReturnMessage()
  124. {
  125. IsSuccess = true,
  126. Message = "导出成功!"
  127. });
  128. }
  129. /// <summary>
  130. /// 广体导出Excel
  131. /// </summary>
  132. /// <param name="pararms"></param>
  133. /// <returns></returns>
  134. [HttpPost]
  135. public ActionResult GTExcel(string CourseTypeIDs, bool IsCredit)
  136. {
  137. try
  138. {
  139. var collegeID = Request["CollegeDropdown"].ParseStrTo<Guid>();
  140. var standardID = Request["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["DictionaryStandard"].ParseStrTo<int>();
  141. var classmajorID = Request["ClassmajorDropdown"].ParseStrTo<Guid>();
  142. var yearID = Request["DictionarySchoolyear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolyear"].ParseStrTo<int>();
  143. var schoolyearNumID = Request["DictionarySchoolyearNum"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolyearNum"].ParseStrTo<int>();
  144. var schoolcodeID = Request["DictionarySchoolcode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolcode"].ParseStrTo<int>();
  145. var courseTypeIDList = CourseTypeIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => int.Parse(x)).ToList();
  146. specialityScoreByFinalScoreServices.Value.ExportSpecialityScoreSumTable(collegeID, yearID, standardID, schoolyearNumID, schoolcodeID, classmajorID, courseTypeIDList, IsCredit);
  147. }
  148. catch (Exception)
  149. {
  150. throw;
  151. }
  152. return Json(new ReturnMessage()
  153. {
  154. IsSuccess = true,
  155. Message = "导出成功!"
  156. });
  157. }
  158. /// <summary>
  159. ///
  160. /// </summary>
  161. /// <returns></returns>
  162. [HttpPost]
  163. public ActionResult GetCourseType()
  164. {
  165. List<string> list = new List<string>();
  166. list = specialityScoreByFinalScoreServices.Value.GetCourseTypeID().Select(x => x.ToString()).ToList();
  167. return base.Json(list);
  168. }
  169. }
  170. }