ScheduleController.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using Lottomat.Application.Busines.PublicInfoManage;
  2. using Lottomat.Application.Code;
  3. using Lottomat.Application.Entity.PublicInfoManage;
  4. using Lottomat.Util.Extension;
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Web;
  10. using System.Web.Mvc;
  11. namespace Lottomat.Application.Admin.Areas.PublicInfoManage.Controllers
  12. {
  13. /// <summary>
  14. /// 版 本 1.0
  15. /// Copyright (c) 2016-2017
  16. /// 创建人:赵轶
  17. /// 日 期:2016.4.21 16:01
  18. /// 描 述:日程管理
  19. /// </summary>
  20. public class ScheduleController : MvcControllerBase
  21. {
  22. private ScheduleBLL schedulebll = new ScheduleBLL();
  23. #region 视图功能
  24. /// <summary>
  25. /// 日程管理
  26. /// </summary>
  27. /// <returns></returns>
  28. [HttpGet]
  29. [HandlerAuthorize(PermissionMode.Enforce)]
  30. public ActionResult Index()
  31. {
  32. return View();
  33. }
  34. /// <summary>
  35. /// 添加日程
  36. /// </summary>
  37. /// <returns></returns>
  38. [HttpGet]
  39. public ActionResult Form()
  40. {
  41. return View();
  42. }
  43. #endregion
  44. #region 获取数据
  45. /// <summary>
  46. /// 获取数据
  47. /// </summary>
  48. /// <returns></returns>
  49. [HttpGet]
  50. public ActionResult GetList()
  51. {
  52. List<Hashtable> data = new List<Hashtable>();
  53. foreach (ScheduleEntity entity in schedulebll.GetList("").ToList())
  54. {
  55. Hashtable ht = new Hashtable();
  56. ht["id"] = entity.ScheduleId;
  57. ht["title"] = entity.ScheduleContent;
  58. ht["end"] = (entity.EndDate.ToDate().ToString("yyyy-MM-dd") + " " + entity.EndTime.Substring(0, 2) + ":" + entity.EndTime.Substring(2, 2)).ToDate().ToString("yyyy-MM-dd HH:mm:ss");
  59. ht["start"] = (entity.StartDate.ToDate().ToString("yyyy-MM-dd") + " " + entity.StartTime.Substring(0, 2) + ":" + entity.StartTime.Substring(2, 2)).ToDate().ToString("yyyy-MM-dd HH:mm:ss");
  60. ht["allDay"] = false;
  61. data.Add(ht);
  62. }
  63. return ToJsonResult(data);
  64. }
  65. /// <summary>
  66. /// 获取实体
  67. /// </summary>
  68. /// <param name="keyValue">主键值</param>
  69. /// <returns>返回对象Json</returns>
  70. [HttpGet]
  71. public ActionResult GetFormJson(string keyValue)
  72. {
  73. var data = schedulebll.GetEntity(keyValue);
  74. return ToJsonResult(data);
  75. }
  76. #endregion
  77. #region 提交数据
  78. /// <summary>
  79. /// 删除数据
  80. /// </summary>
  81. /// <param name="keyValue">主键值</param>
  82. /// <returns></returns>
  83. [HttpPost]
  84. [ValidateAntiForgeryToken]
  85. [AjaxOnly]
  86. public ActionResult RemoveForm(string keyValue)
  87. {
  88. schedulebll.RemoveForm(keyValue);
  89. return Success("删除成功。");
  90. }
  91. /// <summary>
  92. /// 保存表单(新增、修改)
  93. /// </summary>
  94. /// <param name="keyValue">主键值</param>
  95. /// <param name="entity">实体对象</param>
  96. /// <returns></returns>
  97. [HttpPost]
  98. [ValidateAntiForgeryToken]
  99. [AjaxOnly]
  100. public ActionResult SaveForm(string keyValue, ScheduleEntity entity)
  101. {
  102. schedulebll.SaveForm(keyValue, entity);
  103. return Success("操作成功。");
  104. }
  105. #endregion
  106. }
  107. }