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
        /// <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.º 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, 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));
        }