using LeaRun.Application.Busines.BaseManage; using LeaRun.Application.Cache; using LeaRun.Application.Code; using LeaRun.Application.Entity.BaseManage; using LeaRun.Util; using LeaRun.Util.WebControl; using System.Collections.Generic; using System.Web.Mvc; namespace LeaRun.Application.Web.Areas.BaseManage.Controllers { /// /// 版 本 /// Copyright (c) 2013-2016 上海力软信息技术有限公司 /// 创建人:佘赐雄 /// 日 期:2015.11.4 14:31 /// 描 述:岗位管理 /// public class PostController : MvcControllerBase { private PostCache postCache = new PostCache(); private PostBLL postBLL = new PostBLL(); #region 视图功能 /// /// 岗位管理 /// /// [HttpGet] [HandlerAuthorize(PermissionMode.Enforce)] public ActionResult Index() { return View(); } /// /// 岗位表单 /// /// [HttpGet] [HandlerAuthorize(PermissionMode.Enforce)] public ActionResult Form() { return View(); } #endregion #region 获取数据 /// /// 岗位列表 /// /// 分页参数 /// 查询参数 /// 返回分页列表Json [HttpGet] public ActionResult GetPageListJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); var data = postBLL.GetPageList(pagination, queryJson); var JsonData = new { rows = data, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return Content(JsonData.ToJson()); } /// /// 岗位列表 /// /// 公司Id /// 返回列表Json [HttpGet] public ActionResult GetListJson(string organizeId) { var data = postCache.GetList(organizeId); return Content(data.ToJson()); } /// /// 岗位实体 /// /// 主键值 /// 返回对象Json [HttpGet] public ActionResult GetFormJson(string keyValue) { var data = postBLL.GetEntity(keyValue); return Content(data.ToJson()); } #endregion #region 验证数据 /// /// 岗位编号不能重复 /// /// 编号 /// 主键 /// [HttpGet] public ActionResult ExistEnCode(string EnCode, string keyValue) { bool IsOk = postBLL.ExistEnCode(EnCode, keyValue); return Content(IsOk.ToString()); } /// /// 岗位名称不能重复 /// /// 名称 /// 主键 /// [HttpGet] public ActionResult ExistFullName(string FullName, string keyValue) { bool IsOk = postBLL.ExistFullName(FullName, keyValue); return Content(IsOk.ToString()); } #endregion #region 提交数据 /// /// 删除岗位 /// /// 主键值 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] [HandlerAuthorize(PermissionMode.Enforce)] public ActionResult RemoveForm(string keyValue) { postBLL.RemoveForm(keyValue); return Success("删除成功。"); } /// /// 保存岗位表单(新增、修改) /// /// 主键值 /// 岗位实体 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, RoleEntity postEntity) { postBLL.SaveForm(keyValue, postEntity); return Success("操作成功。"); } #endregion } }