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.Web.Mvc; namespace LeaRun.Application.Web.Areas.BaseManage.Controllers { /// /// 版 本 /// Copyright (c) 2013-2016 上海力软信息技术有限公司 /// 创建人:佘赐雄 /// 日 期:2015.11.4 14:31 /// 描 述:职位管理 /// public class JobController : MvcControllerBase { private JobBLL jobBLL = new JobBLL(); private JobCache jobCache = new JobCache(); #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 = jobBLL.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 = jobCache.GetList(organizeId); return Content(data.ToJson()); } /// /// 职位实体 /// /// 主键值 /// 返回对象Json [HttpGet] public ActionResult GetFormJson(string keyValue) { var data = jobBLL.GetEntity(keyValue); return Content(data.ToJson()); } #endregion #region 验证数据 /// /// 职位编号不能重复 /// /// 编号 /// 主键 /// [HttpGet] public ActionResult ExistEnCode(string EnCode, string keyValue) { bool IsOk = jobBLL.ExistEnCode(EnCode, keyValue); return Content(IsOk.ToString()); } /// /// 职位名称不能重复 /// /// 名称 /// 主键 /// [HttpGet] public ActionResult ExistFullName(string FullName, string keyValue) { bool IsOk = jobBLL.ExistFullName(FullName, keyValue); return Content(IsOk.ToString()); } #endregion #region 提交数据 /// /// 删除职位 /// /// 主键值 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] [HandlerAuthorize(PermissionMode.Enforce)] public ActionResult RemoveForm(string keyValue) { jobBLL.RemoveForm(keyValue); return Success("删除成功。"); } /// /// 保存职位表单(新增、修改) /// /// 主键值 /// 职位实体 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, RoleEntity jobEntity) { jobBLL.SaveForm(keyValue, jobEntity); return Success("操作成功。"); } #endregion } }