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