WorktimeAdditionController.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.PaymentManage;
  7. using EMIS.ViewModel.PaymentManage;
  8. using EMIS.Web.Controls;
  9. using EMIS.ViewModel;
  10. using Bowin.Common.Data;
  11. using Bowin.Web.Controls.Mvc;
  12. using Bowin.Common.Utility;
  13. using EMIS.Utility;
  14. namespace EMIS.Web.Controllers.PaymentManage
  15. {
  16. [Authorization]
  17. public class WorktimeAdditionController : Controller
  18. {
  19. public IWorktimeAdditionServices WorktimeAdditionServices { get; set; }
  20. public ActionResult List()
  21. {
  22. return View();
  23. }
  24. public ActionResult Edit(Guid? WorktimeAdditionID)
  25. {
  26. WorktimeAdditionView worktimeAdditionView = new WorktimeAdditionView();
  27. if (WorktimeAdditionID.HasValue)
  28. {
  29. worktimeAdditionView = WorktimeAdditionServices.GetWorktimeAdditionView(WorktimeAdditionID);
  30. }
  31. else
  32. {
  33. worktimeAdditionView.SchoolyearID = BaseExtensions.GetCurrentSchoolYearID();
  34. }
  35. return View(worktimeAdditionView);
  36. }
  37. [HttpPost]
  38. public ActionResult List(QueryParamsModel pararms)
  39. {
  40. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  41. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  42. var collegeID = pararms.getExtraGuid("cgbCollege");
  43. var teacherUserID = pararms.getExtraGuid("cgbTeacherUser");
  44. var studentCollegeID = pararms.getExtraGuid("cgbStudentCollege");
  45. var courseCollegeID = pararms.getExtraGuid("cgbCourseCollege");
  46. var year = pararms.getExtraInt("ddlYear") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlYear");
  47. var standardID = pararms.getExtraInt("cgbStandard") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("cgbStandard");
  48. var teachingModeID = pararms.getExtraInt("ddlTeachingMode") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlTeachingMode");
  49. var month = pararms.getExtraInt("ddlMonth") == DropdownList.PLEASE_SELECT ? null : pararms.getExtraInt("ddlMonth");
  50. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  51. return base.Json(WorktimeAdditionServices.GetWorktimeAdditionViewList(configuretView, schoolyearID, collegeID, teacherUserID, studentCollegeID, courseCollegeID, year, standardID, teachingModeID,month, (int)pararms.page, (int)pararms.rows));
  52. }
  53. [HttpPost]
  54. public ActionResult Edit(WorktimeAdditionView worktimeAdditionView)
  55. {
  56. try
  57. {
  58. WorktimeAdditionServices.Save(worktimeAdditionView);
  59. return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
  60. }
  61. catch (Exception ex)
  62. {
  63. return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
  64. }
  65. }
  66. [HttpPost]
  67. public ActionResult Delete(string worktimeAdditionIDs)
  68. {
  69. try
  70. {
  71. List<Guid?> list = worktimeAdditionIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  72. WorktimeAdditionServices.Delete(list);
  73. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
  74. }
  75. catch (Exception ex)
  76. {
  77. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message });
  78. }
  79. }
  80. /// <summary>
  81. /// 导出Excel
  82. /// </summary>
  83. /// <returns></returns>
  84. [HttpPost]
  85. public ActionResult Excel()
  86. {
  87. NpoiExcelHelper neh = new NpoiExcelHelper();
  88. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  89. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  90. var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
  91. var teacherUserID = Request.Form["cgbTeacherUser"].ParseStrTo<Guid>();
  92. var studentCollegeID = Request.Form["cgbStudentCollege"].ParseStrTo<Guid>();
  93. var courseCollegeID = Request.Form["cgbCourseCollege"].ParseStrTo<Guid>();
  94. var year = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  95. var standardID = Request.Form["cgbStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cgbStandard"].ParseStrTo<int>();
  96. var teachingModeID = Request.Form["ddlTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlTeachingMode"].ParseStrTo<int>();
  97. var month = Request.Form["ddlMonth"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlMonth"].ParseStrTo<int>();
  98. var dt = WorktimeAdditionServices.GetWorktimeAdditionViewList(configuretView, schoolyearID, collegeID, teacherUserID, studentCollegeID, courseCollegeID, year, standardID, teachingModeID, month).Select(x => new
  99. {
  100. x.SchoolyearCode,
  101. x.CollegeName,
  102. x.TeacherName,
  103. x.GradeYearID,
  104. x.StandardDesc,
  105. x.CourseCode,
  106. x.CourseName,
  107. x.CourseCollegeName,
  108. x.EducationMissionClassName,
  109. x.TeachingModeDesc,
  110. x.TeachTypeDesc,
  111. x.StudentCount,
  112. x.CourseTime,
  113. x.Remark
  114. }).ToTable();
  115. string[] liststring = { "学年学期", "教师单位", "教师姓名", "年级", "专业", "课程代码", "课程名称", RSL.Get("CourseCollege"), "任务班名", "授课方式", "任课方式", "学生人数", "课时数", "备注" };
  116. neh.Export(dt, liststring, "课时补登");
  117. return RedirectToAction("MsgShow", "Common", new
  118. {
  119. msg = "导出成功!",
  120. url = Url.Action("List").AddMenuParameter()
  121. });
  122. }
  123. }
  124. }