SupEvaluationController.cs 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.SupervisionManage;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using EMIS.CommonLogic.SystemServices;
  10. using Bowin.Common.Utility;
  11. using Bowin.Web.Controls.Mvc;
  12. using EMIS.ViewModel.SupervisionManage;
  13. using Bowin.Common.Data;
  14. using EMIS.Utility;
  15. namespace EMIS.Web.Controllers.SupervisionManage
  16. {
  17. [Authorization]
  18. public class SupEvaluationController : Controller
  19. {
  20. //
  21. // GET: /SupEvaluation/
  22. public ISupEvaluationServices SupEvaluationServices { get; set; }
  23. public IRoleServices IRoleServices { get; set; }
  24. [HttpGet]
  25. public ActionResult List()
  26. {
  27. return View();
  28. }
  29. [HttpPost]
  30. public ActionResult List(QueryParamsModel pararms)
  31. {
  32. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  33. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  34. var collegeID = pararms.getExtraGuid("DDCollegeDropdown");
  35. var startTimes = pararms.getExtraDateTime("txtStartDate");
  36. var endTimes = pararms.getExtraDateTime("txtEndDate");
  37. var SupervisionTypeID = pararms.getExtraInt("SupervisionType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SupervisionType"); ;
  38. var dataRange = IRoleServices.GetDataRange();
  39. return base.Json(SupEvaluationServices.GetSupEvaluationViewGrid(configuretView,schoolyearID, collegeID, startTimes, endTimes, SupervisionTypeID, dataRange, (int)pararms.page, (int)pararms.rows));
  40. }
  41. [HttpPost]
  42. public ActionResult Excel()
  43. {
  44. NpoiExcelHelper neh = new NpoiExcelHelper();
  45. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  46. var selectedLessonRecordID = Request.Form["LessonRecordIDs"] ?? "";
  47. var selectedProjectRecordID = Request.Form["ProjectRecordIDs"] ?? "";
  48. var schoolyearID = Request.Form["Schoolyear"].ParseStrTo<Guid>();
  49. var collegeID = Request.Form["ddlCollege"].ParseStrTo<Guid>();
  50. var startTimes = Request.Form["txtStartDate"].ParseStrTo<DateTime>();
  51. var endTimes = Request.Form["txtEndDate"].ParseStrTo<DateTime>();
  52. var SupervisionTypeID = Request.Form["SupervisionType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SupervisionType"].ParseStrTo<int>();
  53. var dataRange = IRoleServices.GetDataRange();
  54. List<SupEvaluationView> result;
  55. List<Guid> LessonRecordIDList = new List<Guid>();
  56. List<Guid> ProjectRecordIDList = new List<Guid>();
  57. if (selectedLessonRecordID!="")
  58. {
  59. LessonRecordIDList = selectedLessonRecordID.Split(',')
  60. .Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  61. }
  62. if (selectedProjectRecordID!="")
  63. {
  64. ProjectRecordIDList = selectedProjectRecordID.Split(',')
  65. .Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  66. }
  67. result = SupEvaluationServices.GetSupEvaluationViewGridList(configuretView,schoolyearID, collegeID, startTimes, endTimes, SupervisionTypeID, dataRange, LessonRecordIDList, ProjectRecordIDList);
  68. var dt = result.Select(x => new
  69. {
  70. x.SchoolyearCode,
  71. x.SupervisionCollegeName,
  72. x.UserName,
  73. x.SupervisionTypeName,
  74. x.CourseName,
  75. x.LessonDateStr,
  76. x.Advise,
  77. x.TotalScore
  78. }).ToTable();
  79. string[] liststring = { "学年学期", RSL.Get("College"), "督导对象", "督导类型", "课程名称", "评价日期", "评价建议", "评分" };
  80. neh.Export(dt, liststring, "督导评价");
  81. return Json(new ReturnMessage()
  82. {
  83. IsSuccess = true,
  84. Message = "导出成功!"
  85. });
  86. }
  87. public ActionResult SupEvaluationReport()
  88. {
  89. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  90. var dataRange = IRoleServices.GetDataRange();
  91. ViewBag.DataRange = dataRange;
  92. ViewBag.UserID = curUser.UserID.ToString();
  93. return View();
  94. }
  95. }
  96. }