鄂尔多斯-招源科技

CallOutScreenController.cs 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. using CallCenter.Utility;
  2. using CallCenterApi.Common;
  3. using CallCenterApi.Interface.Controllers.Base;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Web;
  9. using System.Web.Mvc;
  10. namespace CallCenterApi.Interface.Controllers.tel
  11. {
  12. public class CallOutScreenController : BaseController
  13. {
  14. /// <summary>
  15. /// 当前用户最近电话列表
  16. /// </summary>
  17. /// <returns></returns>
  18. public ActionResult GetPhoneList()
  19. {
  20. ActionResult res = NoToken("未知错误,请重新登录");
  21. if (Request.IsAuthenticated)
  22. {
  23. int userId = CurrentUser.UserData.F_UserId;
  24. if (userId != 0)
  25. {
  26. Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
  27. if (ua != null)
  28. {
  29. string sql = " and UserCode='" + ua.F_WorkNumber + "'";
  30. DataTable dt = new DataTable();
  31. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  32. string strcalltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
  33. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  34. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  35. string strpageindex = RequestString.GetQueryString("page");
  36. int pageindex = 1;
  37. string strpagesize = RequestString.GetQueryString("pagesize");
  38. int pagesize = 10;
  39. if (strcalltype.Trim() != "" && strcalltype != "undefined")
  40. {
  41. sql += " and CallType=" + strcalltype + " ";
  42. }
  43. if (strtel.Trim() != "" && strtel != "undefined")
  44. {
  45. sql += " and CallNumber like '%" + strtel.Trim() + "%' ";
  46. }
  47. //else
  48. //{
  49. // sql += " and 1=0 ";
  50. //}
  51. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  52. {
  53. sql += " and datediff(day,BeginTime,'" + strstarttime + "')<=0 ";
  54. }
  55. if (strendtime.Trim() != "" && strendtime != "undefined")
  56. {
  57. sql += " and datediff(day,BeginTime,'" + strendtime + "')>=0 ";
  58. }
  59. if (strpageindex.Trim() != "")
  60. {
  61. pageindex = Convert.ToInt32(strpageindex);
  62. }
  63. if (strpagesize.Trim() != "")
  64. {
  65. pagesize = Convert.ToInt32(strpagesize);
  66. }
  67. int recordCount = 0;
  68. dt = BLL.PagerBLL.GetListPager(
  69. "T_Call_CallRecords",
  70. "CallRecordsId",
  71. "*",
  72. sql,
  73. "ORDER BY CallRecordsId desc",
  74. pagesize,
  75. pageindex,
  76. true,
  77. out recordCount);
  78. var obj = new
  79. {
  80. state = "success",
  81. message = "成功",
  82. rows = dt,
  83. total = recordCount
  84. };
  85. res = Content(obj.ToJson());
  86. }
  87. }
  88. }
  89. return res;
  90. }
  91. /// <summary>
  92. /// 公司电话列表
  93. /// </summary>
  94. /// <returns></returns>
  95. public ActionResult GetUserList()
  96. {
  97. ActionResult res = NoToken("未知错误,请重新登录");
  98. if (Request.IsAuthenticated)
  99. {
  100. string sql = " and F_DeleteFlag=0 ";//" and UserID="+ID;
  101. DataTable dt = new DataTable();
  102. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  103. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  104. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  105. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  106. string strpageindex = RequestString.GetQueryString("page");
  107. int pageindex = 1;
  108. string strpagesize = RequestString.GetQueryString("pagesize");
  109. int pagesize = 10;
  110. if (strname.Trim() != "" && strname != "undefined")
  111. {
  112. sql += " and F_UserName like '%" + strname.Trim() + "%'";
  113. }
  114. if (strtel.Trim() != "" && strtel != "undefined")
  115. {
  116. 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() + "%') ";
  117. }
  118. //else
  119. //{
  120. // sql += " and 1=0 ";
  121. //}
  122. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  123. {
  124. sql += " and datediff(day,F_CreateOn,'" + strstarttime + "')<=0 ";
  125. }
  126. if (strendtime.Trim() != "" && strendtime != "undefined")
  127. {
  128. sql += " and datediff(day,F_CreateOn,'" + strendtime + "')>=0 ";
  129. }
  130. if (strpageindex.Trim() != "")
  131. {
  132. pageindex = Convert.ToInt32(strpageindex);
  133. }
  134. if (strpagesize.Trim() != "")
  135. {
  136. pagesize = Convert.ToInt32(strpagesize);
  137. }
  138. int recordCount = 0;
  139. dt = BLL.PagerBLL.GetListPager(
  140. "T_Sys_UserAccount",
  141. "F_UserId",
  142. "*",
  143. sql,
  144. "ORDER BY F_UserId desc",
  145. pagesize,
  146. pageindex,
  147. true,
  148. out recordCount);
  149. var obj = new
  150. {
  151. state = "success",
  152. message = "成功",
  153. rows = dt,
  154. total = recordCount
  155. };
  156. res = Content(obj.ToJson());
  157. }
  158. return res;
  159. }
  160. /// <summary>
  161. /// 获取客户电话列表
  162. /// </summary>
  163. /// <returns></returns>
  164. public ActionResult GetCustomerList()
  165. {
  166. ActionResult res = NoToken("未知错误,请重新登录");
  167. if (Request.IsAuthenticated)
  168. {
  169. string sql = "";//" and UserID="+ID;
  170. DataTable dt = new DataTable();
  171. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  172. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  173. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  174. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  175. string strpageindex = RequestString.GetQueryString("page");
  176. int pageindex = 1;
  177. string strpagesize = RequestString.GetQueryString("pagesize");
  178. int pagesize = 10;
  179. if (strname.Trim() != "" && strname != "undefined")
  180. {
  181. sql += " and F_CustomerName like '%" + strname.Trim() + "%'";
  182. }
  183. if (strtel.Trim() != "" && strtel != "undefined")
  184. {
  185. sql += " and (F_Telephone like '%" + strtel.Trim() + "%' or F_Mobile like '%" + strtel.Trim() + "%' or F_ChargeTelephone like '%" + strtel.Trim() + "%') ";
  186. }
  187. //else
  188. //{
  189. // sql += " and 1=0 ";
  190. //}
  191. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  192. {
  193. sql += " and datediff(day,F_CreateOn,'" + strstarttime + "')<=0 ";
  194. }
  195. if (strendtime.Trim() != "" && strendtime != "undefined")
  196. {
  197. sql += " and datediff(day,F_CreateOn,'" + strendtime + "')>=0 ";
  198. }
  199. if (strpageindex.Trim() != "")
  200. {
  201. pageindex = Convert.ToInt32(strpageindex);
  202. }
  203. if (strpagesize.Trim() != "")
  204. {
  205. pagesize = Convert.ToInt32(strpagesize);
  206. }
  207. int recordCount = 0;
  208. dt = BLL.PagerBLL.GetListPager(
  209. "T_Cus_CustomerBase",
  210. "F_CustomerId",
  211. "*",
  212. sql,
  213. "ORDER BY F_CustomerId desc",
  214. pagesize,
  215. pageindex,
  216. true,
  217. out recordCount);
  218. var obj = new
  219. {
  220. state = "success",
  221. message = "成功",
  222. rows = dt,
  223. total = recordCount
  224. };
  225. res = Content(obj.ToJson());
  226. }
  227. return res;
  228. }
  229. }
  230. }