using Learun.Application.CRM; using Learun.Util; using System.Web.Mvc; namespace Learun.Application.Web.Areas.LR_CRMModule.Controllers { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创 建:超级管理员 /// 日 期:2017-07-11 09:43 /// 描 述:客户管理 /// public class CustomerController : MvcControllerBase { private CrmCustomerIBLL crmCustomerIBLL = new CrmCustomerBLL(); #region 视图功能 /// /// 客户列表页面 /// /// [HttpGet] public ActionResult Index() { return View(); } /// /// 客户表单页面 /// /// [HttpGet] public ActionResult Form() { return View(); } /// /// 客户明细页面 /// /// [HttpGet] public ActionResult Detail() { return View(); } #endregion #region 获取数据 /// /// 获取客户列表 /// /// 返回列表Json [HttpGet] public ActionResult GetList() { var data = crmCustomerIBLL.GetList(); return JsonResult(data); } /// /// 获取客户列表 /// /// 分页参数 /// 查询参数 /// 返回分页列表Json [HttpGet] public ActionResult GetPageListJson(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = crmCustomerIBLL.GetPageList(paginationobj, queryJson); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records, }; return JsonResult(jsonData); } /// /// 获取客户实体 /// /// 主键值 /// 返回对象Json [HttpGet] public ActionResult GetFormJson(string keyValue) { var data = crmCustomerIBLL.GetEntity(keyValue); return JsonResult(data); } #endregion #region 验证数据 /// /// 客户名称不能重复 /// /// 名称 /// 主键 /// [HttpGet] public ActionResult ExistFullName(string FullName, string keyValue) { bool IsOk = crmCustomerIBLL.ExistFullName(FullName, keyValue); return Success(IsOk.ToString()); } #endregion #region 提交数据 /// /// 删除客户数据 /// /// 主键值 /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { crmCustomerIBLL.DeleteEntity(keyValue); return Success("删除成功。"); } /// /// 保存客户表单(新增、修改) /// /// 主键值 /// 实体对象 /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, CrmCustomerEntity entity) { crmCustomerIBLL.SaveEntity(keyValue, entity); return Success("操作成功。"); } #endregion } }