EvaluationStudentSettingController.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  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.Common.JSON;
  10. using Bowin.Web.Controls.Mvc;
  11. using EMIS.Web.Controls;
  12. using EMIS.Utility;
  13. using EMIS.ViewModel;
  14. using EMIS.ViewModel.EvaluationManage.StudentEvaluation;
  15. using EMIS.ViewModel.EducationManage.EducationArrange;
  16. using EMIS.CommonLogic.EvaluationManage.StudentEvaluation;
  17. namespace EMIS.Web.Controllers.EvaluationManage.StudentEvaluation
  18. {
  19. [Authorization]
  20. public class EvaluationStudentSettingController : Controller
  21. {
  22. public Lazy<IEvaluationStudentSettingServices> EvaluationStudentSettingServices { get; set; }
  23. /// <summary>
  24. /// 学评设定页面
  25. /// </summary>
  26. /// <returns></returns>
  27. public ActionResult List()
  28. {
  29. return View();
  30. }
  31. /// <summary>
  32. /// 学评设定列表查询
  33. /// </summary>
  34. /// <param name="pararms"></param>
  35. /// <returns></returns>
  36. [HttpPost]
  37. public ActionResult List(QueryParamsModel pararms)
  38. {
  39. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  40. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  41. var campusID = pararms.getExtraGuid("CampusDropdown");
  42. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  43. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  44. var coursematerialID = pararms.getExtraGuid("CourseComboGrid");
  45. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  46. var handleModeID = pararms.getExtraInt("DictionaryHandleMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryHandleMode");
  47. var teachingModeID = pararms.getExtraInt("DictionaryTeachingMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMode");
  48. var staffID = pararms.getExtraGuid("StaffComboGrid");
  49. var teachingMethodID = pararms.getExtraInt("DictionaryTeachingMethod") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMethod");
  50. var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown");
  51. var openState = pararms.getExtraInt("OpenStateDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("OpenStateDropdown");
  52. return base.Json(EvaluationStudentSettingServices.Value.GetEvaluationStudentSettingViewGrid(configuretView, schoolyearID, campusID, collegeID, departmentID,
  53. coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, openState, (int)pararms.page, (int)pararms.rows));
  54. }
  55. /// <summary>
  56. /// 评价生成
  57. /// </summary>
  58. /// <returns></returns>
  59. public ActionResult Create()
  60. {
  61. return View();
  62. }
  63. /// <summary>
  64. /// 评价生成
  65. /// </summary>
  66. /// <param name="evaluationStudentSettingView"></param>
  67. /// <returns></returns>
  68. [HttpPost]
  69. public ActionResult Create(EvaluationStudentSettingView evaluationStudentSettingView)
  70. {
  71. try
  72. {
  73. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  74. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  75. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  76. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  77. var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  78. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  79. var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
  80. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  81. var handleModeID = Request.Form["DictionaryHandleMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryHandleMode"].ParseStrTo<int>();
  82. var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo<int>();
  83. var staffID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
  84. var teachingMethodID = Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>();
  85. string result = EvaluationStudentSettingServices.Value.EvaluationStudentSettingCreate(campusID, collegeID, departmentID, gradeID, standardID,
  86. coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, evaluationStudentSettingView.SchoolyearID);
  87. return Json(new ReturnMessage()
  88. {
  89. IsSuccess = true,
  90. Message = "生成成功" + result + "。"
  91. });
  92. }
  93. catch (Exception ex)
  94. {
  95. return Json(new ReturnMessage()
  96. {
  97. IsSuccess = false,
  98. Message = "生成失败,原因:" + ex.Message
  99. });
  100. }
  101. }
  102. /// <summary>
  103. /// 复制新增
  104. /// </summary>
  105. /// <param name="evaluationStudentSettingID"></param>
  106. /// <returns></returns>
  107. public ActionResult CopyAdd(Guid evaluationStudentSettingID)
  108. {
  109. var evaluationStudentSettingView = new EvaluationStudentSettingView();
  110. evaluationStudentSettingView = EvaluationStudentSettingServices.Value.GetEvaluationStudentSettingView(evaluationStudentSettingID);
  111. return View("Edit", evaluationStudentSettingView);
  112. }
  113. /// <summary>
  114. /// 复制新增
  115. /// </summary>
  116. /// <param name="evaluationStudentSettingView"></param>
  117. /// <returns></returns>
  118. [HttpPost]
  119. public ActionResult CopyAdd(EvaluationStudentSettingView evaluationStudentSettingView)
  120. {
  121. evaluationStudentSettingView.EvaluationStudentSettingID = Guid.Empty;
  122. evaluationStudentSettingView.OpenState = false;
  123. return this.Edit(evaluationStudentSettingView);
  124. }
  125. /// <summary>
  126. /// 编辑
  127. /// </summary>
  128. /// <param name="evaluationStudentSettingID"></param>
  129. /// <returns></returns>
  130. [HttpGet]
  131. public ActionResult Edit(Guid? evaluationStudentSettingID)
  132. {
  133. var evaluationStudentSettingView = new EvaluationStudentSettingView();
  134. if (evaluationStudentSettingID.HasValue && evaluationStudentSettingID != Guid.Empty)
  135. {
  136. evaluationStudentSettingView = EvaluationStudentSettingServices.Value.GetEvaluationStudentSettingView(evaluationStudentSettingID);
  137. }
  138. else
  139. {
  140. evaluationStudentSettingView.OpenState = false;
  141. }
  142. return View(evaluationStudentSettingView);
  143. }
  144. /// <summary>
  145. /// 编辑
  146. /// </summary>
  147. /// <param name="evaluationStudentSettingView"></param>
  148. /// <returns></returns>
  149. [HttpPost]
  150. public ActionResult Edit(EvaluationStudentSettingView evaluationStudentSettingView)
  151. {
  152. try
  153. {
  154. EvaluationStudentSettingServices.Value.EvaluationStudentSettingEdit(evaluationStudentSettingView);
  155. return Json(new ReturnMessage()
  156. {
  157. IsSuccess = true,
  158. Message = "保存成功。"
  159. });
  160. }
  161. catch (Exception ex)
  162. {
  163. return Json(new ReturnMessage()
  164. {
  165. IsSuccess = false,
  166. Message = "保存失败,原因:" + ex.Message
  167. });
  168. }
  169. }
  170. /// <summary>
  171. /// 批量新增
  172. /// </summary>
  173. /// <returns></returns>
  174. [HttpGet]
  175. public ActionResult EvaluationStudentSettingBatchAdd()
  176. {
  177. var evaluationStudentSettingView = new EvaluationStudentSettingView();
  178. return View(evaluationStudentSettingView);
  179. }
  180. /// <summary>
  181. /// 批量新增
  182. /// </summary>
  183. /// <param name="evaluationStudentSettingView"></param>
  184. /// <returns></returns>
  185. public ActionResult EvaluationStudentSettingBatchAdd(EvaluationStudentSettingView evaluationStudentSettingView)
  186. {
  187. try
  188. {
  189. var educationMissionClassViewList = Request["educationMissionClassViewList"].JsonToObject<List<EducationMissionClassView>>();
  190. string result = EvaluationStudentSettingServices.Value.EvaluationStudentSettingBatchAdd(educationMissionClassViewList, evaluationStudentSettingView);
  191. return Json(new ReturnMessage()
  192. {
  193. IsSuccess = true,
  194. Message = "新增成功" + result + "。"
  195. });
  196. }
  197. catch (Exception ex)
  198. {
  199. return Json(new ReturnMessage()
  200. {
  201. IsSuccess = false,
  202. Message = "新增失败,原因:" + ex.Message
  203. });
  204. }
  205. }
  206. /// <summary>
  207. /// 查询教学任务班中未新增学生评价信息EducationMissionClassView
  208. /// </summary>
  209. /// <param name="pararms"></param>
  210. /// <returns></returns>
  211. [HttpPost]
  212. public ActionResult EducationMissionClassNoAddList(QueryParamsModel pararms)
  213. {
  214. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  215. var campusID = pararms.getExtraGuid("CampusDropdown");
  216. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  217. var departmentID = pararms.getExtraGuid("DepartmentDropdown");
  218. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  219. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  220. var coursematerialID = pararms.getExtraGuid("CourseComboGrid");
  221. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  222. var handleModeID = pararms.getExtraInt("DictionaryHandleMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryHandleMode");
  223. var teachingModeID = pararms.getExtraInt("DictionaryTeachingMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMode");
  224. var staffID = pararms.getExtraGuid("StaffComboGrid");
  225. var teachingMethodID = pararms.getExtraInt("DictionaryTeachingMethod") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMethod");
  226. var schoolyearID = pararms.getExtraGuid("SchoolyearID");
  227. return base.Json(EvaluationStudentSettingServices.Value.GetEducationMissionClassViewNoAddGrid(configuretView, campusID, collegeID, departmentID,
  228. gradeID, standardID, coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, schoolyearID, (int)pararms.page, (int)pararms.rows));
  229. }
  230. /// <summary>
  231. /// 查询教学任务班中未新增学生评价信息Excel导出
  232. /// </summary>
  233. /// <returns></returns>
  234. [HttpPost]
  235. public ActionResult EducationMissionClassNoAddListExcel()
  236. {
  237. return null;
  238. }
  239. /// <summary>
  240. /// 删除
  241. /// </summary>
  242. /// <param name="evaluationStudentSettingIDs"></param>
  243. /// <returns></returns>
  244. [HttpPost]
  245. public ActionResult Delete(string evaluationStudentSettingIDs)
  246. {
  247. try
  248. {
  249. List<Guid?> list = evaluationStudentSettingIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  250. EvaluationStudentSettingServices.Value.EvaluationStudentSettingDelete(list);
  251. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  252. }
  253. catch (Exception ex)
  254. {
  255. string mge = ex.Message;
  256. System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
  257. if (num != null)
  258. {
  259. if (num.Number == 547)
  260. {
  261. mge = "请先删除所有关联的数据,如:评价记录、评价建议等。";
  262. }
  263. }
  264. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + mge });
  265. }
  266. }
  267. /// <summary>
  268. /// 对应的学生信息页面
  269. /// </summary>
  270. /// <returns></returns>
  271. public ActionResult EvaluationStudentList()
  272. {
  273. return View();
  274. }
  275. /// <summary>
  276. /// 对应的学生信息列表查询
  277. /// </summary>
  278. /// <param name="pararms"></param>
  279. /// <returns></returns>
  280. [HttpPost]
  281. public ActionResult EvaluationStudentList(QueryParamsModel pararms)
  282. {
  283. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  284. var evaluationStudentSettingID = Request["evaluationStudentSettingID"].ParseStrTo<Guid>();
  285. var isEvaluation = pararms.getExtraInt("IsEvaluationDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsEvaluationDropdown");
  286. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  287. return Json(EvaluationStudentSettingServices.Value.GetEvaluationStudentSettingDetailViewGrid(configuretView, evaluationStudentSettingID, isEvaluation, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  288. }
  289. /// <summary>
  290. /// 对应的学生信息Excel导出
  291. /// </summary>
  292. /// <returns></returns>
  293. [HttpPost]
  294. public ActionResult EvaluationStudentListExcel()
  295. {
  296. NpoiExcelHelper neh = new NpoiExcelHelper();
  297. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  298. var evaluationStudentSettingID = Request["evaluationStudentSettingID"].ParseStrTo<Guid>();
  299. int? isEvaluation = Request["IsEvaluationDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["IsEvaluationDropdown"].ParseStrTo<int>();
  300. int? inSchoolStatus = Request["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["DictionaryInschoolStatus"].ParseStrTo<int>();
  301. var dt = EvaluationStudentSettingServices.Value.GetEvaluationStudentSettingDetailViewList(configuretView, evaluationStudentSettingID, isEvaluation, inSchoolStatus)
  302. .Select(x => new
  303. {
  304. x.StudentNo,
  305. x.Name,
  306. x.SexName,
  307. x.ClassmajorNo,
  308. x.ClassmajorName,
  309. x.CollegeNo,
  310. x.CollegeName,
  311. x.CampusNo,
  312. x.CampusName,
  313. x.InSchoolStatusName,
  314. x.SchoolyearCode,
  315. x.MissionName,
  316. x.MissionClassName,
  317. x.CourseCode,
  318. x.CourseName,
  319. x.CourseStructureName,
  320. x.CourseCategoryName,
  321. x.CourseTypeName,
  322. x.CourseQualityName,
  323. Credit = x.Credit.HasValue ? x.Credit.Value.ToString("#.#") : null,
  324. x.DepartmentNo,
  325. x.DepartmentName,
  326. x.HandleModeName,
  327. x.TeachingModeName,
  328. x.MissionClassStatusName,
  329. x.EvaluationTableCode,
  330. x.EvaluationTableName,
  331. x.ParticipateTypeName,
  332. x.EvaluationTypeCode,
  333. x.EvaluationTypeName,
  334. x.StaffCode,
  335. x.StaffName,
  336. x.TitleName,
  337. x.TeachingMethodName,
  338. x.OpenStateName,
  339. x.IsEvaluationName
  340. }).ToTable();
  341. string[] liststring = {
  342. "学号", "姓名", "性别", "班级编号", "班级名称", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("CampusName"),
  343. "在校状态", "学年学期", "任务名称", "任务班名称", "课程代码", "课程名称", "课程结构", "课程属性", "课程类型", "课程性质",
  344. "课程学分", "开课教研室代码", "开课教研室", "处理方式", "授课方式", "任务状态", "评价表编号", "评价表名", "参评类型", "评价类型编号",
  345. "评价类型", "教师工号", "任课教师", "职称", "任课方式", "开放状态", "评价状态"
  346. };
  347. var title = "参评人数明细信息";
  348. if (isEvaluation == (int)CF_GeneralPurpose.IsNo)
  349. {
  350. title = "参评人数明细信息(未评)";
  351. }
  352. if (isEvaluation == (int)CF_GeneralPurpose.IsYes)
  353. {
  354. title = "参评人数明细信息(已评)";
  355. }
  356. neh.Export(dt, liststring, title + DateTime.Now.ToString("yyyyMMdd"));
  357. return Json(new ReturnMessage()
  358. {
  359. IsSuccess = true,
  360. Message = "导出成功。"
  361. });
  362. }
  363. /// <summary>
  364. /// 编辑学生
  365. /// </summary>
  366. /// <param name="evaluationStudentSettingID"></param>
  367. /// <returns></returns>
  368. public ActionResult EvaluationStudentEdit(Guid? evaluationStudentSettingID)
  369. {
  370. var evaluationStudentSettingDetailView = new EvaluationStudentSettingDetailView();
  371. if (evaluationStudentSettingID.HasValue && evaluationStudentSettingID != Guid.Empty)
  372. {
  373. var evaluationStudentSettingView = EvaluationStudentSettingServices.Value.GetEvaluationStudentSettingView(evaluationStudentSettingID);
  374. evaluationStudentSettingDetailView.EvaluationStudentSettingID = evaluationStudentSettingView.EvaluationStudentSettingID;
  375. evaluationStudentSettingDetailView.EducationMissionClassID = evaluationStudentSettingView.EducationMissionClassID;
  376. evaluationStudentSettingDetailView.MissionClassName = evaluationStudentSettingView.MissionClassName;
  377. evaluationStudentSettingDetailView.SchoolyearID = evaluationStudentSettingView.SchoolyearID;
  378. evaluationStudentSettingDetailView.CollegeID = evaluationStudentSettingView.CollegeID;
  379. evaluationStudentSettingDetailView.CoursematerialID = evaluationStudentSettingView.CoursematerialID;
  380. evaluationStudentSettingDetailView.DepartmentID = evaluationStudentSettingView.DepartmentID;
  381. evaluationStudentSettingDetailView.CourseTypeID = evaluationStudentSettingView.CourseTypeID;
  382. evaluationStudentSettingDetailView.TeachingModeID = evaluationStudentSettingView.TeachingModeID;
  383. }
  384. else
  385. {
  386. evaluationStudentSettingDetailView.EvaluationStudentSettingID = evaluationStudentSettingID.Value;
  387. }
  388. return View(evaluationStudentSettingDetailView);
  389. }
  390. /// <summary>
  391. /// 编辑学生
  392. /// </summary>
  393. /// <param name="evaluationStudentSettingDetailView"></param>
  394. /// <returns></returns>
  395. [HttpPost]
  396. public ActionResult EvaluationStudentEdit(Guid? evaluationStudentSettingID, Guid? userID)
  397. {
  398. try
  399. {
  400. EvaluationStudentSettingServices.Value.EvaluationStudentEdit(evaluationStudentSettingID, userID);
  401. return Json(new ReturnMessage()
  402. {
  403. IsSuccess = true,
  404. Message = "保存成功。"
  405. });
  406. }
  407. catch (Exception ex)
  408. {
  409. return Json(new ReturnMessage()
  410. {
  411. IsSuccess = false,
  412. Message = "保存失败,原因:" + ex.Message
  413. });
  414. }
  415. }
  416. /// <summary>
  417. /// 删除学生
  418. /// </summary>
  419. /// <param name="evaluationStudentSettingID"></param>
  420. /// <param name="userIDs"></param>
  421. /// <returns></returns>
  422. [HttpPost]
  423. public ActionResult EvaluationStudentDelete(Guid? evaluationStudentSettingID, string userIDs)
  424. {
  425. try
  426. {
  427. List<Guid?> list = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  428. EvaluationStudentSettingServices.Value.EvaluationStudentDelete(evaluationStudentSettingID, list);
  429. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  430. }
  431. catch (Exception ex)
  432. {
  433. return base.Json(new ReturnMessage() { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
  434. }
  435. }
  436. /// <summary>
  437. /// 取消
  438. /// </summary>
  439. /// <param name="evaluationStudentSettingIDs"></param>
  440. /// <returns></returns>
  441. [HttpPost]
  442. public ActionResult Cancel(string evaluationStudentSettingIDs)
  443. {
  444. try
  445. {
  446. List<Guid?> list = evaluationStudentSettingIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  447. EvaluationStudentSettingServices.Value.EvaluationStudentSettingCancel(list);
  448. return base.Json(new ReturnMessage { IsSuccess = true, Message = "取消评价成功。" });
  449. }
  450. catch (Exception ex)
  451. {
  452. return base.Json(new ReturnMessage() { IsSuccess = false, Message = "取消评价失败,原因:" + ex.Message });
  453. }
  454. }
  455. /// <summary>
  456. /// 开放
  457. /// </summary>
  458. /// <param name="evaluationStudentSettingIDs"></param>
  459. /// <returns></returns>
  460. [HttpPost]
  461. public ActionResult Open(string evaluationStudentSettingIDs)
  462. {
  463. try
  464. {
  465. List<Guid?> list = evaluationStudentSettingIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  466. EvaluationStudentSettingServices.Value.EvaluationStudentSettingOpen(list);
  467. return base.Json(new ReturnMessage { IsSuccess = true, Message = "开放评价成功。" });
  468. }
  469. catch (Exception ex)
  470. {
  471. return base.Json(new ReturnMessage() { IsSuccess = false, Message = "开放评价失败,原因:" + ex.Message });
  472. }
  473. }
  474. /// <summary>
  475. /// Excel导出
  476. /// </summary>
  477. /// <returns></returns>
  478. [HttpPost]
  479. public ActionResult Excel()
  480. {
  481. NpoiExcelHelper neh = new NpoiExcelHelper();
  482. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  483. var schoolyearID = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  484. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  485. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  486. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
  487. var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
  488. var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
  489. var handleModeID = Request.Form["DictionaryHandleMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryHandleMode"].ParseStrTo<int>();
  490. var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo<int>();
  491. var staffID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
  492. var teachingMethodID = Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>();
  493. var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo<Guid>();
  494. var openState = Request.Form["OpenStateDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["OpenStateDropdown"].ParseStrTo<int>();
  495. var dt = EvaluationStudentSettingServices.Value.GetEvaluationStudentSettingViewList(configuretView, schoolyearID, campusID, collegeID, departmentID,
  496. coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, openState)
  497. .Select(x => new
  498. {
  499. x.SchoolyearCode,
  500. x.MissionName,
  501. x.MissionClassName,
  502. x.CollegeNo,
  503. x.CollegeName,
  504. x.CampusNo,
  505. x.CampusName,
  506. x.CourseCode,
  507. x.CourseName,
  508. x.CourseStructureName,
  509. x.CourseCategoryName,
  510. x.CourseTypeName,
  511. x.CourseQualityName,
  512. Credit = x.Credit.HasValue ? x.Credit.Value.ToString("#.#") : null,
  513. x.DepartmentNo,
  514. x.DepartmentName,
  515. x.HandleModeName,
  516. x.TeachingModeName,
  517. x.MissionClassStatusName,
  518. x.EvaluationTableCode,
  519. x.EvaluationTableName,
  520. x.ParticipateTypeName,
  521. x.EvaluationTypeCode,
  522. x.EvaluationTypeName,
  523. x.StaffCode,
  524. x.StaffName,
  525. x.TitleName,
  526. x.TeachingMethodName,
  527. x.ParticipateCount,
  528. x.NoParticipateCount,
  529. x.ValidityParticipateCount,
  530. ValidityParticipateRate = x.ValidityParticipateRate.HasValue ? x.ValidityParticipateRate.Value.ToString("#.#") : "0",
  531. x.OpenStateName,
  532. x.Remark
  533. }).ToTable();
  534. string[] liststring = {
  535. "学年学期", "任务名称", "任务班名称", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("CampusName"),
  536. "课程代码", "课程名称", "课程结构", "课程属性", "课程类型", "课程性质", "课程学分", "开课教研室代码", "开课教研室",
  537. "处理方式", "授课方式", "任务状态", "评价表编号", "评价表名", "参评类型", "评价类型编号", "评价类型", "教师工号",
  538. "任课教师", "职称", "任课方式", "参评人数", "未评人数", "有效评数", "有效评率%", "开放状态", "备注"
  539. };
  540. neh.Export(dt, liststring, "学评设定信息" + DateTime.Now.ToString("yyyyMMdd"));
  541. return Json(new ReturnMessage()
  542. {
  543. IsSuccess = true,
  544. Message = "导出成功。"
  545. });
  546. }
  547. }
  548. }