ScoreConvertController.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 EMIS.CommonLogic.ScoreManage;
  10. using EMIS.ViewModel;
  11. using EMIS.Web.Controls;
  12. using EMIS.Utility;
  13. using EMIS.ViewModel.ScoreManage;
  14. using EMIS.CommonLogic.EducationManagement;
  15. using EMIS.Utility.FormValidate;
  16. using EMIS.CommonLogic.EducationManage;
  17. namespace EMIS.Web.Controllers.ScoreManage
  18. {
  19. [Authorization]
  20. public partial class ScoreConvertController : Controller
  21. {
  22. public IScoreConvertByReplaceServices ScoreConvertByReplaceServices { get; set; }
  23. public IStudentScoreServices StudentScoreServices { get; set; }
  24. public IExecutablePlanServices ExecutablePlanServices { get; set; }
  25. public ActionResult ByReplaceList()
  26. {
  27. ViewBag.StartStatusID = ScoreConvertByReplaceServices.GetStartStatus();
  28. return View();
  29. }
  30. public ActionResult ByReplaceEdit(Guid? scoreConvertByReplaceID)
  31. {
  32. ScoreConvertByReplaceView scoreConvertByReplaceView = new ScoreConvertByReplaceView();
  33. if (scoreConvertByReplaceID.HasValue)
  34. {
  35. scoreConvertByReplaceView = ScoreConvertByReplaceServices.GetScoreConvertByReplaceView(scoreConvertByReplaceID);
  36. }
  37. return View(scoreConvertByReplaceView);
  38. }
  39. [HttpPost]
  40. public ActionResult ByReplaceList(QueryParamsModel pararms)
  41. {
  42. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  43. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  44. var collegeID = pararms.getExtraGuid("cgbCollege");
  45. var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  46. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  47. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  48. var coursematerial = pararms.getExtraGuid("cbgCourse");
  49. var recordStatus = pararms.getExtraInt("ddlRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlRecordStatus");
  50. return base.Json(ScoreConvertByReplaceServices.GetScoreConvertByReplaceViewGrid(configuretView, schoolyearID, collegeID, yearID,
  51. standardID, classmajorID, coursematerial, recordStatus, pararms.page, pararms.rows));
  52. }
  53. [HttpPost]
  54. public ActionResult ByReplaceExcel()
  55. {
  56. NpoiExcelHelper neh = new NpoiExcelHelper();
  57. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  58. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  59. var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
  60. var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  61. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  62. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  63. var coursematerial = Request.Form["cbgCourse"].ParseStrTo<Guid>();
  64. var recordStatus = Request.Form["ddlRecordStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlRecordStatus"].ParseStrTo<int>();
  65. var dt = ScoreConvertByReplaceServices.GetScoreConvertByReplaceViewList(configuretView, schoolyearID, collegeID, yearID,
  66. standardID, classmajorID, coursematerial, recordStatus)
  67. .Select(x => new
  68. {
  69. x.SchoolyearCode,
  70. x.CollegeName,
  71. x.StandardDesc,
  72. x.ClassmajorName,
  73. x.LoginID,
  74. x.Name,
  75. x.TargetCourseCode,
  76. x.TargetCourseName,
  77. x.TotalScore,
  78. x.SourceCourseCode,
  79. x.SourceCourseName,
  80. x.RecordStatusDesc
  81. }).ToTable();
  82. string[] liststring = {
  83. "学年学期", RSL.Get("College"), "专业", "班级", "学号", "姓名",
  84. "课程代码", "课程名称", "成绩", "原始课程代码", "原始课程名称", "状态"
  85. };
  86. neh.Export(dt, liststring, "替换认定列表" + DateTime.Now.ToString("yyyyMMdd"));
  87. return Json(new ReturnMessage()
  88. {
  89. IsSuccess = true,
  90. Message = "导出成功。"
  91. });
  92. }
  93. [HttpPost]
  94. public ActionResult ByReplaceEdit(ScoreConvertByReplaceView scoreConvertByReplaceView)
  95. {
  96. try
  97. {
  98. ScoreConvertByReplaceServices.Save(scoreConvertByReplaceView);
  99. return Json(new ReturnMessage()
  100. {
  101. IsSuccess = true,
  102. Message = "保存成功"
  103. });
  104. }
  105. catch (Exception ex)
  106. {
  107. return Json(new ReturnMessage()
  108. {
  109. IsSuccess = false,
  110. Message = "保存失败," + ex.Message
  111. });
  112. }
  113. }
  114. [HttpPost]
  115. public ActionResult ByReplaceDelete(string scoreConvertByReplaceIDs)
  116. {
  117. try
  118. {
  119. var scoreConvertByReplaceIDList = scoreConvertByReplaceIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  120. ScoreConvertByReplaceServices.Delete(scoreConvertByReplaceIDList);
  121. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
  122. }
  123. catch (Exception ex)
  124. {
  125. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败," + ex.Message });
  126. }
  127. }
  128. [HttpPost]
  129. public ActionResult SourceCoursematerialList(QueryParamsModel pararms)
  130. {
  131. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  132. var userID = pararms.getExtraGuid("cbgUserID");
  133. return Json(StudentScoreServices.GetFinallyScoreCoursematerialViewGrid(configuretView, userID ?? Guid.Empty, pararms.page, pararms.rows));
  134. }
  135. [HttpPost]
  136. public ActionResult SourceCoursematerialView(Guid userID, Guid coursematerialID)
  137. {
  138. try
  139. {
  140. var sourceView = StudentScoreServices.GetFinallyScoreView(userID, coursematerialID);
  141. return Json(new ReturnMessage<FinallyScoreView> { IsSuccess = true, Message = "", Data = sourceView });
  142. }
  143. catch (Exception ex)
  144. {
  145. return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message });
  146. }
  147. }
  148. [HttpPost]
  149. public ActionResult TargetCoursematerialList(QueryParamsModel pararms)
  150. {
  151. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  152. var userID = pararms.getExtraGuid("cbgUserID");
  153. return Json(ExecutablePlanServices.GetLastCoursematerialViewGrid(configuretView, userID ?? Guid.Empty, pararms.page, pararms.rows));
  154. }
  155. [HttpPost]
  156. public ActionResult ByReplaceSubmit(string scoreConvertByReplaceIDs)
  157. {
  158. try
  159. {
  160. var scoreConvertByReplaceIDList = scoreConvertByReplaceIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  161. ScoreConvertByReplaceServices.StartUp(scoreConvertByReplaceIDList, CustomPrincipal.Current.UserID);
  162. return base.Json(new ReturnMessage { IsSuccess = true, Message = "提交成功" });
  163. }
  164. catch (Exception ex)
  165. {
  166. return base.Json(new ReturnMessage { IsSuccess = false, Message = "提交失败," + ex.Message });
  167. }
  168. }
  169. [HttpPost]
  170. public ActionResult ByReplaceApprove(string scoreConvertByReplaceIDs, Guid actionID, string comment)
  171. {
  172. try
  173. {
  174. var scoreConvertByReplaceIDList = scoreConvertByReplaceIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  175. ScoreConvertByReplaceServices.Approve(scoreConvertByReplaceIDList, CustomPrincipal.Current.UserID, actionID, comment);
  176. return base.Json(new ReturnMessage { IsSuccess = true, Message = "审核成功" });
  177. }
  178. catch (Exception ex)
  179. {
  180. return base.Json(new ReturnMessage { IsSuccess = false, Message = "审核失败," + ex.Message });
  181. }
  182. }
  183. }
  184. }