Ejemplo n.º 1
0
        public ActionResult ChatEnd(string chatID)
        {
            var result = new AjaxReturn();

            try
            {
                if (string.IsNullOrEmpty(chatID))
                {
                    throw new Exception("传入的参数 chatID 不可为空值!");
                }
                SPhone_Chat entity = SPhone_ChatBLL.GetChat(chatID);
                if (entity == null)
                {
                    throw new Exception(String.Format("找不到需要更新的记录! ChatID:{0}", chatID));
                }
                entity.UpdateBy    = entity.EmployeeID;
                entity.ChatEndTime = DateTime.Now;
                entity.UpdateTime  = DateTime.Now;
                SPhone_ChatBLL.Update <SPhone_Chat>(entity);
            }
            catch (Exception ex)
            {
                result.SetError(ex.Message);
            }
            return(Jsonp(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public JsonResult GetWelcomeWords(string enterID)
        {
            List <string> words = new List <string>();

            try
            {
                int eid = 9999;
                int.TryParse(enterID, out eid);
                string queueName = SoftPhone.Business.EnterID2SkillBLL.GetSkillName(eid);
                words = SPhone_ChatBLL.GetChatTextList(queueName, "欢迎话术");
                if (words.Count == 0)
                {
                    string defaultWelcomeText = System.Configuration.ConfigurationManager.AppSettings["welcomeText"];
                    if (string.IsNullOrEmpty(defaultWelcomeText))
                    {
                        defaultWelcomeText = "用户,您好!";
                    }
                    words.Add(defaultWelcomeText);
                }
            }
            catch { }
            // 替换时间
            string        dataKey   = Tele.Common.Utils.GetDateKey();
            List <string> realWords = new List <string>();

            words.ForEach(w =>
            {
                string item = w.Replace("$$DataKey$$", dataKey);
                realWords.Add(item);
            });
            return(Jsonp(realWords, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新Chat记录
        /// </summary>
        /// <param name="chatID"></param>
        /// <param name="nextQueue"></param>
        /// <param name="isMeeting"></param>
        /// <param name="jsonMessageData"></param>
        /// <returns></returns>
        public ActionResult ChatUpdate(string chatID, string nextQueue, int isMeeting, int isRTO, string jsonMessageData)
        {
            var result = new AjaxReturn();

            try
            {
                if (string.IsNullOrEmpty(chatID))
                {
                    throw new Exception("传入的参数 chatID 不可为空值!");
                }
                SPhone_Chat entity = SPhone_ChatBLL.GetChat(chatID);
                entity.NextQueueName = nextQueue;
                entity.IsConference  = isMeeting;
                entity.IsRTO         = isRTO;
                entity.ContentText   = jsonMessageData;
                entity.UpdateBy      = entity.EmployeeID;
                entity.ChatEndTime   = DateTime.Now;
                entity.UpdateTime    = entity.ChatEndTime;
                if (entity == null)
                {
                    throw new Exception(String.Format("找不到需要更新的记录! ChatID:{0}", chatID));
                }
                SPhone_ChatBLL.Update <SPhone_Chat>(entity);
            }
            catch (Exception ex)
            {
                result.SetError(ex.Message);
            }
            return(Jsonp(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 更新Chat记录
        /// </summary>
        /// <param name="chatID"></param>
        /// <param name="nextQueue"></param>
        /// <param name="isMeeting"></param>
        /// <param name="jsonMessageData"></param>
        /// <returns></returns>
        public ActionResult ChatUpdate(string chatID, string nextQueue, int isMeeting, int isRTO, string jsonMessageData, string chatEndDate, string customerIP, string customerLocation)
        {
            var result = new AjaxReturn();

            try
            {
                if (string.IsNullOrEmpty(chatID))
                {
                    throw new Exception("传入的参数 chatID 不可为空值!");
                }
                if (!string.IsNullOrEmpty(jsonMessageData))
                {
                    jsonMessageData = jsonMessageData.Trim('"');
                }

                DateTime endTime = DateTime.Now;

                if (!string.IsNullOrEmpty(chatEndDate))
                {
                    try
                    {
                        endTime = DateTime.Parse(chatEndDate.Trim('"'));
                    }
                    catch { }
                }

                //try
                //{
                //    string chatContent = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(jsonMessageData));
                //    if (!string.IsNullOrEmpty(chatContent))
                //    {
                //        // 获取最后一条,作为chat的结束时间
                //    }
                //}
                //catch { }

                SPhone_Chat entity = SPhone_ChatBLL.GetChat(chatID);
                entity.NextQueueName = nextQueue;
                entity.IsConference  = isMeeting;
                entity.IsRTO         = isRTO;
                entity.ContentText   = jsonMessageData;
                entity.UpdateBy      = entity.EmployeeID;
                entity.ChatEndTime   = endTime;
                entity.UpdateTime    = endTime;
                entity.CustomerIP    = customerIP;
                entity.IPLocation    = customerLocation;
                if (entity == null)
                {
                    throw new Exception(String.Format("找不到需要更新的记录! ChatID:{0}", chatID));
                }
                SPhone_ChatBLL.Update <SPhone_Chat>(entity);
            }
            catch (Exception ex)
            {
                result.SetError(ex.Message);
            }
            return(Jsonp(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取常用链接列表
        /// </summary>
        public JsonResult GetChatLinks(string queueName)
        {
            List <string> texts = new List <string>();

            try
            {
                texts = SPhone_ChatBLL.GetChatTextList(queueName, "常用链接");
            }
            catch { }
            return(Jsonp(texts, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取话术列表
        /// typeName 先进行UrlEncode转码
        /// </summary>
        public JsonResult GetChatTexts(string queueName, string typeName)
        {
            List <string> texts = new List <string>();

            try
            {
                typeName = HttpUtility.UrlDecode(typeName);
                texts    = SPhone_ChatBLL.GetChatTextList(queueName, typeName);
            }
            catch { }
            return(Jsonp(texts, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 查询历史记录
        /// </summary>
        /// <param name="chatID">聊天ID</param>
        /// <returns></returns>
        public JsonResult GetChatHistoryByID(string chatID)
        {
            List <string> formatMessages = new List <string>();

            try
            {
                SPhone_Chat chat = SPhone_ChatBLL.GetChat(chatID);
                formatMessages = GetChatText(chat, string.Empty);
            }
            catch { }
            return(Jsonp(formatMessages, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 根据客户名称查看是否在黑名单里
        /// </summary>
        /// <param name="CustName"></param>
        /// <returns></returns>
        public ActionResult IsChatInBlack(string CustName)
        {
            List <int> result = new List <int>();

            try
            {
                result.Add(SPhone_ChatBLL.IsChatInBlack(CustName));
            }
            catch
            {
            }
            return(Jsonp(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 获取历史记录
        /// 2013-06-14 添加根据主机编号检索
        /// </summary>
        /// <param name="employeeID"></param>
        /// <param name="machineNO"></param>
        /// <param name="chatID"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public JsonResult GetChatHistory(string employeeID, string machineNO, string customerID, string beginTime, string endTime)
        {
            List <SPhone_Chat> chats = new List <SPhone_Chat>();

            try
            {
                DateTime beginDate = DateTime.Parse(beginTime);
                DateTime endDate   = DateTime.Parse(endTime).AddDays(1).AddSeconds(-1);
                chats = SPhone_ChatBLL.GetChatList(employeeID, beginDate, endDate, machineNO, customerID);
            }
            catch { }
            return(Jsonp(chats, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 创建Chat记录
        /// </summary>
        /// <param name="enterID"></param>
        /// <param name="inneractionID"></param>
        /// <param name="fromQueue"></param>
        /// <param name="currentQueue"></param>
        /// <param name="customerID"></param>
        /// <param name="customerName"></param>
        /// <param name="machineNo"></param>
        /// <param name="mailAddress"></param>
        /// <param name="agentID"></param>
        /// <param name="isTransfer"></param>
        /// <param name="isRTO"></param>
        /// <param name="isMeeting"></param>
        /// <returns></returns>
        public ActionResult ChatCreate(string chatID, string enterID, string inneractionID, string fromQueue, string currentQueue
                                       , long?customerID, string customerName, string machineNo, string mailAddress
                                       , string agentID, long?beginDate, int isTransfer, int isMeeting)
        {
            var         result = new AjaxReturn();
            SPhone_Chat entity = new SPhone_Chat();

            entity.CreateBy = agentID;
            long ticks = Convert.ToInt64(beginDate);

            if (ticks == 0)
            {
                ticks = DateTime.Now.Ticks;
            }
            entity.CreateTime    = DateTime.MinValue.AddMilliseconds(ticks / 10000);
            entity.ChatBeginTime = entity.CreateTime;
            entity.ChatEndTime   = entity.CreateTime;

            entity.ChatID       = chatID;
            entity.ConnectionID = inneractionID;

            entity.CustomerID   = Convert.ToInt64(customerID);
            entity.CustomerName = customerName;
            entity.Enterid      = enterID;
            entity.MachineNo    = machineNo;
            entity.MailAddress  = mailAddress;
            //entity.ServicecardNo = "";
            //entity.WSISID = "";

            entity.EmployeeID       = agentID;
            entity.PlaceIP          = this.Request.UserHostAddress;
            entity.FromQueueName    = fromQueue;
            entity.CurrentQueueName = currentQueue;
            //entity.NextQueueName = "";
            entity.ContentText = string.Empty;

            entity.IsConference = isMeeting;
            entity.IsRTO        = 0;
            entity.IsTransfer   = isTransfer;
            try
            {
                SPhone_ChatBLL.AddNewChat(entity);
            }
            catch (Exception ex)
            {
                result.SetError(ex.Message);
            }
            return(Jsonp(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 查询常用语
        /// </summary>
        /// <param name="category">常用语类别</param>
        /// <returns></returns>
        public JsonResult GetCommonWords(string queueName)
        {
            List <string> words = SPhone_ChatBLL.GetChatTextList(queueName, "常用话术");

            return(Jsonp(words, JsonRequestBehavior.AllowGet));
        }