Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

136 строки
4.1 KiB

  1. using Learun.Application.CRM;
  2. using Learun.Util;
  3. using System.Web.Mvc;
  4. namespace Learun.Application.Web.Areas.LR_CRMModule.Controllers
  5. {
  6. /// <summary>
  7. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  8. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  9. /// 创 建:超级管理员
  10. /// 日 期:2017-07-11 09:43
  11. /// 描 述:客户管理
  12. /// </summary>
  13. public class CustomerController : MvcControllerBase
  14. {
  15. private CrmCustomerIBLL crmCustomerIBLL = new CrmCustomerBLL();
  16. #region 视图功能
  17. /// <summary>
  18. /// 客户列表页面
  19. /// </summary>
  20. /// <returns></returns>
  21. [HttpGet]
  22. public ActionResult Index()
  23. {
  24. return View();
  25. }
  26. /// <summary>
  27. /// 客户表单页面
  28. /// </summary>
  29. /// <returns></returns>
  30. [HttpGet]
  31. public ActionResult Form()
  32. {
  33. return View();
  34. }
  35. /// <summary>
  36. /// 客户明细页面
  37. /// </summary>
  38. /// <returns></returns>
  39. [HttpGet]
  40. public ActionResult Detail()
  41. {
  42. return View();
  43. }
  44. #endregion
  45. #region 获取数据
  46. /// <summary>
  47. /// 获取客户列表
  48. /// </summary>
  49. /// <returns>返回列表Json</returns>
  50. [HttpGet]
  51. public ActionResult GetList()
  52. {
  53. var data = crmCustomerIBLL.GetList();
  54. return JsonResult(data);
  55. }
  56. /// <summary>
  57. /// 获取客户列表
  58. /// </summary>
  59. /// <param name="pagination">分页参数</param>
  60. /// <param name="queryJson">查询参数</param>
  61. /// <returns>返回分页列表Json</returns>
  62. [HttpGet]
  63. public ActionResult GetPageListJson(string pagination, string queryJson)
  64. {
  65. Pagination paginationobj = pagination.ToObject<Pagination>();
  66. var data = crmCustomerIBLL.GetPageList(paginationobj, queryJson);
  67. var jsonData = new
  68. {
  69. rows = data,
  70. total = paginationobj.total,
  71. page = paginationobj.page,
  72. records = paginationobj.records,
  73. };
  74. return JsonResult(jsonData);
  75. }
  76. /// <summary>
  77. /// 获取客户实体
  78. /// </summary>
  79. /// <param name="keyValue">主键值</param>
  80. /// <returns>返回对象Json</returns>
  81. [HttpGet]
  82. public ActionResult GetFormJson(string keyValue)
  83. {
  84. var data = crmCustomerIBLL.GetEntity(keyValue);
  85. return JsonResult(data);
  86. }
  87. #endregion
  88. #region 验证数据
  89. /// <summary>
  90. /// 客户名称不能重复
  91. /// </summary>
  92. /// <param name="FullName">名称</param>
  93. /// <param name="keyValue">主键</param>
  94. /// <returns></returns>
  95. [HttpGet]
  96. public ActionResult ExistFullName(string FullName, string keyValue)
  97. {
  98. bool IsOk = crmCustomerIBLL.ExistFullName(FullName, keyValue);
  99. return Success(IsOk.ToString());
  100. }
  101. #endregion
  102. #region 提交数据
  103. /// <summary>
  104. /// 删除客户数据
  105. /// </summary>
  106. /// <param name="keyValue">主键值</param>
  107. /// <returns></returns>
  108. [HttpPost]
  109. [AjaxOnly]
  110. public ActionResult DeleteForm(string keyValue)
  111. {
  112. crmCustomerIBLL.DeleteEntity(keyValue);
  113. return Success("删除成功。");
  114. }
  115. /// <summary>
  116. /// 保存客户表单(新增、修改)
  117. /// </summary>
  118. /// <param name="keyValue">主键值</param>
  119. /// <param name="entity">实体对象</param>
  120. /// <returns></returns>
  121. [HttpPost]
  122. [ValidateAntiForgeryToken]
  123. [AjaxOnly]
  124. public ActionResult SaveForm(string keyValue, CrmCustomerEntity entity)
  125. {
  126. crmCustomerIBLL.SaveEntity(keyValue, entity);
  127. return Success("操作成功。");
  128. }
  129. #endregion
  130. }
  131. }