EvaluationStudentController.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 EvaluationStudentController : Controller
  19. {
  20. public Lazy<IEvaluationStudentServices> EvaluationStudentServices { 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 teachingModeID = pararms.getExtraInt("DictionaryTeachingMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMode");
  45. var staffID = pararms.getExtraGuid("StaffComboGrid");
  46. var teachingMethodID = pararms.getExtraInt("DictionaryTeachingMethod") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMethod");
  47. var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown");
  48. var isValidity = pararms.getExtraInt("IsValidityDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsValidityDropdown");
  49. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  50. return base.Json(EvaluationStudentServices.Value.GetEvaluationStudentViewGrid(configuretView, schoolyearID, campusID, collegeID, departmentID,
  51. coursematerialID, courseTypeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, isValidity, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  52. }
  53. /// <summary>
  54. /// 编辑
  55. /// </summary>
  56. /// <param name="evaluationStudentID"></param>
  57. /// <returns></returns>
  58. [HttpGet]
  59. public ActionResult Edit(Guid? evaluationStudentID)
  60. {
  61. var evaluationStudentView = new EvaluationStudentView();
  62. if (evaluationStudentID.HasValue && evaluationStudentID != Guid.Empty)
  63. {
  64. evaluationStudentView = EvaluationStudentServices.Value.GetEvaluationStudentView(evaluationStudentID);
  65. }
  66. else
  67. {
  68. evaluationStudentView.IsValidity = true;
  69. }
  70. return View(evaluationStudentView);
  71. }
  72. /// <summary>
  73. /// 编辑
  74. /// </summary>
  75. /// <param name="evaluationStudentView"></param>
  76. /// <returns></returns>
  77. [HttpPost]
  78. public ActionResult Edit(EvaluationStudentView evaluationStudentView)
  79. {
  80. try
  81. {
  82. EvaluationStudentServices.Value.EvaluationStudentEdit(evaluationStudentView);
  83. return Json(new ReturnMessage()
  84. {
  85. IsSuccess = true,
  86. Message = "保存成功。"
  87. });
  88. }
  89. catch (Exception ex)
  90. {
  91. return Json(new ReturnMessage()
  92. {
  93. IsSuccess = false,
  94. Message = "保存失败,原因:" + ex.Message
  95. });
  96. }
  97. }
  98. /// <summary>
  99. /// 删除
  100. /// </summary>
  101. /// <param name="evaluationStudentIDs"></param>
  102. /// <returns></returns>
  103. [HttpPost]
  104. public ActionResult Delete(string evaluationStudentIDs)
  105. {
  106. try
  107. {
  108. List<Guid?> list = evaluationStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  109. EvaluationStudentServices.Value.EvaluationStudentDelete(list);
  110. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  111. }
  112. catch (Exception ex)
  113. {
  114. return base.Json(new ReturnMessage() { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
  115. }
  116. }
  117. /// <summary>
  118. /// Excel导出
  119. /// </summary>
  120. /// <returns></returns>
  121. [HttpPost]
  122. public ActionResult Excel()
  123. {
  124. NpoiExcelHelper neh = new NpoiExcelHelper();
  125. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  126. var schoolyearID = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  127. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  128. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  129. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  130. var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
  131. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  132. var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo<int>();
  133. var staffID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
  134. var teachingMethodID = Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>();
  135. var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo<Guid>();
  136. int? isValidity = Request["IsValidityDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["IsValidityDropdown"].ParseStrTo<int>();
  137. var inschoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  138. var dt = EvaluationStudentServices.Value.GetEvaluationStudentViewList(configuretView, schoolyearID, campusID, collegeID, departmentID,
  139. coursematerialID, courseTypeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, isValidity, inschoolStatus)
  140. .Select(x => new
  141. {
  142. x.StudentNo,
  143. x.Name,
  144. x.SexName,
  145. x.ClassmajorNo,
  146. x.ClassmajorName,
  147. x.CollegeNo,
  148. x.CollegeName,
  149. x.CampusNo,
  150. x.CampusName,
  151. x.InSchoolStatusName,
  152. x.SchoolyearCode,
  153. x.MissionName,
  154. x.MissionClassName,
  155. x.CourseCode,
  156. x.CourseName,
  157. x.CourseStructureName,
  158. x.CourseCategoryName,
  159. x.CourseTypeName,
  160. x.CourseQualityName,
  161. Credit = x.Credit.HasValue ? x.Credit.Value.ToString("#.#") : null,
  162. x.DepartmentNo,
  163. x.DepartmentName,
  164. x.HandleModeName,
  165. x.TeachingModeName,
  166. x.MissionClassStatusName,
  167. x.EvaluationTableCode,
  168. x.EvaluationTableName,
  169. x.ParticipateTypeName,
  170. x.EvaluationTypeCode,
  171. x.EvaluationTypeName,
  172. x.StaffCode,
  173. x.StaffName,
  174. x.TitleName,
  175. x.TeachingMethodName,
  176. x.OpenStateName,
  177. x.Number,
  178. x.Numbered,
  179. x.IsValidityName,
  180. x.ProjectCount,
  181. x.TotalScore,
  182. x.Advice,
  183. x.Remark
  184. }).ToTable();
  185. string[] liststring = {
  186. "学号", "姓名", "性别", "班级编号", "班级名称", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("CampusName"),
  187. "在校状态", "学年学期", "任务名称", "任务班名称", "课程代码", "课程名称", "课程结构", "课程属性", "课程类型", "课程性质",
  188. "课程学分", "开课教研室代码", "开课教研室", "处理方式", "授课方式", "任务状态", "评价表编号", "评价表名", "参评类型", "评价类型编号",
  189. "评价类型", "教师工号", "任课教师", "职称", "任课方式", "开放状态", "可评次数", "已评次数", "是否有效", "项目数", "总分", "评语建议", "备注"
  190. };
  191. var title = "学评明细信息";
  192. if (inschoolStatus == (int)CF_YesOrNoStatus.No)
  193. {
  194. title = "学评明细信息(非在校)";
  195. }
  196. if (inschoolStatus == (int)CF_YesOrNoStatus.Yes)
  197. {
  198. title = "学评明细信息(在校)";
  199. }
  200. neh.Export(dt, liststring, title + DateTime.Now.ToString("yyyyMMdd"));
  201. return Json(new ReturnMessage()
  202. {
  203. IsSuccess = true,
  204. Message = "导出成功。"
  205. });
  206. }
  207. }
  208. }