ExpensesController.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. namespace LeaRun.Application.Web.Areas.CustomerManage.Controllers
  7. {
  8. /// <summary>
  9. /// 版 本 6.1
  10. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  11. /// 创 建:佘赐雄
  12. /// 日 期:2016-04-20 11:23
  13. /// 描 述:费用支出
  14. /// </summary>
  15. public class ExpensesController : MvcControllerBase
  16. {
  17. private ExpensesBLL expensesbll = new ExpensesBLL();
  18. #region 视图功能
  19. /// <summary>
  20. /// 列表页面
  21. /// </summary>
  22. /// <returns></returns>
  23. [HttpGet]
  24. public ActionResult Index()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 表单页面
  30. /// </summary>
  31. /// <returns></returns>
  32. [HttpGet]
  33. public ActionResult ExpensesForm()
  34. {
  35. return View();
  36. }
  37. #endregion
  38. #region 获取数据
  39. /// <summary>
  40. /// 获取列表
  41. /// </summary>
  42. /// <param name="pagination">分页参数</param>
  43. /// <param name="queryJson">查询参数</param>
  44. /// <returns>返回分页列表Json</returns>
  45. [HttpGet]
  46. public ActionResult GetPageListJson(Pagination pagination, string queryJson)
  47. {
  48. var watch = CommonHelper.TimerStart();
  49. var data = expensesbll.GetPageList(pagination, queryJson);
  50. var jsonData = new
  51. {
  52. rows = data,
  53. total = pagination.total,
  54. page = pagination.page,
  55. records = pagination.records,
  56. costtime = CommonHelper.TimerEnd(watch)
  57. };
  58. return ToJsonResult(jsonData);
  59. }
  60. /// <summary>
  61. /// 获取列表
  62. /// </summary>
  63. /// <param name="queryJson">查询参数</param>
  64. /// <returns>返回列表Json</returns>
  65. [HttpGet]
  66. public ActionResult GetListJson(string queryJson)
  67. {
  68. var data = expensesbll.GetList(queryJson);
  69. return ToJsonResult(data);
  70. }
  71. /// <summary>
  72. /// 获取实体
  73. /// </summary>
  74. /// <param name="keyValue">主键值</param>
  75. /// <returns>返回对象Json</returns>
  76. [HttpGet]
  77. public ActionResult GetFormJson(string keyValue)
  78. {
  79. var data = expensesbll.GetEntity(keyValue);
  80. return ToJsonResult(data);
  81. }
  82. #endregion
  83. #region 提交数据
  84. /// <summary>
  85. /// 删除数据
  86. /// </summary>
  87. /// <param name="keyValue">主键值</param>
  88. /// <returns></returns>
  89. [HttpPost]
  90. [ValidateAntiForgeryToken]
  91. [AjaxOnly]
  92. public ActionResult RemoveForm(string keyValue)
  93. {
  94. expensesbll.RemoveForm(keyValue);
  95. return Success("删除成功。");
  96. }
  97. /// <summary>
  98. /// 保存表单(新增)
  99. /// </summary>
  100. /// <param name="entity">实体对象</param>
  101. /// <returns></returns>
  102. [HttpPost]
  103. [ValidateAntiForgeryToken]
  104. [AjaxOnly]
  105. public ActionResult SaveForm(ExpensesEntity entity)
  106. {
  107. expensesbll.SaveForm(entity);
  108. return Success("操作成功。");
  109. }
  110. #endregion
  111. }
  112. }