using LeaRun.Application.Entity.DemoManage; using LeaRun.Application.Busines.DemoManage; using LeaRun.Util; using LeaRun.Util.WebControl; using System.Collections.Generic; using System.Web.Mvc; namespace LeaRun.Application.Web.Areas.DemoManage.Controllers { /// /// 版 本 6.1 /// Copyright (c) 2013-2016 上海力软信息技术有限公司 /// 创 建:超级管理员 /// 日 期:2016-12-06 17:29 /// 描 述:OfficeRk /// public class OfficeRkController : MvcControllerBase { private OfficeRkBLL officerkbll = new OfficeRkBLL(); #region 视图功能 /// /// 列表页面 /// /// [HttpGet] public ActionResult OfficeRkIndex() { return View(); } /// /// 表单页面 /// /// [HttpGet] public ActionResult OfficeRkForm() { return View(); } #endregion #region 获取数据 /// /// 获取列表 /// /// 分页参数 /// 查询参数 /// 返回分页列表Json [HttpGet] public ActionResult GetPageListJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); var data = officerkbll.GetPageList(pagination, queryJson); var jsonData = new { rows = data, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return ToJsonResult(jsonData); } /// /// 获取实体 /// /// 主键值 /// 返回对象Json [HttpGet] public ActionResult GetFormJson(string keyValue) { var data = officerkbll.GetEntity(keyValue); var childData = officerkbll.GetDetails(keyValue); var jsonData = new { entity = data, childEntity = childData }; return ToJsonResult(jsonData); } /// /// 获取子表详细信息 /// /// 主键值 /// 返回对象Json [HttpGet] public ActionResult GetDetailsJson(string keyValue) { var data = officerkbll.GetDetails(keyValue); return ToJsonResult(data); } #endregion #region 提交数据 /// /// 删除数据 /// /// 主键值 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult RemoveForm(string keyValue) { officerkbll.RemoveForm(keyValue); return Success("删除成功。"); } /// /// 保存表单(新增、修改) /// /// 主键值 /// 实体对象 /// 子表对象集 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, string strEntity,string strChildEntitys) { var entity = strEntity.ToObject(); List childEntitys = strChildEntitys.ToList(); officerkbll.SaveForm(keyValue, entity, childEntitys); return Success("操作成功。"); } #endregion } }