EvaluationStudentSettingScoreController.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Bowin.Common.Data;
  7. using Bowin.Common.Exceptions;
  8. using Bowin.Common.Utility;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.Web.Controls;
  11. using EMIS.Utility;
  12. using EMIS.ViewModel;
  13. using EMIS.ViewModel.EvaluationManage.StudentEvaluation;
  14. using EMIS.CommonLogic.EvaluationManage.StudentEvaluation;
  15. namespace EMIS.Web.Controllers.EvaluationManage.StudentEvaluation
  16. {
  17. [Authorization]
  18. public class EvaluationStudentSettingScoreController : Controller
  19. {
  20. public Lazy<IEvaluationStudentSettingScoreServices> EvaluationStudentSettingScoreServices { get; set; }
  21. /// <summary>
  22. /// 学评评分页面
  23. /// </summary>
  24. /// <returns></returns>
  25. public ActionResult List()
  26. {
  27. return View();
  28. }
  29. /// <summary>
  30. /// 学评评分列表查询
  31. /// </summary>
  32. /// <param name="pararms"></param>
  33. /// <returns></returns>
  34. [HttpPost]
  35. public ActionResult List(QueryParamsModel pararms)
  36. {
  37. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  38. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  39. var campusID = pararms.getExtraGuid("CampusDropdown");
  40. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  41. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  42. var coursematerialID = pararms.getExtraGuid("CourseComboGrid");
  43. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  44. var handleModeID = pararms.getExtraInt("DictionaryHandleMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryHandleMode");
  45. var teachingModeID = pararms.getExtraInt("DictionaryTeachingMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMode");
  46. var staffID = pararms.getExtraGuid("StaffComboGrid");
  47. var teachingMethodID = pararms.getExtraInt("DictionaryTeachingMethod") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMethod");
  48. var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown");
  49. var openState = pararms.getExtraInt("OpenStateDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("OpenStateDropdown");
  50. return base.Json(EvaluationStudentSettingScoreServices.Value.GetEvaluationStudentSettingScoreViewGrid(configuretView, schoolyearID, campusID, collegeID, departmentID,
  51. coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, openState, (int)pararms.page, (int)pararms.rows));
  52. }
  53. /// <summary>
  54. /// 评分生成
  55. /// </summary>
  56. /// <returns></returns>
  57. public ActionResult Create()
  58. {
  59. return View();
  60. }
  61. /// <summary>
  62. /// 评分生成
  63. /// </summary>
  64. /// <param name="evaluationStudentSettingScoreView"></param>
  65. /// <returns></returns>
  66. [HttpPost]
  67. public ActionResult Create(EvaluationStudentSettingScoreView evaluationStudentSettingScoreView)
  68. {
  69. try
  70. {
  71. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  72. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  73. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  74. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  75. var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  76. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  77. var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
  78. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  79. var handleModeID = Request.Form["DictionaryHandleMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryHandleMode"].ParseStrTo<int>();
  80. var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo<int>();
  81. var staffID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
  82. var teachingMethodID = Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>();
  83. string result = EvaluationStudentSettingScoreServices.Value.EvaluationStudentSettingScoreCreate(campusID, collegeID, departmentID, gradeID, standardID,
  84. coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, evaluationStudentSettingScoreView.SchoolyearID);
  85. return Json(new ReturnMessage()
  86. {
  87. IsSuccess = true,
  88. Message = "生成成功" + result + "。"
  89. });
  90. }
  91. catch (Exception ex)
  92. {
  93. return Json(new ReturnMessage()
  94. {
  95. IsSuccess = false,
  96. Message = "生成失败,原因:" + ex.Message
  97. });
  98. }
  99. }
  100. /// <summary>
  101. /// 复制新增
  102. /// </summary>
  103. /// <param name="evaluationStudentSettingScoreID"></param>
  104. /// <returns></returns>
  105. public ActionResult CopyAdd(Guid evaluationStudentSettingScoreID)
  106. {
  107. var evaluationStudentSettingScoreView = new EvaluationStudentSettingScoreView();
  108. evaluationStudentSettingScoreView = EvaluationStudentSettingScoreServices.Value.GetEvaluationStudentSettingScoreView(evaluationStudentSettingScoreID);
  109. return View("Edit", evaluationStudentSettingScoreView);
  110. }
  111. /// <summary>
  112. /// 复制新增
  113. /// </summary>
  114. /// <param name="evaluationStudentSettingScoreView"></param>
  115. /// <returns></returns>
  116. [HttpPost]
  117. public ActionResult CopyAdd(EvaluationStudentSettingScoreView evaluationStudentSettingScoreView)
  118. {
  119. evaluationStudentSettingScoreView.EvaluationStudentSettingScoreID = Guid.Empty;
  120. return this.Edit(evaluationStudentSettingScoreView);
  121. }
  122. /// <summary>
  123. /// 编辑
  124. /// </summary>
  125. /// <param name="evaluationStudentSettingScoreID"></param>
  126. /// <returns></returns>
  127. [HttpGet]
  128. public ActionResult Edit(Guid? evaluationStudentSettingScoreID)
  129. {
  130. var evaluationStudentSettingScoreView = new EvaluationStudentSettingScoreView();
  131. if (evaluationStudentSettingScoreID.HasValue && evaluationStudentSettingScoreID != Guid.Empty)
  132. {
  133. evaluationStudentSettingScoreView = EvaluationStudentSettingScoreServices.Value.GetEvaluationStudentSettingScoreView(evaluationStudentSettingScoreID);
  134. }
  135. else
  136. {
  137. evaluationStudentSettingScoreView.TotalScore = 0;
  138. }
  139. return View(evaluationStudentSettingScoreView);
  140. }
  141. /// <summary>
  142. /// 编辑
  143. /// </summary>
  144. /// <param name="evaluationStudentSettingScoreView"></param>
  145. /// <returns></returns>
  146. [HttpPost]
  147. public ActionResult Edit(EvaluationStudentSettingScoreView evaluationStudentSettingScoreView)
  148. {
  149. try
  150. {
  151. EvaluationStudentSettingScoreServices.Value.EvaluationStudentSettingScoreEdit(evaluationStudentSettingScoreView);
  152. return Json(new ReturnMessage()
  153. {
  154. IsSuccess = true,
  155. Message = "保存成功。"
  156. });
  157. }
  158. catch (Exception ex)
  159. {
  160. return Json(new ReturnMessage()
  161. {
  162. IsSuccess = false,
  163. Message = "保存失败,原因:" + ex.Message
  164. });
  165. }
  166. }
  167. /// <summary>
  168. /// 删除
  169. /// </summary>
  170. /// <param name="evaluationStudentSettingScoreIDs"></param>
  171. /// <returns></returns>
  172. [HttpPost]
  173. public ActionResult Delete(string evaluationStudentSettingScoreIDs)
  174. {
  175. try
  176. {
  177. List<Guid?> list = evaluationStudentSettingScoreIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  178. EvaluationStudentSettingScoreServices.Value.EvaluationStudentSettingScoreDelete(list);
  179. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  180. }
  181. catch (Exception ex)
  182. {
  183. return base.Json(new ReturnMessage() { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
  184. }
  185. }
  186. /// <summary>
  187. /// Excel导出
  188. /// </summary>
  189. /// <returns></returns>
  190. [HttpPost]
  191. public ActionResult Excel()
  192. {
  193. NpoiExcelHelper neh = new NpoiExcelHelper();
  194. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  195. var schoolyearID = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  196. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  197. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  198. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  199. var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
  200. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  201. var handleModeID = Request.Form["DictionaryHandleMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryHandleMode"].ParseStrTo<int>();
  202. var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo<int>();
  203. var staffID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
  204. var teachingMethodID = Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>();
  205. var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo<Guid>();
  206. var openState = Request.Form["OpenStateDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["OpenStateDropdown"].ParseStrTo<int>();
  207. var dt = EvaluationStudentSettingScoreServices.Value.GetEvaluationStudentSettingScoreViewList(configuretView, schoolyearID, campusID, collegeID, departmentID,
  208. coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, openState)
  209. .Select(x => new
  210. {
  211. x.SchoolyearCode,
  212. x.MissionName,
  213. x.MissionClassName,
  214. x.CollegeNo,
  215. x.CollegeName,
  216. x.CampusNo,
  217. x.CampusName,
  218. x.CourseCode,
  219. x.CourseName,
  220. x.CourseStructureName,
  221. x.CourseCategoryName,
  222. x.CourseTypeName,
  223. x.CourseQualityName,
  224. Credit = x.Credit.HasValue ? x.Credit.Value.ToString("#.#") : null,
  225. x.DepartmentNo,
  226. x.DepartmentName,
  227. x.HandleModeName,
  228. x.TeachingModeName,
  229. x.MissionClassStatusName,
  230. x.EvaluationTableCode,
  231. x.EvaluationTableName,
  232. x.ParticipateTypeName,
  233. x.EvaluationTypeCode,
  234. x.EvaluationTypeName,
  235. x.StaffCode,
  236. x.StaffName,
  237. x.TitleName,
  238. x.TeachingMethodName,
  239. x.ParticipateCount,
  240. x.NoParticipateCount,
  241. x.ValidityParticipateCount,
  242. ValidityParticipateRate = x.ValidityParticipateRate.HasValue ? x.ValidityParticipateRate.Value.ToString("#.#") : "0",
  243. x.OpenStateName,
  244. x.TotalScore,
  245. x.Remark
  246. }).ToTable();
  247. string[] liststring = {
  248. "学年学期", "任务名称", "任务班名称", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("CampusName"),
  249. "课程代码", "课程名称", "课程结构", "课程属性", "课程类型", "课程性质", "课程学分", "开课教研室代码", "开课教研室",
  250. "处理方式", "授课方式", "任务状态", "评价表编号", "评价表名", "参评类型", "评价类型编号", "评价类型", "教师工号",
  251. "任课教师", "职称", "任课方式", "参评人数", "未评人数", "有效评数", "有效评率%", "开放状态", "评分", "备注"
  252. };
  253. neh.Export(dt, liststring, "学评评分信息" + DateTime.Now.ToString("yyyyMMdd"));
  254. return Json(new ReturnMessage()
  255. {
  256. IsSuccess = true,
  257. Message = "导出成功。"
  258. });
  259. }
  260. }
  261. }