EvaluationAdviseController.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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.Exceptions;
  7. using Bowin.Common.Utility;
  8. using Bowin.Web.Controls.Mvc;
  9. using EMIS.CommonLogic.EvaluationManage;
  10. using EMIS.ViewModel;
  11. using EMIS.ViewModel.EvaluationManage;
  12. using EMIS.Web.Controls;
  13. using Bowin.Common.Data;
  14. using EMIS.CommonLogic.CalendarManage;
  15. using EMIS.CommonLogic.EducationManagement;
  16. using EMIS.ViewModel.EvaluationManage.EvaluationEnter;
  17. using System.Text;
  18. using System.Collections;
  19. using EMIS.Utility;
  20. using Bowin.Common.JSON;
  21. using EMIS.Entities;
  22. using System.Text.RegularExpressions;
  23. using EMIS.Utility.FormValidate;
  24. namespace EMIS.Web.Controllers.EvaluationManage.EvaluationAdvise
  25. {
  26. [Authorization]
  27. public class EvaluationAdviseController : Controller
  28. {
  29. public IEvaluationRecordServices EvaluationRecordServices { get; set; }
  30. public IEvaluationAdviseServices EvaluationAdviseServices { get; set; }
  31. public IEvaluationEnterServices EvaluationEnterServices { get; set; }
  32. public IEvaluationTargetServices EvaluationTargetServices { get; set; }
  33. public IEvaluationProjectServices EvaluationProjectServices { get; set; }
  34. public IEvaluationTableServices EvaluationTableServices { get; set; }
  35. public IEvaluationNormServices EvaluationNormServices { get; set; }
  36. //public IEvaluationNeedServices EvaluationNeedServices { get; set; }
  37. public IEvaluationTypeServices EvaluationTypeServices { get; set; }
  38. public IEvaluationSettingServices EvaluationSettingServices { get; set; }
  39. public ISchoolYearServices SchoolYearServices { get; set; }
  40. Guid? educationMissionID = Guid.Empty;
  41. /// <summary>
  42. /// 评语建议页面
  43. /// </summary>
  44. /// <returns></returns>
  45. [HttpGet]
  46. public ActionResult List()
  47. {
  48. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  49. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();
  50. return View();
  51. }
  52. [HttpPost]
  53. public ActionResult List(QueryParamsModel pararms)
  54. {
  55. var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期
  56. var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown"); //评价表
  57. var evaluationTypeID = pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型
  58. var collegeID = pararms.getExtraGuid("CollegeDropdown");//院系所
  59. var departmentID = pararms.getExtraGuid("DepartmentDropdown");//教研室
  60. var staffID = pararms.getExtraGuid("StaffDropdown");//教师
  61. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  62. var result = EvaluationAdviseServices.GetEvaluationAdviseViewGrid(configuretView, schoolYearID, collegeID, departmentID, evaluationTableID, evaluationTypeID, staffID, (int)pararms.page, (int)pararms.rows);//, collegeID, departmentID
  63. return Json(result);
  64. }
  65. /// <summary>
  66. /// Excel导出
  67. /// </summary>
  68. /// <returns></returns>
  69. [HttpPost]
  70. public ActionResult Excel()
  71. {
  72. try
  73. {
  74. NpoiExcelHelper neh = new NpoiExcelHelper();
  75. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  76. var schoolYearID = Request.Form["SchoolyearDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>(); //学年学期
  77. var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EvaluationTableDropdown"].ParseStrTo<Guid>();//pararms.getExtraGuid("EvaluationTableDropdown"); //评价表
  78. var evaluationTypeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["EvaluationTypeDropdown"].ParseStrTo<Guid>();//pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型
  79. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["CollegeDropdown"].ParseStrTo<Guid>();//pararms.getExtraGuid("CollegeDropdown");//院系所
  80. var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();//pararms.getExtraGuid("DepartmentDropdown");//教研室
  81. var staffID = Request.Form["StaffDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StaffDropdown"].ParseStrTo<Guid>();//pararms.getExtraGuid("StaffDropdown");//教师
  82. var dt = EvaluationAdviseServices.GetEvaluationAdviseViewList(configuretView, schoolYearID, collegeID, departmentID, evaluationTableID, evaluationTypeID, staffID).Select(x => new
  83. {
  84. x.UserCodes,
  85. x.UserNames,
  86. x.CourseName,
  87. x.EducationMissionClassName,
  88. x.EvaluationTypeName,
  89. x.EvaluationTableName,
  90. x.Remark
  91. }).ToTable();
  92. string[] liststring = { "教师编号", "教师名称", "课程名称", "任务班名称", "参评类型", "评价表名", "评语建议" };
  93. //string[] liststring = { "评价编号", "课程名称", "评价类型 ", "被评教师号", "被评教师", "任务班名称", "参评类型 ", "已评次数" };
  94. neh.Export(dt, liststring, "评语建议");
  95. return RedirectToAction("MsgShow", "Common", new
  96. {
  97. msg = "导出成功!",
  98. url = Url.Content("~/EvaluationAdvise/List").AddMenuParameter()
  99. });
  100. }
  101. catch (Exception ex)
  102. {
  103. return RedirectToAction("MsgShow", "Common", new
  104. {
  105. msg = "导出失败,原因:" + ex.Message + "!",
  106. url = Url.Content("~/EvaluationAdvise/List").AddMenuParameter()
  107. });
  108. }
  109. }
  110. /// <summary>
  111. /// 删除
  112. /// </summary>
  113. /// <param name="ids"></param>
  114. /// <returns></returns>
  115. [HttpPost]
  116. public ActionResult Delete(string ids)
  117. {
  118. try
  119. {
  120. var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList();
  121. EvaluationRecordServices.Delete(list);
  122. return base.Json("删除成功。");
  123. }
  124. catch (Exception ex)
  125. {
  126. return base.Json("删除失败,原因:" + ex.Message);
  127. }
  128. }
  129. }
  130. }