using LeaRun.Application.Busines.PublicInfoManage; using LeaRun.Application.Code; using LeaRun.Application.Entity.PublicInfoManage; using LeaRun.Util.Extension; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace LeaRun.Application.Web.Areas.PublicInfoManage.Controllers { /// /// 版 本 6.1 /// Copyright (c) 2013-2016 上海力软信息技术有限公司 /// 创建人:佘赐雄 /// 日 期:2016.4.21 16:01 /// 描 述:日程管理 /// public class ScheduleController : MvcControllerBase { private ScheduleBLL schedulebll = new ScheduleBLL(); #region 视图功能 /// /// 日程管理 /// /// [HttpGet] [HandlerAuthorize(PermissionMode.Enforce)] public ActionResult Index() { return View(); } /// /// 添加日程 /// /// [HttpGet] public ActionResult Form() { return View(); } #endregion #region 获取数据 [HttpGet] public ActionResult GetList() { List data = new List(); foreach (ScheduleEntity entity in schedulebll.GetList("").ToList()) { Hashtable ht = new Hashtable(); ht["id"] = entity.ScheduleId; ht["title"] = entity.ScheduleContent; 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"); 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"); ht["allDay"] = false; data.Add(ht); } return ToJsonResult(data); } /// /// 获取实体 /// /// 主键值 /// 返回对象Json [HttpGet] public ActionResult GetFormJson(string keyValue) { var data = schedulebll.GetEntity(keyValue); return ToJsonResult(data); } #endregion #region 提交数据 /// /// 删除数据 /// /// 主键值 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult RemoveForm(string keyValue) { schedulebll.RemoveForm(keyValue); return Success("删除成功。"); } /// /// 保存表单(新增、修改) /// /// 主键值 /// 实体对象 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, ScheduleEntity entity) { schedulebll.SaveForm(keyValue, entity); return Success("操作成功。"); } #endregion } }