鄂尔多斯-招源科技

BanCallOutController.cs 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. using CallCenter.Utility;
  2. using CallCenterApi.Interface.Controllers.Base;
  3. using CallCenterApi.Interface.Models.Filter;
  4. using CallCenterApi.Interface.Models.Input;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Web;
  10. using System.Web.Mvc;
  11. namespace CallCenterApi.Interface.Controllers.callout
  12. {
  13. public class BanCallOutController : BaseController
  14. {
  15. private readonly BLL.T_Call_BanCallOut banCallOutBLL = new BLL.T_Call_BanCallOut();
  16. private readonly BLL.T_Sys_BanCallOutTime banCallOutTimeBLL = new BLL.T_Sys_BanCallOutTime();
  17. #region 禁止外呼号码管理
  18. public ActionResult GetList(FilterBanCallOut filter)
  19. {
  20. StringBuilder sb = new StringBuilder();
  21. if (!string.IsNullOrWhiteSpace(filter.Phone))
  22. {
  23. sb.Append($" and F_Phone='{filter.Phone}'");
  24. }
  25. //if (filter.Start != null && filter.End != null)
  26. //{
  27. // sb.Append($" and F_Phone='{filter.Phone}'");
  28. //}
  29. var recordCount = 0;
  30. var dt = BLL.PagerBLL.GetListPager(
  31. "T_Call_BanCallOut",
  32. "F_Id",
  33. "*",
  34. sb.ToString(),
  35. "ORDER BY F_ID desc",
  36. filter.PageSize,
  37. filter.PageIndex,
  38. true,
  39. out recordCount);
  40. List<Model.T_Call_BanCallOut> modelList = new BLL.T_Call_BanCallOut().DataTableToList(dt);
  41. var obj = new
  42. {
  43. rows = modelList,
  44. total = recordCount
  45. };
  46. return Content(obj.ToJson());
  47. }
  48. public ActionResult Add(BanCallOutInput input)
  49. {
  50. if (string.IsNullOrWhiteSpace(input.Phone))
  51. return Error("号码不可为空");
  52. var model = banCallOutBLL.GetModel(input.Phone);
  53. if (model != null)
  54. return Error("该号码已被限制外呼");
  55. if (banCallOutBLL.Add(new Model.T_Call_BanCallOut()
  56. {
  57. F_Phone = input.Phone,
  58. F_Remark = input.Remark
  59. }) > 0)
  60. return Success("添加成功");
  61. return Error("添加失败");
  62. }
  63. public ActionResult Delete(int[] ids)
  64. {
  65. if (ids == null || ids.Length <= 0)
  66. return Error("请选择需要删除的项");
  67. var idsStr = string.Join(",", ids);
  68. banCallOutBLL.DeleteBatch(idsStr);
  69. return Success("删除成功");
  70. }
  71. #endregion
  72. #region 限制外呼时间管理
  73. public ActionResult GetBanCallOutTimeList(FilterBanCallOut filter)
  74. {
  75. StringBuilder sb = new StringBuilder();
  76. if (!string.IsNullOrWhiteSpace(filter.Phone))
  77. {
  78. sb.Append($" and F_Phone='{filter.Phone}'");
  79. }
  80. //if (filter.Start != null && filter.End != null)
  81. //{
  82. // sb.Append($" and F_Phone='{filter.Phone}'");
  83. //}
  84. var recordCount = 0;
  85. var dt = BLL.PagerBLL.GetListPager(
  86. "T_Sys_BanCallOut",
  87. "F_Id",
  88. "*",
  89. sb.ToString(),
  90. "ORDER BY F_ID desc",
  91. filter.PageSize,
  92. filter.PageIndex,
  93. true,
  94. out recordCount);
  95. List<Model.T_Sys_BanCallOutTime> modelList = new BLL.T_Sys_BanCallOutTime().DataTableToList(dt);
  96. var obj = new
  97. {
  98. rows = modelList,
  99. total = recordCount
  100. };
  101. return Content(obj.ToJson());
  102. }
  103. public ActionResult AddBanCallOutTime(BanCallOutInput input)
  104. {
  105. if (string.IsNullOrWhiteSpace(input.Phone))
  106. return Error("号码不可为空");
  107. var model = banCallOutBLL.GetModel(input.Phone);
  108. if (model != null)
  109. return Error("该号码已被限制外呼");
  110. if (banCallOutBLL.Add(new Model.T_Call_BanCallOut()
  111. {
  112. F_Phone = input.Phone,
  113. F_Remark = input.Remark
  114. }) > 0)
  115. return Success("添加成功");
  116. return Error("添加失败");
  117. }
  118. public ActionResult DeleteBanCallOutTime(int[] ids)
  119. {
  120. if (ids == null || ids.Length <= 0)
  121. return Error("请选择需要删除的项");
  122. var idsStr = string.Join(",", ids);
  123. banCallOutBLL.DeleteBatch(idsStr);
  124. return Success("删除成功");
  125. }
  126. #endregion
  127. }
  128. }