| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- using CallCenter.Utility;
- using CallCenterApi.Interface.Controllers.Base;
- using CallCenterApi.Interface.Models.Filter;
- using CallCenterApi.Interface.Models.Input;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.callout
- {
- public class BanCallOutController : BaseController
- {
- private readonly BLL.T_Call_BanCallOut banCallOutBLL = new BLL.T_Call_BanCallOut();
- private readonly BLL.T_Sys_BanCallOutTime banCallOutTimeBLL = new BLL.T_Sys_BanCallOutTime();
- #region 禁止外呼号码管理
- public ActionResult GetList(FilterBanCallOut filter)
- {
- StringBuilder sb = new StringBuilder();
- if (!string.IsNullOrWhiteSpace(filter.Phone))
- {
- sb.Append($" and F_Phone='{filter.Phone}'");
- }
- //if (filter.Start != null && filter.End != null)
- //{
- // sb.Append($" and F_Phone='{filter.Phone}'");
- //}
- var recordCount = 0;
- var dt = BLL.PagerBLL.GetListPager(
- "T_Call_BanCallOut",
- "F_Id",
- "*",
- sb.ToString(),
- "ORDER BY F_ID desc",
- filter.PageSize,
- filter.PageIndex,
- true,
- out recordCount);
- List<Model.T_Call_BanCallOut> modelList = new BLL.T_Call_BanCallOut().DataTableToList(dt);
- var obj = new
- {
- rows = modelList,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- public ActionResult Add(BanCallOutInput input)
- {
- if (string.IsNullOrWhiteSpace(input.Phone))
- return Error("号码不可为空");
- var model = banCallOutBLL.GetModel(input.Phone);
- if (model != null)
- return Error("该号码已被限制外呼");
- if (banCallOutBLL.Add(new Model.T_Call_BanCallOut()
- {
- F_Phone = input.Phone,
- F_Remark = input.Remark
- }) > 0)
- return Success("添加成功");
- return Error("添加失败");
- }
- public ActionResult Delete(int[] ids)
- {
- if (ids == null || ids.Length <= 0)
- return Error("请选择需要删除的项");
- var idsStr = string.Join(",", ids);
- banCallOutBLL.DeleteBatch(idsStr);
- return Success("删除成功");
- }
- #endregion
- #region 限制外呼时间管理
- public ActionResult GetBanCallOutTimeList(FilterBanCallOut filter)
- {
- StringBuilder sb = new StringBuilder();
- if (!string.IsNullOrWhiteSpace(filter.Phone))
- {
- sb.Append($" and F_Phone='{filter.Phone}'");
- }
- //if (filter.Start != null && filter.End != null)
- //{
- // sb.Append($" and F_Phone='{filter.Phone}'");
- //}
- var recordCount = 0;
- var dt = BLL.PagerBLL.GetListPager(
- "T_Sys_BanCallOut",
- "F_Id",
- "*",
- sb.ToString(),
- "ORDER BY F_ID desc",
- filter.PageSize,
- filter.PageIndex,
- true,
- out recordCount);
- List<Model.T_Sys_BanCallOutTime> modelList = new BLL.T_Sys_BanCallOutTime().DataTableToList(dt);
- var obj = new
- {
- rows = modelList,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- public ActionResult AddBanCallOutTime(BanCallOutInput input)
- {
- if (string.IsNullOrWhiteSpace(input.Phone))
- return Error("号码不可为空");
- var model = banCallOutBLL.GetModel(input.Phone);
- if (model != null)
- return Error("该号码已被限制外呼");
- if (banCallOutBLL.Add(new Model.T_Call_BanCallOut()
- {
- F_Phone = input.Phone,
- F_Remark = input.Remark
- }) > 0)
- return Success("添加成功");
- return Error("添加失败");
- }
- public ActionResult DeleteBanCallOutTime(int[] ids)
- {
- if (ids == null || ids.Length <= 0)
- return Error("请选择需要删除的项");
- var idsStr = string.Join(",", ids);
- banCallOutBLL.DeleteBatch(idsStr);
- return Success("删除成功");
- }
- #endregion
- }
- }
|