CalendarController.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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.CalendarManage;
  7. using EMIS.ViewModel.CalendarManage;
  8. using EMIS.ViewModel;
  9. using Bowin.Common.Utility;
  10. namespace EMIS.Web.Controllers.CalendarManage
  11. {
  12. public class CalendarController : Controller
  13. {
  14. public ICalendarViewServices CalendarViewServices { get; set; }
  15. /// <summary>
  16. /// 学年校历页面
  17. /// </summary>
  18. /// <returns></returns>
  19. public ActionResult Index()
  20. {
  21. return View();
  22. }
  23. [HttpPost]
  24. public ActionResult GetCalendarView(Guid schoolYearID)
  25. {
  26. try
  27. {
  28. var calendarView = CalendarViewServices.GetCalendarViewBySchoolYearID(schoolYearID);
  29. return Json(new ReturnMessage<CalendarView>
  30. {
  31. IsSuccess = true,
  32. Data = calendarView
  33. });
  34. }
  35. catch (Exception ex)
  36. {
  37. return Json(new ReturnMessage
  38. {
  39. IsSuccess = false,
  40. Message = ex.Message
  41. });
  42. }
  43. }
  44. [HttpPost]
  45. public ActionResult Excel()
  46. {
  47. var schoolyear = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>();
  48. CalendarViewServices.Excel(schoolyear.Value, "学年校历" + DateTime.Now.ToString("yyyyMMddhhmmss"));
  49. return Json(new ReturnMessage()
  50. {
  51. IsSuccess = false,
  52. Message = "导出成功!"
  53. });
  54. }
  55. }
  56. }