PartitionManageController.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using LeaRun.Application.Busines.DMAManage;
  2. using LeaRun.Application.Code;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Web;
  7. using System.Web.Mvc;
  8. namespace LeaRun.Application.Web.Areas.DMAManage.Controllers
  9. {
  10. public class PartitionManageController : MvcControllerBase
  11. {
  12. // DMA分区管理功能
  13. // GET: /WaterWellManage/Alert/
  14. PartitionsManageBLL manageBLL = new PartitionsManageBLL();
  15. #region 视图功能
  16. public ActionResult Index()
  17. {
  18. return View();
  19. }
  20. public ActionResult AddDMAForm()
  21. {
  22. return View();
  23. }
  24. #endregion
  25. #region 获取DMA分区信息
  26. /// <summary>
  27. /// 获取DMA分区信息
  28. /// </summary>
  29. /// <param name="DMACode"></param>
  30. /// <returns></returns>
  31. [HttpGet]
  32. public ActionResult GetDMAData(string DMACode)
  33. {
  34. return Content(manageBLL.GetDMAData(DMACode));
  35. }
  36. #endregion
  37. #region 修改DMA分区信息
  38. /// <summary>
  39. /// 修改DMA分区信息
  40. /// </summary>
  41. /// <param name="data"></param>
  42. /// <returns></returns>
  43. [HttpPost]
  44. [ValidateAntiForgeryToken]
  45. [AjaxOnly]
  46. public ActionResult EditDMAData(string data)
  47. {
  48. string userId = OperatorProvider.Provider.Current().UserId;
  49. string companyId = OperatorProvider.Provider.Current().CompanyId;
  50. switch (manageBLL.EditDMAData(data, userId, companyId))
  51. {
  52. case 0:
  53. return Error("修改失败。");
  54. case 1:
  55. return Success("修改成功。");
  56. case 2:
  57. return Error("已存在该名称分区。");
  58. default:
  59. return Error("修改失败。");
  60. }
  61. }
  62. #endregion
  63. #region 添加DMA分区信息
  64. /// <summary>
  65. /// 添加DMA分区信息
  66. /// </summary>
  67. /// <param name="keyValue"></param>
  68. /// <param name="data"></param>
  69. /// <returns></returns>
  70. [HttpPost]
  71. [ValidateAntiForgeryToken]
  72. [AjaxOnly]
  73. public ActionResult AddDMAData(string keyValue, string data)
  74. {
  75. string userId = OperatorProvider.Provider.Current().UserId;
  76. string companyId = OperatorProvider.Provider.Current().CompanyId;
  77. switch (manageBLL.AddDMAData(keyValue, data, userId, companyId))
  78. {
  79. case 0:
  80. return Error("添加失败。");
  81. case 1:
  82. return Success("添加成功。");
  83. case 2:
  84. return Error("已存在该名称分区。");
  85. default:
  86. return Error("添加失败。");
  87. }
  88. }
  89. #endregion
  90. #region 删除DMA分区信息
  91. /// <summary>
  92. /// 删除DMA分区信息
  93. /// </summary>
  94. /// <param name="keyValue"></param>
  95. /// <returns></returns>
  96. [HttpPost]
  97. [ValidateAntiForgeryToken]
  98. [AjaxOnly]
  99. public ActionResult DeleteDMAData(string keyValue)
  100. {
  101. int result = manageBLL.DeleteDMAData(keyValue);
  102. switch (result) {
  103. case 0:
  104. return Error("删除失败!");
  105. case 1:
  106. return Success("删除成功。");
  107. case 2:
  108. return Error("删除失败,DMA考核表关系表中存在依赖数据!");
  109. case 3:
  110. return Error("删除失败,该分区有未删除的子分区!");
  111. default:
  112. return Error("删除失败!");
  113. }
  114. }
  115. #endregion
  116. }
  117. }