ScheduleController.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using LeaRun.Application.Busines.PublicInfoManage;
  2. using LeaRun.Application.Code;
  3. using LeaRun.Application.Entity.PublicInfoManage;
  4. using LeaRun.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 LeaRun.Application.Web.Areas.PublicInfoManage.Controllers
  12. {
  13. /// <summary>
  14. /// 版 本 6.1
  15. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  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. [HttpGet]
  46. public ActionResult GetList()
  47. {
  48. List<Hashtable> data = new List<Hashtable>();
  49. foreach (ScheduleEntity entity in schedulebll.GetList("").ToList())
  50. {
  51. Hashtable ht = new Hashtable();
  52. ht["id"] = entity.ScheduleId;
  53. ht["title"] = entity.ScheduleContent;
  54. 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");
  55. 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");
  56. ht["allDay"] = false;
  57. data.Add(ht);
  58. }
  59. return ToJsonResult(data);
  60. }
  61. /// <summary>
  62. /// 获取实体
  63. /// </summary>
  64. /// <param name="keyValue">主键值</param>
  65. /// <returns>返回对象Json</returns>
  66. [HttpGet]
  67. public ActionResult GetFormJson(string keyValue)
  68. {
  69. var data = schedulebll.GetEntity(keyValue);
  70. return ToJsonResult(data);
  71. }
  72. #endregion
  73. #region 提交数据
  74. /// <summary>
  75. /// 删除数据
  76. /// </summary>
  77. /// <param name="keyValue">主键值</param>
  78. /// <returns></returns>
  79. [HttpPost]
  80. [ValidateAntiForgeryToken]
  81. [AjaxOnly]
  82. public ActionResult RemoveForm(string keyValue)
  83. {
  84. schedulebll.RemoveForm(keyValue);
  85. return Success("删除成功。");
  86. }
  87. /// <summary>
  88. /// 保存表单(新增、修改)
  89. /// </summary>
  90. /// <param name="keyValue">主键值</param>
  91. /// <param name="entity">实体对象</param>
  92. /// <returns></returns>
  93. [HttpPost]
  94. [ValidateAntiForgeryToken]
  95. [AjaxOnly]
  96. public ActionResult SaveForm(string keyValue, ScheduleEntity entity)
  97. {
  98. schedulebll.SaveForm(keyValue, entity);
  99. return Success("操作成功。");
  100. }
  101. #endregion
  102. }
  103. }