| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- using CallCenter.Utility;
- using CallCenterApi.Common;
- using CallCenterApi.Interface.Controllers.Base;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.tel
- {
- public class CallOutScreenController : BaseController
- {
- /// <summary>
- /// 当前用户最近电话列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetPhoneList()
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- int userId = CurrentUser.UserData.F_UserId;
- if (userId != 0)
- {
- Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
- if (ua != null)
- {
- string sql = " and UserCode='" + ua.F_WorkNumber + "'";
- DataTable dt = new DataTable();
-
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strcalltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (strcalltype.Trim() != "" && strcalltype != "undefined")
- {
- sql += " and CallType=" + strcalltype + " ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and CallNumber like '%" + strtel.Trim() + "%' ";
- }
- //else
- //{
- // sql += " and 1=0 ";
- //}
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,BeginTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,BeginTime,'" + strendtime + "')>=0 ";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Call_CallRecords",
- "CallRecordsId",
- "*",
- sql,
- "ORDER BY CallRecordsId desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- res = Content(obj.ToJson());
-
- }
- }
- }
- return res;
- }
- /// <summary>
- /// 公司电话列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetUserList()
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- string sql = " and F_DeleteFlag=0 ";//" and UserID="+ID;
- DataTable dt = new DataTable();
-
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_UserName like '%" + strname.Trim() + "%'";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_Telephone like '%" + strtel.Trim() + "%' or F_Mobile like '%" + strtel.Trim() + "%' or F_HomePhone like '%" + strtel.Trim() + "%' or F_WorkNumber like '%" + strtel.Trim() + "%') ";
- }
- //else
- //{
- // sql += " and 1=0 ";
- //}
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateOn,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateOn,'" + strendtime + "')>=0 ";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Sys_UserAccount",
- "F_UserId",
- "*",
- sql,
- "ORDER BY F_UserId desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- res = Content(obj.ToJson());
-
- }
- return res;
- }
- /// <summary>
- /// 获取客户电话列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetCustomerList()
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- string sql = "";//" and UserID="+ID;
- DataTable dt = new DataTable();
-
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CustomerName like '%" + strname.Trim() + "%'";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_Telephone like '%" + strtel.Trim() + "%' or F_Mobile like '%" + strtel.Trim() + "%' or F_ChargeTelephone like '%" + strtel.Trim() + "%') ";
- }
- //else
- //{
- // sql += " and 1=0 ";
- //}
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateOn,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateOn,'" + strendtime + "')>=0 ";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Cus_CustomerBase",
- "F_CustomerId",
- "*",
- sql,
- "ORDER BY F_CustomerId desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- res = Content(obj.ToJson());
-
- }
- return res;
- }
- }
- }
|