EvaluationRecordController.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. namespace EMIS.Web.Controllers.EvaluationManage.EvaluationReport
  24. {
  25. [Authorization]
  26. public class EvaluationRecordController : Controller
  27. {
  28. public IEvaluationRecordServices EvaluationRecordServices { get; set; }
  29. public ISchoolYearServices SchoolYearServices { get; set; }
  30. //
  31. // GET: /EvaluationResult/评价记录
  32. #region 1.0 列表信息查询
  33. [HttpGet]
  34. public ActionResult RecordList()
  35. {
  36. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  37. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  38. return View();
  39. }
  40. /// <summary>
  41. /// 列表查询
  42. /// </summary>
  43. /// <param name="pararms"></param>
  44. /// <returns></returns>
  45. [HttpPost]
  46. public ActionResult RecordList(QueryParamsModel pararms)
  47. {
  48. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  49. var classmajorID = pararms.getExtraGuid("ClassmajorDropdown"); //班级名称
  50. var schoolyearCodeID = pararms.getExtraInt("SchoolyearDictionaryDropDown");//年级
  51. var campusID = pararms.getExtraGuid("CampusDropdown");//校区
  52. var collegeID = pararms.getExtraGuid("CollegeDropdown");//院系所
  53. var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");//专业名称
  54. var staffID = pararms.getExtraGuid("StaffComboGrid");//被评教师
  55. var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期
  56. var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown"); //评价表
  57. var evaluationTypeID = pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型
  58. var learningformID = pararms.getExtraInt("LearningformDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("LearningformDictionaryDropDown");
  59. var education = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  60. var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
  61. var result = EvaluationRecordServices.GetEvaluationRecordViewGrid(configuretView, campusID, collegeID, standardID, classmajorID, schoolyearCodeID, schoolYearID, evaluationTableID, evaluationTypeID, learningformID, education, LearnSystem, staffID, (int)pararms.page, (int)pararms.rows);
  62. return Json(result);
  63. }
  64. #endregion
  65. #region 2.0 删除信息操作
  66. /// <summary>
  67. /// 删除
  68. /// </summary>
  69. /// <param name="ids"></param>
  70. /// <returns></returns>
  71. [HttpPost]
  72. public ActionResult Delete(string ids)
  73. {
  74. try
  75. {
  76. var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList();
  77. EvaluationRecordServices.Delete(list);
  78. return base.Json("删除成功");
  79. }
  80. catch (Exception ex)
  81. {
  82. return base.Json("删除失败,原因:" + ex.Message);
  83. }
  84. }
  85. #endregion
  86. #region 3.0 列表信息导出
  87. [HttpPost]
  88. public ActionResult Excel()
  89. {
  90. try
  91. {
  92. NpoiExcelHelper neh = new NpoiExcelHelper();
  93. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  94. var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>(); //学年学期
  95. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>(); //院系所
  96. var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo<Guid>();//评价表
  97. var evaluationTypeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo<Guid>(); //评价类型
  98. var learningformID = Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>();
  99. var education = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  100. var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  101. var dt = EvaluationRecordServices.GetEvaluationRecordViewList(configuretView, schoolYearID, collegeID, evaluationTableID, evaluationTypeID, learningformID, education, LearnSystem).Select(x => new
  102. {
  103. x.SchoolyearCode,
  104. x.EvaluationSettingCode,
  105. x.EducationMissionClassName,
  106. x.B_EvaluationName,
  107. x.EvaluationTypeName,
  108. x.EvaluationCode,
  109. x.EvaluationName,
  110. x.EvaluationTableName,
  111. x.EvaluationTableTypeName,
  112. x.LimitMore,
  113. x.EvaluationCount
  114. }).ToTable();
  115. string[] liststring = { "学年学期", "评价编号", "任务班名称", "被评教师", "评价类型", "参评人编号", "参评人", "评价表名", "评价类型", "可评次数", "已评次数" };
  116. neh.Export(dt, liststring, "评价记录信息");
  117. return RedirectToAction("MsgShow", "Common", new
  118. {
  119. msg = "导出成功!",
  120. url = Url.Content("~/EvaluationReport/List").AddMenuParameter()
  121. });
  122. }
  123. catch (Exception ex)
  124. {
  125. return RedirectToAction("MsgShow", "Common", new
  126. {
  127. msg = "导出失败,原因:" + ex.Message + "!",
  128. url = Url.Content("~/EvaluationReport/List").AddMenuParameter()
  129. });
  130. }
  131. }
  132. #endregion
  133. #region 4.0 绑定参评类型
  134. [HttpPost]
  135. public ActionResult EvaluationTypeDropdownListBanid(Guid? evaluationTableID)
  136. {
  137. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  138. //if (evaluationTableID == null)
  139. //{
  140. // List<DropdownListItem> list = EvaluationRecordServices.GetEvaluationTypeByTableIDList(evaluationTableID).OrderByDescending(o => o.CreateTime).Select(x => new DropdownListItem { Value = x.TypeID.ToString(), Text = x.Name }).ToList();
  141. //}
  142. DropdownListBindType dbt = new DropdownListBindType();
  143. List<DropdownListItem> list = new List<DropdownListItem>();
  144. if (evaluationTableID != null)
  145. {
  146. list = EvaluationRecordServices.GetEvaluationTypeByTableIDList(evaluationTableID).OrderByDescending(o => o.CreateTime).Select(x => new DropdownListItem { Value = x.TypeID.ToString(), Text = x.Name }).ToList();
  147. dbt = DropdownListBindType.None;
  148. }
  149. else
  150. {
  151. list = EvaluationRecordServices.GetEvaluationTypeByTableIDList(evaluationTableID).OrderByDescending(o => o.CreateTime).Select(x => new DropdownListItem { Value = x.TypeID.ToString(), Text = x.Name }).ToList();
  152. dbt = DropdownListBindType.SelectAll;
  153. }
  154. DropdownList.FormatDropdownItemList(dbt, list);
  155. return base.Json(list);
  156. }
  157. #endregion
  158. }
  159. }