EvaluationStaffScoreController.cs 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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.EvaluationResult;
  14. using EMIS.CommonLogic.EvaluationManage.EvaluationResult;
  15. namespace EMIS.Web.Controllers.EvaluationManage.EvaluationResult
  16. {
  17. [Authorization]
  18. public class EvaluationStaffScoreController : Controller
  19. {
  20. public Lazy<IEvaluationStaffScoreServices> EvaluationStaffScoreServices { 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 userID = pararms.getExtraGuid("StaffComboGrid");
  43. var incumbencyState = pararms.getExtraInt("DictionaryIncumbencyState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIncumbencyState");
  44. var coursematerialID = pararms.getExtraGuid("CourseComboGrid");
  45. return base.Json(EvaluationStaffScoreServices.Value.GetEvaluationStaffScoreViewGrid(configuretView, schoolyearID, campusID, collegeID,
  46. departmentID, userID, incumbencyState, coursematerialID, (int)pararms.page, (int)pararms.rows));
  47. }
  48. /// <summary>
  49. /// 评分生成
  50. /// </summary>
  51. /// <returns></returns>
  52. public ActionResult Create()
  53. {
  54. return View();
  55. }
  56. /// <summary>
  57. /// 评分生成
  58. /// </summary>
  59. /// <param name="evaluationStaffScoreView"></param>
  60. /// <returns></returns>
  61. [HttpPost]
  62. public ActionResult Create(EvaluationStaffScoreView evaluationStaffScoreView)
  63. {
  64. try
  65. {
  66. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  67. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  68. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  69. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  70. var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
  71. var userID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
  72. string result = EvaluationStaffScoreServices.Value.EvaluationStaffScoreCreate(campusID, collegeID, departmentID, coursematerialID, userID, evaluationStaffScoreView.SchoolyearID);
  73. return Json(new ReturnMessage()
  74. {
  75. IsSuccess = true,
  76. Message = "生成成功" + result + "。"
  77. });
  78. }
  79. catch (Exception ex)
  80. {
  81. return Json(new ReturnMessage()
  82. {
  83. IsSuccess = false,
  84. Message = "生成失败,原因:" + ex.Message
  85. });
  86. }
  87. }
  88. /// <summary>
  89. /// 复制新增
  90. /// </summary>
  91. /// <param name="evaluationStaffScoreID"></param>
  92. /// <returns></returns>
  93. public ActionResult CopyAdd(Guid evaluationStaffScoreID)
  94. {
  95. var evaluationStaffScoreView = new EvaluationStaffScoreView();
  96. evaluationStaffScoreView = EvaluationStaffScoreServices.Value.GetEvaluationStaffScoreView(evaluationStaffScoreID);
  97. return View("Edit", evaluationStaffScoreView);
  98. }
  99. /// <summary>
  100. /// 复制新增
  101. /// </summary>
  102. /// <param name="evaluationStaffScoreView"></param>
  103. /// <returns></returns>
  104. [HttpPost]
  105. public ActionResult CopyAdd(EvaluationStaffScoreView evaluationStaffScoreView)
  106. {
  107. evaluationStaffScoreView.EvaluationStaffScoreID = Guid.Empty;
  108. return this.Edit(evaluationStaffScoreView);
  109. }
  110. /// <summary>
  111. /// 编辑(新增、修改)
  112. /// </summary>
  113. /// <param name="evaluationStaffScoreID"></param>
  114. /// <returns></returns>
  115. [HttpGet]
  116. public ActionResult Edit(Guid? evaluationStaffScoreID)
  117. {
  118. var evaluationStaffScoreView = new EvaluationStaffScoreView();
  119. if (evaluationStaffScoreID.HasValue && evaluationStaffScoreID != Guid.Empty)
  120. {
  121. evaluationStaffScoreView = EvaluationStaffScoreServices.Value.GetEvaluationStaffScoreView(evaluationStaffScoreID);
  122. }
  123. return View(evaluationStaffScoreView);
  124. }
  125. /// <summary>
  126. /// 编辑(新增、修改)
  127. /// </summary>
  128. /// <param name="evaluationStaffScoreView"></param>
  129. /// <returns></returns>
  130. [HttpPost]
  131. public ActionResult Edit(EvaluationStaffScoreView evaluationStaffScoreView)
  132. {
  133. try
  134. {
  135. EvaluationStaffScoreServices.Value.EvaluationStaffScoreEdit(evaluationStaffScoreView);
  136. return Json(new ReturnMessage()
  137. {
  138. IsSuccess = true,
  139. Message = "保存成功。"
  140. });
  141. }
  142. catch (Exception ex)
  143. {
  144. return Json(new ReturnMessage()
  145. {
  146. IsSuccess = false,
  147. Message = "保存失败,原因:" + ex.Message
  148. });
  149. }
  150. }
  151. /// <summary>
  152. /// 删除
  153. /// </summary>
  154. /// <param name="evaluationStaffScoreIDs"></param>
  155. /// <returns></returns>
  156. [HttpPost]
  157. public ActionResult Delete(string evaluationStaffScoreIDs)
  158. {
  159. try
  160. {
  161. List<Guid?> list = evaluationStaffScoreIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  162. EvaluationStaffScoreServices.Value.EvaluationStaffScoreDelete(list);
  163. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  164. }
  165. catch (Exception ex)
  166. {
  167. return base.Json(new ReturnMessage() { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
  168. }
  169. }
  170. /// <summary>
  171. /// Excel导出
  172. /// </summary>
  173. /// <returns></returns>
  174. [HttpPost]
  175. public ActionResult Excel()
  176. {
  177. NpoiExcelHelper neh = new NpoiExcelHelper();
  178. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  179. var schoolyearID = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  180. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  181. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  182. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  183. var userID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
  184. var incumbencyState = Request.Form["DictionaryIncumbencyState"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIncumbencyState"].ParseStrTo<int>();
  185. var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
  186. var dt = EvaluationStaffScoreServices.Value.GetEvaluationStaffScoreViewList(configuretView, schoolyearID, campusID, collegeID, departmentID, userID, incumbencyState, coursematerialID)
  187. .Select(x => new
  188. {
  189. x.SchoolyearCode,
  190. x.StaffCode,
  191. x.StaffName,
  192. x.SexName,
  193. x.TeacherTypeName,
  194. x.IncumbencyStateName,
  195. x.TitleName,
  196. x.CourseCode,
  197. x.CourseName,
  198. x.DepartmentNo,
  199. x.DepartmentName,
  200. x.CollegeNo,
  201. x.CollegeName,
  202. x.CampusNo,
  203. x.CampusName,
  204. x.StudentScore,
  205. x.CollegeScore,
  206. x.TotalScore,
  207. x.Remark,
  208. ModifyTime = x.ModifyTime == null ? null : x.ModifyTime.Value.ToString("yyyy-MM-dd HH:mm:ss")
  209. }).ToTable();
  210. string[] liststring = {
  211. "学年学期", "教师工号", "任课教师", "性别", "教师类型", "在职状态", "职称", "课程代码", "课程名称", "所属教研室代码",
  212. "所属教研室", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("CampusName"),
  213. RSL.Get("EvaluationStudentScore"), RSL.Get("EvaluationCollegeScore"), "总评分", "备注", "修改时间"
  214. };
  215. neh.Export(dt, liststring, "教师评分信息" + DateTime.Now.ToString("yyyyMMdd"));
  216. return Json(new ReturnMessage()
  217. {
  218. IsSuccess = true,
  219. Message = "导出成功。"
  220. });
  221. }
  222. }
  223. }