using Learun.Application.Organization; using Learun.Util; using Learun.Util.Operat; using System.Web.Mvc; namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers { /// /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架 /// Copyright (c) 2013-2018 Hexagon PPM /// 创建人:研发部 /// 日 期:2017.03.09 /// 描 述:公司管理 /// public class CompanyController : MvcControllerBase { private CompanyIBLL companyIBLL = new CompanyBLL(); #region 获取视图 /// /// 主页 /// /// [HttpGet] public ActionResult Index() { return View(); } /// /// 表单 /// /// [HttpGet] public ActionResult Form() { return View(); } #endregion #region 获取数据 /// /// 获取公司列表信息 /// /// 查询关键字 /// [HttpGet] [AjaxOnly] public ActionResult GetList(string keyword) { var data = companyIBLL.GetList(keyword); return Success(data); } /// /// 获取树形数据 /// /// 父级id /// [HttpGet] [AjaxOnly] public ActionResult GetTree(string parentId) { var data = companyIBLL.GetTree(parentId); return Success(data); } /// /// 获取映射数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetMap(string ver) { var data = companyIBLL.GetModelMap(); string md5 = Md5Helper.Encrypt(data.ToJson(), 32); if (md5 == ver) { return Success("no update"); } else { var jsondata = new { data = data, ver = md5 }; return Success(jsondata); } } #endregion #region 提交数据 /// /// 保存表单数据 /// /// 主键 /// 实体数据 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, CompanyEntity entity) { companyIBLL.SaveEntity(keyValue, entity); return Success("保存成功!", "公司信息", string.IsNullOrEmpty(keyValue) ? OperationType.Create : OperationType.Update, entity.F_CompanyId, entity.ToJson()); } /// /// 删除表单数据 /// /// 主键 /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { companyIBLL.VirtualDelete(keyValue); return Success("删除成功!", "公司信息", OperationType.Delete, keyValue, ""); } #endregion } }