You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Eval_MainController.cs 9.2 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. using System;
  2. using Learun.Util;
  3. using System.Data;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using Learun.Application.TwoDevelopment.EducationalAdministration;
  7. using Learun.Application.TwoDevelopment.EvaluationTeach;
  8. using System.Linq;
  9. namespace Learun.Application.Web.Areas.EvaluationTeach.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  13. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2019-04-23 15:50
  16. /// 描 述:问卷管理
  17. /// </summary>
  18. public class Eval_MainController : MvcControllerBase
  19. {
  20. private Eval_MainIBLL ask_MainIBLL = new Eval_MainBLL();
  21. private EmpInfoIBLL empInfoIbll = new EmpInfoBLL();
  22. private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL();
  23. private LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL();
  24. #region 视图功能
  25. /// <summary>
  26. /// 主页面
  27. /// <summary>
  28. /// <returns></returns>
  29. [HttpGet]
  30. public ActionResult Index()
  31. {
  32. return View();
  33. }
  34. [HttpGet]
  35. public ActionResult AnswerIndex()
  36. {
  37. return View();
  38. }
  39. [HttpGet]
  40. public ActionResult TeacherIndex()
  41. {
  42. return View();
  43. }
  44. [HttpGet]
  45. public ActionResult TeacherIndex2()
  46. {
  47. return View();
  48. }
  49. [HttpGet]
  50. public ActionResult StudentIndex()
  51. {
  52. var logininfo = LoginUserInfo.Get();
  53. ViewBag.StuNo = logininfo.account;
  54. ViewBag.StuName = logininfo.realName;
  55. var yearsemester = Common.GetSemesterAndYear();
  56. ViewBag.AcademicYearNo = yearsemester.AcademicYearShort;
  57. ViewBag.Semester = yearsemester.Semester;
  58. return View();
  59. }
  60. [HttpGet]
  61. public ActionResult AnswerQuery()
  62. {
  63. return View();
  64. }
  65. [HttpGet]
  66. public ActionResult Paper(string VID)
  67. {
  68. ViewBag.StuNo = LoginUserInfo.Get().account;
  69. ViewBag.StuName = LoginUserInfo.Get().realName;
  70. if (!string.IsNullOrEmpty(VID))
  71. {
  72. var Eval_Main = ask_MainIBLL.GetEval_MainEntityAndQuestions(VID);
  73. return View(Eval_Main);
  74. }
  75. else
  76. {
  77. return View();
  78. }
  79. }
  80. [HttpGet]
  81. public ActionResult PaperAdminView(string VID)
  82. {
  83. ViewBag.StuNo = LoginUserInfo.Get().account;
  84. ViewBag.StuName = LoginUserInfo.Get().realName;
  85. if (!string.IsNullOrEmpty(VID))
  86. {
  87. var Eval_Main = ask_MainIBLL.GetEval_MainEntityAndQuestions(VID);
  88. return View(Eval_Main);
  89. }
  90. else
  91. {
  92. return View();
  93. }
  94. }
  95. [HttpGet]
  96. public ActionResult PaperView(string VID, string StuNo, string EmpNo, string LessonNo)
  97. {
  98. if (!string.IsNullOrEmpty(VID))
  99. {
  100. var Eval_Main = ask_MainIBLL.GetEval_MainEntityAndQuestionsResult(VID, StuNo, EmpNo, LessonNo);
  101. Eval_Main.StuName = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(StuNo).StuName;
  102. Eval_Main.EmpName = empInfoIbll.GetEmpInfoEntityByEmpNo(EmpNo).EmpName;
  103. Eval_Main.LessonName = lessonInfoIbll.GetLessonInfoEntityByLessonNo(LessonNo).LessonName;
  104. return View(Eval_Main);
  105. }
  106. else
  107. {
  108. return View();
  109. }
  110. }
  111. /// <summary>
  112. /// 表单页
  113. /// <summary>
  114. /// <returns></returns>
  115. [HttpGet]
  116. public ActionResult Form()
  117. {
  118. ViewBag.VSerial = "EvaluationTeach_" + CommonHelper.CreateNo();
  119. return View();
  120. }
  121. #endregion
  122. #region 获取数据
  123. [HttpGet]
  124. public ActionResult GenerateNearByAcademic()
  125. {
  126. return Success(Learun.Util.WebHelper.GenerateNearByAcademic());
  127. }
  128. /// <summary>
  129. /// 获取页面显示列表数据
  130. /// <summary>
  131. /// <param name="queryJson">查询参数</param>
  132. /// <returns></returns>
  133. [HttpGet]
  134. [AjaxOnly]
  135. public ActionResult GetPageList(string pagination, string queryJson)
  136. {
  137. Pagination paginationobj = pagination.ToObject<Pagination>();
  138. var data = ask_MainIBLL.GetPageList(paginationobj, queryJson);
  139. var jsonData = new
  140. {
  141. rows = data,
  142. total = paginationobj.total,
  143. page = paginationobj.page,
  144. records = paginationobj.records
  145. };
  146. return Success(jsonData);
  147. }
  148. [HttpGet]
  149. [AjaxOnly]
  150. public ActionResult GetStudentPageList(string pagination, string queryJson)
  151. {
  152. var data = ask_MainIBLL.GetStudentPageList(null, queryJson);
  153. return Success(data);
  154. }
  155. [HttpGet]
  156. [AjaxOnly]
  157. public ActionResult GetAnswerPageList(string pagination, string queryJson)
  158. {
  159. Pagination paginationobj = pagination.ToObject<Pagination>();
  160. var data = ask_MainIBLL.GetAnswerPageList(paginationobj, queryJson);
  161. var jsonData = new
  162. {
  163. rows = data,
  164. total = paginationobj.total,
  165. page = paginationobj.page,
  166. records = paginationobj.records
  167. };
  168. return Success(jsonData);
  169. }
  170. [HttpGet]
  171. [AjaxOnly]
  172. public ActionResult GetTeacherIndexPageList(string pagination, string queryJson)
  173. {
  174. var data = ask_MainIBLL.GetTeacherIndexPageList(null, queryJson);
  175. return Success(data);
  176. }
  177. [HttpGet]
  178. [AjaxOnly]
  179. public ActionResult GetTeacherIndexPageList2(string pagination, string queryJson)
  180. {
  181. var data = ask_MainIBLL.GetTeacherIndexPageList(null, queryJson);
  182. var data2 = data.GroupBy(x => x.EmpNo).Select(x => new Eval_QuestionResultEntity()
  183. {
  184. EmpNo = x.Key,
  185. EmpName = x.Select(y => y.EmpName).FirstOrDefault(),
  186. LessonNo = String.Join(",", x.Select(y => y.LessonNo).ToArray()),
  187. StudentCount = x.Select(y => y.StudentCount).Sum(),
  188. EvalCount = x.Select(y => y.EvalCount).Sum(),
  189. AverageScore = x.Select(y => y.AverageScore).Sum()
  190. });
  191. return Success(data2);
  192. }
  193. /// <summary>
  194. /// 获取表单数据
  195. /// <summary>
  196. /// <returns></returns>
  197. [HttpGet]
  198. [AjaxOnly]
  199. public ActionResult GetFormData(string keyValue)
  200. {
  201. var Eval_MainData = ask_MainIBLL.GetEval_MainEntity(keyValue);
  202. var jsonData = new
  203. {
  204. Eval_Main = Eval_MainData,
  205. };
  206. return Success(jsonData);
  207. }
  208. #endregion
  209. #region 提交数据
  210. /// <summary>
  211. /// 删除实体数据
  212. /// <param name="keyValue">主键</param>
  213. /// <summary>
  214. /// <returns></returns>
  215. [HttpPost]
  216. [AjaxOnly]
  217. public ActionResult DeleteForm(string keyValue)
  218. {
  219. ask_MainIBLL.DeleteEntity(keyValue);
  220. return Success("删除成功!");
  221. }
  222. [HttpPost]
  223. [AjaxOnly]
  224. public ActionResult SubmitForm(string keyValue)
  225. {
  226. ask_MainIBLL.ChangeFormStatus(keyValue, true);
  227. return Success("操作成功!");
  228. }
  229. [HttpPost]
  230. [AjaxOnly]
  231. public ActionResult UnSubmitForm(string keyValue)
  232. {
  233. ask_MainIBLL.ChangeFormStatus(keyValue, false);
  234. return Success("操作成功!");
  235. }
  236. /// <summary>
  237. /// 保存实体数据(新增、修改)
  238. /// <param name="keyValue">主键</param>
  239. /// <summary>
  240. /// <returns></returns>
  241. [HttpPost]
  242. [ValidateAntiForgeryToken]
  243. [AjaxOnly]
  244. public ActionResult SaveForm(string keyValue, string strEntity)
  245. {
  246. var userinfo = LoginUserInfo.Get();
  247. Eval_MainEntity entity = strEntity.ToObject<Eval_MainEntity>();
  248. entity.UID = userinfo.userId;
  249. entity.UName = userinfo.realName;
  250. entity.VCreateTime = DateTime.Now;
  251. entity.Status = false;
  252. ask_MainIBLL.SaveEntity(keyValue, entity);
  253. return Success("保存成功!");
  254. }
  255. [HttpPost]
  256. [ValidateAntiForgeryToken]
  257. [AjaxOnly]
  258. [ValidateInput(false)]
  259. public ActionResult StudentSubmitForm(string answerlist, string VID, string LessonNo, string EmpNo)
  260. {
  261. var userinfo = LoginUserInfo.Get();
  262. List<Eval_QuestionResultEntity> entity = answerlist.ToObject<List<Eval_QuestionResultEntity>>();
  263. ask_MainIBLL.SaveEval_QuestionResultEntity(entity, VID, LessonNo, EmpNo, userinfo.account, userinfo.realName, userinfo.iPAddress);
  264. return Success("保存成功!");
  265. }
  266. #endregion
  267. }
  268. }