地铁二期项目正式开始

OCXOptController.cs 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using System.Data;
  7. namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
  8. {
  9. public class OCXOptController : BaseController
  10. {
  11. //
  12. // GET: /OCXOpt/
  13. public ActionResult OCXOptAjax()
  14. {
  15. return View();
  16. }
  17. /// <summary>
  18. /// 通话处理
  19. /// </summary>
  20. /// <param name="OCXOptCallAjax"></param>
  21. /// <returns></returns>
  22. [ActionName("OCXOptCallAjax")]
  23. [HttpGet]
  24. public string OCXOptCallAjax(string optaction,string timeno,string callid,string userid,string usercode,string username,string extnumber,string callernum,string path)
  25. {
  26. //&timeno=" + timeno+"&callid=" + callID + "&userid=" + userid + "&usercode=" + usercode
  27. //+ "&username=" + username + "&extnumber" + extnumber + "&callernum=" + callerNum
  28. AddAction("T_Call_CallRecords", callid, "通话处理",string.Format("事件:{0},callid={1},usercode={2},extnumber={3},callernum={4}", optaction, callid, usercode, extnumber, callernum),"关键信息");
  29. string res = "error";
  30. try
  31. {
  32. switch (optaction)
  33. {
  34. case "gethflist":
  35. //res=LoadHFList(context)
  36. break;
  37. case "getlist":
  38. //res=LoadList(context));
  39. break;
  40. case "getcallinlist":
  41. //来电弹屏通话记录
  42. //res=LoadCallInList(context));
  43. break;
  44. case "getgdlist":
  45. //
  46. //res=LoadGDList(context));
  47. break;
  48. case "deletelist":
  49. //res=Delete(context));
  50. break;
  51. case "clear":
  52. break;
  53. case "insertCallLogs":
  54. res = InsertCallLogs();
  55. break;
  56. case "getCallIdByPhone":
  57. //根据来电号码获取
  58. res = getCallIdByPhone(callernum);
  59. break;
  60. case "zhenlingEvent":
  61. //振铃事件
  62. res=zhenlingEvent(callid, userid, usercode, username, extnumber, callernum);
  63. break;
  64. case "zhaijiEvent":
  65. //摘机事件
  66. res=zhaijiEvent(callid);
  67. break;
  68. case "guajiEvent":
  69. //挂机事件
  70. res=guajiEvent(callid);
  71. break;
  72. case "luyinEvent":
  73. //录音开始事件
  74. res=luyinEvent(callid,path);
  75. break;
  76. case "callout":
  77. //外呼
  78. res = callout(callernum, userid, usercode, username, extnumber, callid);
  79. break;
  80. case "callouthf":
  81. //外呼回访
  82. res=callouthf(callernum, userid, usercode, username, extnumber, callid);
  83. break;
  84. }
  85. }
  86. catch
  87. { }
  88. return res;
  89. }
  90. #region 外呼回访
  91. public string callouthf(string phone, string userid, string usercode, string username, string extnumber, string hfid)
  92. {
  93. string res = "1||" + DateTime.Now.ToString("yyyyMMddHHmmssms");
  94. try
  95. {
  96. //处理判断本地或外地 zhgjie
  97. try
  98. {
  99. if (phone.Trim() != "")
  100. {
  101. //判断号码前是否存在0
  102. if (phone.Trim().Substring(0, 1) != "0")
  103. {
  104. //判断是否手机
  105. if (phone.Trim().Length > 10)
  106. {
  107. BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
  108. Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModel(phone.Substring(0, 7));
  109. if (mobileModel != null)
  110. {
  111. if (mobileModel.F_ZipCode != "0371")
  112. {
  113. phone = "0" + phone;
  114. }
  115. }
  116. }
  117. }
  118. }
  119. }
  120. catch
  121. { }
  122. Model.T_Call_CallRecords model = new Model.T_Call_CallRecords();
  123. model.CallId = DateTime.Now.ToString("yyyyMMddHHmmssms");
  124. model.CallNumber = phone;
  125. model.CallType = 1;
  126. if (!string.IsNullOrEmpty(userid))
  127. {
  128. model.UserId = Convert.ToInt32(userid);
  129. }
  130. if (!string.IsNullOrEmpty(usercode))
  131. {
  132. model.UserCode = usercode.Trim();
  133. }
  134. if (!string.IsNullOrEmpty(username))
  135. {
  136. model.UserName = HttpUtility.UrlDecode(username.Trim());
  137. //model.UserName=context.Request.Form["txtAgentName"]
  138. }
  139. if (!string.IsNullOrEmpty(extnumber))
  140. {
  141. model.ExtNumber = extnumber.Trim();
  142. //model.UserName=context.Request.Form["txtAgentName"]
  143. }
  144. model.CallState = 0;
  145. model.DealType = 7;
  146. model.IsDeal = 1;
  147. model.OperateType = 7;//回访
  148. model.OperateObject = "";
  149. model.OperateTime = DateTime.Now;
  150. try
  151. {
  152. if (hfid != "")
  153. {
  154. model.OperateObject = hfid;
  155. }
  156. }
  157. catch
  158. {
  159. }
  160. string cid = model.CallId;
  161. new BLL.T_Call_CallRecords().Add(model);
  162. try
  163. {
  164. //更新回访状态
  165. new BLL.T_Call_TaskTelNum().UpdateHC(Convert.ToInt32(hfid), 1);
  166. new BLL.T_Call_TaskTelNum().UpdateYJ(Convert.ToInt32(hfid), 0);
  167. //string workorderid = CommonRequest.GetQueryString("workorderid");
  168. //if (workorderid != "")
  169. //{
  170. // Model.T_Call_WorkOrder modelorder = new Model.T_Call_WorkOrder();
  171. // modelorder.CallId = model.CallId;
  172. // modelorder.F_WORKORDERID = Convert.ToInt32(workorderid);
  173. // modelorder.F_WORKORDERSTATEID = 6;
  174. // new BLL.T_Call_WorkOrder().Add(modelorder);
  175. //}
  176. }
  177. catch { }
  178. if (phone.Length > 5)
  179. {
  180. res = "2|" + phone + "|" + cid;
  181. }
  182. else
  183. {
  184. res = "1|" + phone + "|" + cid;
  185. }
  186. }
  187. catch { }
  188. return res;
  189. }
  190. #endregion
  191. #region 话机外呼
  192. public string callout(string phone,string userid,string usercode,string username,string extnumber,string workorderid)
  193. {
  194. string res = "1||" + DateTime.Now.ToString("yyyyMMddHHmmssms");
  195. try
  196. {
  197. //处理判断本地或外地 zhgjie
  198. try
  199. {
  200. if (phone.Trim() != "")
  201. {
  202. //判断号码前是否存在0
  203. if (phone.Trim().Substring(0, 1) != "0")
  204. {
  205. //判断是否手机
  206. if (phone.Trim().Length > 10)
  207. {
  208. BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
  209. Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModel(phone.Substring(0, 7));
  210. if (mobileModel != null)
  211. {
  212. if (mobileModel.F_ZipCode != "0371")
  213. {
  214. phone = "0" + phone;
  215. }
  216. }
  217. }
  218. }
  219. }
  220. }
  221. catch
  222. { }
  223. Model.T_Call_CallRecords model = new Model.T_Call_CallRecords();
  224. model.CallId = DateTime.Now.ToString("yyyyMMddHHmmssms");
  225. model.CallNumber = phone;
  226. model.CallType = 1;
  227. if (!string.IsNullOrEmpty(userid))
  228. {
  229. model.CallId = DateTime.Now.ToString("yyyyMMddHHmmssms") + userid;
  230. model.UserId = Convert.ToInt32(userid);
  231. }
  232. if (!string.IsNullOrEmpty(usercode))
  233. {
  234. model.UserCode = usercode.Trim();
  235. }
  236. if (!string.IsNullOrEmpty(username))
  237. {
  238. model.UserName = HttpUtility.UrlDecode(username.Trim());
  239. }
  240. if (!string.IsNullOrEmpty(extnumber))
  241. {
  242. model.ExtNumber = extnumber.Trim();
  243. //model.UserName=context.Request.Form["txtAgentName"]
  244. }
  245. model.CallState = 0;
  246. model.DealType = 6;
  247. model.IsDeal = 1;
  248. string cid = model.CallId;
  249. new BLL.T_Call_CallRecords().Add(model);
  250. try
  251. {
  252. if (workorderid != null)
  253. {
  254. if (workorderid != "")
  255. {
  256. Model.T_Call_WorkOrder modelorder = new Model.T_Call_WorkOrder();
  257. modelorder.CallId = model.CallId;
  258. modelorder.F_WORKORDERID = Convert.ToInt32(workorderid);
  259. modelorder.F_WORKORDERSTATEID = 6;
  260. new BLL.T_Call_WorkOrder().Add(modelorder);
  261. }
  262. }
  263. }
  264. catch { }
  265. if (phone.Length > 5)
  266. {
  267. res = "2|" + phone + "|" + cid;
  268. }
  269. else
  270. {
  271. res = "1|" + phone + "|" + cid;
  272. }
  273. }
  274. catch { }
  275. return res;
  276. }
  277. #endregion
  278. #region 电话操作日志
  279. public string InsertCallLogs()
  280. {
  281. string res = "error";
  282. return res;
  283. }
  284. #endregion
  285. #region 根据来电号码获取callid
  286. public string getCallIdByPhone(string telphone)
  287. {
  288. string res = "";
  289. try
  290. {
  291. Model.T_Call_CallRecords model = new BLL.T_Call_CallRecords().GetModelByTelphone(telphone);
  292. if (model != null)
  293. {
  294. res = model.CallId.Trim();
  295. }
  296. }
  297. catch (Exception ex)
  298. {
  299. res = "";
  300. }
  301. return res;
  302. }
  303. #endregion
  304. #region 来电归属地查询
  305. public string GetPhoneLocation(string phoneNumber, bool isPhone)
  306. {
  307. string location = "未知";
  308. try
  309. {
  310. //如果是手机号码
  311. if (isPhone)
  312. {
  313. BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
  314. Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModel(phoneNumber.Substring(0, 7));
  315. return mobileModel != null ? (mobileModel.F_CityDes + mobileModel.F_CardDes) : location;
  316. }
  317. else//如果是电话号码
  318. {
  319. BLL.T_Sys_TelTitleData numbBll = new BLL.T_Sys_TelTitleData();
  320. List<Model.T_Sys_TelTitleData> mobileModel = numbBll.GetModelList(" 1=1 and F_KeyPhoneNum='" + phoneNumber.Substring(0, 4) + "'");
  321. if (mobileModel == null || mobileModel.Count <= 0)
  322. mobileModel = numbBll.GetModelList(" 1=1 and F_KeyPhoneNum='" + phoneNumber.Substring(0, 3) + "'");
  323. return mobileModel.Count > 0 ? mobileModel[0].F_TitleName : location;
  324. }
  325. }
  326. catch (System.Exception ex)
  327. {
  328. return location;
  329. }
  330. }
  331. #endregion
  332. #region 自动添加工单
  333. public bool SubmitOSubmit(string phone,string recordid,string callid,string locationaddress,string userid,string username,string usercode, out int workorderid)
  334. {
  335. bool bl = false;
  336. workorderid = 0;
  337. try
  338. {
  339. Model.T_Wo_WorkOrderBase model = new Model.T_Wo_WorkOrderBase();
  340. List<Model.T_Wo_WorkOrderBase> modellist = new BLL.T_Wo_WorkOrderBase().GetModelList(" F_RANGEID="+ recordid);
  341. if (modellist != null && modellist.Count > 0)
  342. {
  343. model = modellist[0];
  344. #region 工单信息
  345. if (string.IsNullOrEmpty(model.F_LINKMAN))
  346. {
  347. //model.F_WORKORDERTYPEID = Convert.ToInt32(typeid);//类型ID
  348. model.F_WORKORDERSTATEID = 0;//状态ID
  349. model.F_REPAIRREQUEST = "未处理";
  350. model.F_CODE = "";//工单编号
  351. model.F_WORKORDERNAME = "";//工单名称
  352. model.F_NUMBER = model.F_CODE;
  353. //model.F_CUSTOMERNAME = txtCustomerName.Text.Trim();//客户姓名
  354. model.F_CUSTOMERTELEPHONE = phone.Trim();//客户电话
  355. model.F_USERID = Convert.ToInt32(userid);//坐席id
  356. model.F_LINKMAN = usercode.Trim();//坐席工号
  357. model.F_REPAIRMANNAME = username.Trim();//坐席名称
  358. model.F_LINKMANTELEPHONE = phone.Trim();//联系人电话
  359. //model.F_ADSLACCOUNT = hfCallId.Value.Trim();
  360. model.F_BANDWIDTH = "";
  361. model.F_STANDARDADDRESS = locationaddress.Trim();
  362. //model.F_INSTALLADDRESS = F_INSTALLADDRESS;
  363. model.F_KSHADDRESSCODE = callid;
  364. model.F_RANGEID = Convert.ToInt32(recordid);
  365. model.F_PROVINCE = "";
  366. model.F_CITY = "";
  367. model.F_AREA = "";
  368. model.F_ROAD = "";
  369. model.F_HOUSING = "";
  370. model.F_REPAIRMANID = 1;
  371. model.F_WORKORDERFROM = "语音工单";
  372. //model.F_WORKORDERLEVELID = F_WORKORDERLEVELID;
  373. model.F_FILEFLAG = 0;
  374. model.F_CREATEBY = Convert.ToInt32(userid.Trim());
  375. model.F_CREATEDATE = DateTime.Now;
  376. model.F_RETURNVISITFLAG = 0;
  377. model.F_RETURNVISITSTATE = 0;
  378. model.F_RETURNVISITRESULT = 0;
  379. model.F_RETURNVISITCONTENT = "";
  380. model.F_DELETEFLAG = 0;
  381. model.F_ALLUSETIMES = 0;
  382. model.F_STARTTIME = DateTime.Now;
  383. model.F_OVERTIMES = 0;
  384. model.F_FORMID = 0;
  385. model.F_HASTENCOUNTS = 0;
  386. model.F_RANGEX = 0;
  387. model.F_RANGEY = 0;
  388. model.F_REPAIRCLOSEMANID = 0;
  389. model.F_REPAIRCLOSEMANNAME = "";
  390. model.F_REPAIRCLOSEREASONS = "";
  391. model.F_REPAIRCLOSEREPTID = 0;
  392. model.F_REPAIRCLOSEREPT = "";
  393. new BLL.T_Wo_WorkOrderBase().Update(model);
  394. }
  395. workorderid = model.F_WORKORDERID;
  396. #endregion
  397. }
  398. else {
  399. #region 工单信息
  400. //model.F_WORKORDERTYPEID = Convert.ToInt32(typeid);//类型ID
  401. model.F_WORKORDERSTATEID = 0;//状态ID
  402. model.F_REPAIRREQUEST = "未处理";
  403. model.F_CODE = "";//工单编号
  404. model.F_WORKORDERNAME = "";//工单名称
  405. model.F_NUMBER = model.F_CODE;
  406. //model.F_CUSTOMERNAME = txtCustomerName.Text.Trim();//客户姓名
  407. model.F_CUSTOMERTELEPHONE = phone.Trim();//客户电话
  408. model.F_USERID = Convert.ToInt32(userid);//坐席id
  409. model.F_LINKMAN = usercode.Trim();//坐席工号
  410. model.F_REPAIRMANNAME = username.Trim();//坐席名称
  411. model.F_LINKMANTELEPHONE = phone.Trim();//联系人电话
  412. //model.F_ADSLACCOUNT = hfCallId.Value.Trim();
  413. model.F_BANDWIDTH = "";
  414. model.F_STANDARDADDRESS = locationaddress.Trim();
  415. //model.F_INSTALLADDRESS = F_INSTALLADDRESS;
  416. model.F_KSHADDRESSCODE = callid;
  417. model.F_RANGEID = Convert.ToInt32(recordid);
  418. model.F_PROVINCE = "";
  419. model.F_CITY = "";
  420. model.F_AREA = "";
  421. model.F_ROAD = "";
  422. model.F_HOUSING = "";
  423. model.F_REPAIRMANID = 1;
  424. model.F_WORKORDERFROM = "语音工单";
  425. //model.F_WORKORDERLEVELID = F_WORKORDERLEVELID;
  426. model.F_FILEFLAG = 0;
  427. model.F_CREATEBY = Convert.ToInt32(userid.Trim());
  428. model.F_CREATEDATE = DateTime.Now;
  429. model.F_RETURNVISITFLAG = 0;
  430. model.F_RETURNVISITSTATE = 0;
  431. model.F_RETURNVISITRESULT = 0;
  432. model.F_RETURNVISITCONTENT = "";
  433. model.F_DELETEFLAG = 0;
  434. model.F_ALLUSETIMES = 0;
  435. model.F_STARTTIME = DateTime.Now;
  436. model.F_OVERTIMES = 0;
  437. model.F_FORMID = 0;
  438. model.F_HASTENCOUNTS = 0;
  439. model.F_RANGEX = 0;
  440. model.F_RANGEY = 0;
  441. model.F_REPAIRCLOSEMANID = 0;
  442. model.F_REPAIRCLOSEMANNAME = "";
  443. model.F_REPAIRCLOSEREASONS = "";
  444. model.F_REPAIRCLOSEREPTID = 0;
  445. model.F_REPAIRCLOSEREPT = "";
  446. #endregion
  447. workorderid = new BLL.T_Wo_WorkOrderBase().Add(model);//添加基本信息
  448. }
  449. if (workorderid > 0)
  450. {
  451. bl = true;
  452. }
  453. else
  454. {
  455. bl = false;
  456. }
  457. }
  458. catch (Exception ex)
  459. {
  460. }
  461. return bl;
  462. }
  463. #endregion
  464. #region 处理振铃事件
  465. public string zhenlingEvent(string callid, string userid, string usercode, string username, string extnumber, string callernum)
  466. {
  467. string res = "error";
  468. try
  469. {
  470. Model.T_Call_CallRecords vmodel = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  471. if (vmodel != null)
  472. {
  473. #region 存在通话记录
  474. Model.T_Call_CallRecords model = new Model.T_Call_CallRecords();
  475. model.CallId = callid;
  476. if (!string.IsNullOrEmpty(userid))
  477. {
  478. model.UserId = Convert.ToInt32(userid);
  479. }
  480. if (!string.IsNullOrEmpty(usercode))
  481. {
  482. model.UserCode = usercode.Trim();
  483. }
  484. if (!string.IsNullOrEmpty(username))
  485. {
  486. model.UserName = HttpUtility.UrlDecode(username.Trim());
  487. //model.UserName=context.Request.Form["txtAgentName"]
  488. }
  489. if (!string.IsNullOrEmpty(extnumber))
  490. {
  491. model.ExtNumber = extnumber.Trim();
  492. //model.UserName=context.Request.Form["txtAgentName"]
  493. }
  494. model.DealType = 5;
  495. bool bl = new BLL.T_Call_CallRecords().UpdateCallInRingTelRecord(model);
  496. if (bl)
  497. {
  498. string phone = callernum;
  499. #region 来电归属地查询
  500. string location = "";
  501. //来电归属地查询
  502. if (phone.Trim().Length == 11 && phone.Substring(0, 1) != "0")
  503. {
  504. location = GetPhoneLocation(phone, true);
  505. }
  506. else
  507. {
  508. location = GetPhoneLocation(phone, false);
  509. }
  510. #endregion
  511. #region 创建工单
  512. int workorderid = 0;
  513. bool wobl = SubmitOSubmit(phone, vmodel.CallRecordsId.ToString(), callid, location, userid, username, usercode, out workorderid);
  514. if (wobl)
  515. {
  516. try
  517. {
  518. Model.T_Call_WorkOrder modelorder = new Model.T_Call_WorkOrder();
  519. modelorder.CallId = callid;
  520. modelorder.F_WORKORDERID = workorderid;
  521. modelorder.F_WORKORDERSTATEID = 0;
  522. new BLL.T_Call_WorkOrder().Add(modelorder);
  523. }
  524. catch { }
  525. res = workorderid.ToString();
  526. }
  527. #endregion
  528. }
  529. #endregion
  530. }
  531. else
  532. {
  533. Model.T_Call_CallRecords model = new Model.T_Call_CallRecords();
  534. model.CallId = callid;
  535. model.CallNumber = callernum.Trim();
  536. model.CallType = 0;
  537. if (!string.IsNullOrEmpty(userid))
  538. {
  539. //model.CallId = DateTime.Now.ToString("yyyyMMddHHmmssms") + CommonRequest.GetQueryString("userid");
  540. model.UserId = Convert.ToInt32(userid);
  541. }
  542. if (!string.IsNullOrEmpty(usercode))
  543. {
  544. model.UserCode = usercode.Trim();
  545. }
  546. if (!string.IsNullOrEmpty(username))
  547. {
  548. model.UserName = HttpUtility.UrlDecode(username.Trim());
  549. //model.UserName=context.Request.Form["txtAgentName"]
  550. }
  551. if (!string.IsNullOrEmpty(extnumber))
  552. {
  553. model.ExtNumber = extnumber.Trim();
  554. //model.UserName=context.Request.Form["txtAgentName"]
  555. }
  556. model.CallState = 0;
  557. model.DealType = 6;
  558. model.IsDeal = 1;
  559. string cid = model.CallId;
  560. int b = new BLL.T_Call_CallRecords().Add(model);
  561. if (b > 0)
  562. {
  563. string phone = callernum;
  564. #region 来电归属地查询
  565. string location = "";
  566. //来电归属地查询
  567. if (phone.Trim().Length == 11 && phone.Substring(0, 1) != "0")
  568. {
  569. location = GetPhoneLocation(phone, true);
  570. }
  571. else
  572. {
  573. location = GetPhoneLocation(phone, false);
  574. }
  575. #endregion
  576. #region 创建工单
  577. int workorderid = 0;
  578. bool wobl = SubmitOSubmit(phone, b.ToString(), callid, location, userid, username, usercode, out workorderid);
  579. if (wobl)
  580. {
  581. try
  582. {
  583. Model.T_Call_WorkOrder modelorder = new Model.T_Call_WorkOrder();
  584. modelorder.CallId = callid;
  585. modelorder.F_WORKORDERID = workorderid;
  586. modelorder.F_WORKORDERSTATEID = 0;
  587. new BLL.T_Call_WorkOrder().Add(modelorder);
  588. }
  589. catch { }
  590. res = workorderid.ToString();
  591. }
  592. #endregion
  593. }
  594. }
  595. }
  596. catch (Exception ex)
  597. {
  598. //res = ex.ToString();
  599. }
  600. return res;
  601. }
  602. #endregion
  603. #region 处理摘机事件
  604. public string zhaijiEvent(string callid)
  605. {
  606. string res = "error";
  607. try
  608. {
  609. Model.T_Call_CallRecords model = new Model.T_Call_CallRecords();
  610. model.CallId = callid;
  611. model.CallState = 1;
  612. model.DealType = 6;
  613. bool bl = new BLL.T_Call_CallRecords().UpdateCallInAnswerTelRecord(model);
  614. if (bl)
  615. {
  616. res = "success";
  617. //更新回访状态
  618. #region
  619. /*
  620. try
  621. {
  622. Model.T_Call_CallRecords vmodel = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  623. string type = vmodel.OperateType.ToString();
  624. if (type == "7")
  625. {
  626. new BLL.T_Call_TaskTelNum().UpdateYJ(Convert.ToInt32(vmodel.OperateObject.ToString()), 1);
  627. }
  628. }
  629. catch
  630. {
  631. }
  632. */
  633. #endregion
  634. }
  635. }
  636. catch (Exception ex)
  637. {
  638. res = ex.ToString();
  639. }
  640. return res;
  641. }
  642. #endregion
  643. #region 处理挂机事件
  644. public string guajiEvent(string callid)
  645. {
  646. string res = "error";
  647. try
  648. {
  649. bool bl = new BLL.T_Call_CallRecords().UpdateCallInHookTelRecord(callid);
  650. if (bl)
  651. {
  652. res = "success";
  653. }
  654. }
  655. catch (Exception ex)
  656. {
  657. res = ex.ToString();
  658. }
  659. return res;
  660. }
  661. #endregion
  662. #region 处理录音开始事件
  663. public string luyinEvent(string callid,string path)
  664. {
  665. string res = "error";
  666. try
  667. {
  668. Model.T_Call_CallRecords model = new Model.T_Call_CallRecords();
  669. model.CallId = callid;
  670. model.CallState = 1;
  671. model.DealType = 6;
  672. model.FilePath = path;
  673. bool bl = new BLL.T_Call_CallRecords().UpdateCallInPathTelRecord(model);
  674. if (bl)
  675. {
  676. res = "success";
  677. //更新回访状态
  678. try
  679. {
  680. Model.T_Call_CallRecords vmodel = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  681. string type = vmodel.OperateType.ToString();
  682. if (type == "7")
  683. {
  684. new BLL.T_Call_TaskTelNum().UpdateYJ(Convert.ToInt32(vmodel.OperateObject.ToString()), 1);
  685. }
  686. }
  687. catch
  688. {
  689. }
  690. }
  691. }
  692. catch (Exception ex)
  693. {
  694. res = ex.ToString();
  695. }
  696. return res;
  697. }
  698. #endregion
  699. }
  700. }