ChanceController.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. using LeaRun.Application.Entity.CustomerManage;
  2. using LeaRun.Application.Busines.CustomerManage;
  3. using LeaRun.Util;
  4. using LeaRun.Util.WebControl;
  5. using System.Web.Mvc;
  6. using LeaRun.Application.Busines.SystemManage;
  7. using LeaRun.Application.Code;
  8. using LeaRun.Application.Entity.BaseManage;
  9. namespace LeaRun.Application.Web.Areas.CustomerManage.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本 6.1
  13. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  14. /// 创 建:佘赐雄
  15. /// 日 期:2016-03-12 10:50
  16. /// 描 述:商机信息
  17. /// </summary>
  18. public class ChanceController : MvcControllerBase
  19. {
  20. private ChanceBLL chancebll = new ChanceBLL();
  21. private CodeRuleBLL codeRuleBLL = new CodeRuleBLL();
  22. #region 视图功能
  23. /// <summary>
  24. /// 商机列表页面
  25. /// </summary>
  26. /// <returns></returns>
  27. [HttpGet]
  28. [HandlerAuthorize(PermissionMode.Enforce)]
  29. public ActionResult Index()
  30. {
  31. return View();
  32. }
  33. /// <summary>
  34. /// 商机表单页面
  35. /// </summary>
  36. /// <returns></returns>
  37. [HttpGet]
  38. [HandlerAuthorize(PermissionMode.Enforce)]
  39. public ActionResult Form()
  40. {
  41. if (Request["keyValue"] == null)
  42. {
  43. ViewBag.EnCode = codeRuleBLL.GetBillCode(SystemInfo.CurrentUserId, SystemInfo.CurrentModuleId);
  44. }
  45. return View();
  46. }
  47. /// <summary>
  48. /// 商机明细页面
  49. /// </summary>
  50. /// <returns></returns>
  51. [HttpGet]
  52. [HandlerAuthorize(PermissionMode.Enforce)]
  53. public ActionResult Detail()
  54. {
  55. return View();
  56. }
  57. #endregion
  58. #region 获取数据
  59. /// <summary>
  60. /// 获取商机列表
  61. /// </summary>
  62. /// <param name="pagination">分页参数</param>
  63. /// <param name="queryJson">查询参数</param>
  64. /// <returns>返回分页列表Json</returns>
  65. [HttpGet]
  66. public ActionResult GetPageListJson(Pagination pagination, string queryJson)
  67. {
  68. var watch = CommonHelper.TimerStart();
  69. var data = chancebll.GetPageList(pagination, queryJson);
  70. var jsonData = new
  71. {
  72. rows = data,
  73. total = pagination.total,
  74. page = pagination.page,
  75. records = pagination.records,
  76. costtime = CommonHelper.TimerEnd(watch)
  77. };
  78. return ToJsonResult(jsonData);
  79. }
  80. /// <summary>
  81. /// 获取商机实体
  82. /// </summary>
  83. /// <param name="keyValue">主键值</param>
  84. /// <returns>返回对象Json</returns>
  85. [HttpGet]
  86. public ActionResult GetFormJson(string keyValue)
  87. {
  88. var data = chancebll.GetEntity(keyValue);
  89. return ToJsonResult(data);
  90. }
  91. #endregion
  92. #region 验证数据
  93. /// <summary>
  94. /// 商机名称不能重复
  95. /// </summary>
  96. /// <param name="FullName">名称</param>
  97. /// <param name="keyValue">主键</param>
  98. /// <returns></returns>
  99. [HttpGet]
  100. public ActionResult ExistFullName(string FullName, string keyValue)
  101. {
  102. bool IsOk = chancebll.ExistFullName(FullName, keyValue);
  103. return Content(IsOk.ToString());
  104. }
  105. #endregion
  106. #region 提交数据
  107. /// <summary>
  108. /// 删除商机数据
  109. /// </summary>
  110. /// <param name="keyValue">主键值</param>
  111. /// <returns></returns>
  112. [HttpPost]
  113. [ValidateAntiForgeryToken]
  114. [AjaxOnly]
  115. [HandlerAuthorize(PermissionMode.Enforce)]
  116. public ActionResult RemoveForm(string keyValue)
  117. {
  118. chancebll.RemoveForm(keyValue);
  119. return Success("删除成功。");
  120. }
  121. /// <summary>
  122. /// 保存商机表单(新增、修改)
  123. /// </summary>
  124. /// <param name="keyValue">主键值</param>
  125. /// <param name="entity">实体对象</param>
  126. /// <returns></returns>
  127. [HttpPost]
  128. [ValidateAntiForgeryToken]
  129. [AjaxOnly]
  130. public ActionResult SaveForm(string keyValue, ChanceEntity entity)
  131. {
  132. chancebll.SaveForm(keyValue, entity);
  133. return Success("操作成功。");
  134. }
  135. /// <summary>
  136. /// 商机作废
  137. /// </summary>
  138. /// <param name="keyValue">主键值</param>
  139. /// <returns></returns>
  140. [HttpPost]
  141. [ValidateAntiForgeryToken]
  142. [AjaxOnly]
  143. public ActionResult Invalid(string keyValue)
  144. {
  145. chancebll.Invalid(keyValue);
  146. return Success("作废成功。");
  147. }
  148. /// <summary>
  149. /// 商机转换客户
  150. /// </summary>
  151. /// <param name="keyValue">主键值</param>
  152. /// <returns></returns>
  153. [HttpPost]
  154. [ValidateAntiForgeryToken]
  155. [AjaxOnly]
  156. public ActionResult ToCustomer(string keyValue)
  157. {
  158. chancebll.ToCustomer(keyValue);
  159. return Success("转换成功。");
  160. }
  161. #endregion
  162. }
  163. }