예제 #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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #4
0
        /// <summary>
        /// 通过IP获取DN和Place
        /// </summary>
        /// <returns></returns>
        public ActionResult GetPlaceDN()
        {
            var r = new AjaxReturn();

            r.d = SoftPhone.Business.IPDNBLL.GetPlaceDN(Request.UserHostAddress);
            if (r.d == null)
            {
                r.SetError(Request.UserHostAddress + ":没有找到对应的DN和Place");
            }
            return(Jsonp(r, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public ActionResult GetChatRightEnterID(int enterID, string machineNo)
        {
            AjaxReturn r = new AjaxReturn();

            try
            {
                if (!string.IsNullOrEmpty(machineNo))
                {
                    r.d = ProcBLL.Proc_GetChatRightEnterID(enterID, machineNo);
                }
                else
                {
                    r.SetError("machineNo是必须的");
                }
            }
            catch (Exception ex)
            {
                r.SetError(ex.Message);
            }
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public ActionResult CallSetDeskTime(string CallID, string EmployeeID)
        {
            var r = new AjaxReturn();

            try
            {
                Sphone_CallBLL.SetDeskTime(CallID, EmployeeID);
            }
            catch (Exception ex)
            {
                r.SetError(ex.Message);
            }
            return(Jsonp(r, JsonRequestBehavior.AllowGet));
        }
예제 #7
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));
        }
예제 #8
0
        public ActionResult CallCreate(string CallID, string EmployeeID, string ConnectionID, string ANI, string DNIS, int InOut, string CurrentQueueName, string FromQueueName)
        {
            var PlaceIP = Request.UserHostAddress;
            var r       = new AjaxReturn();

            try
            {
                Sphone_CallBLL.Create(CallID, EmployeeID, ConnectionID, ANI, DNIS, InOut, CurrentQueueName, FromQueueName, PlaceIP);
            }
            catch (Exception ex)
            {
                r.SetError(ex.Message);
            }
            return(Jsonp(r, JsonRequestBehavior.AllowGet));
        }
예제 #9
0
        public ActionResult CallEnd(string CallID, string EmployeeID, string CustomerID, string NextQueueName, int IsConference, int IsTransfer, int IsTransferEPOS)
        {
            var r = new AjaxReturn();

            try
            {
                if (!string.IsNullOrEmpty(CallID))
                {
                    Sphone_CallBLL.CallEnd(CallID, EmployeeID, CustomerID, NextQueueName, IsConference, IsTransfer, IsTransferEPOS);
                }
            }
            catch (Exception ex)
            {
                r.SetError(ex.Message);
            }
            return(Jsonp(r, JsonRequestBehavior.AllowGet));
        }
예제 #10
0
        /// <summary>
        /// 坐席登录订阅
        /// </summary>
        /// <param name="Person">SoftPhone.Entity.Model.cfg.Person</param>
        /// <returns></returns>
        public ActionResult OpenAgentStatistic(Person person)
        {
            var p = Request.QueryString["person"];

            person = Tele.Common.Helper.JsonHelper.Deserialize <Person>(p);
            var r = new AjaxReturn();

            try
            {
                var query = SupportClass.StatServerHelper.ALLStatisticItems.Values.Where(x =>
                                                                                         x.Opened == false &&
                                                                                         x.TypeID == 2 &&
                                                                                         x.RequireOpen == false &&
                                                                                         x.DBID == person.DBID
                                                                                         );
                foreach (var item in query)
                {
                    item.LastDate    = DateTime.Now;
                    item.RequireOpen = true;
                }

                var cachePersonShort = SupportClass.StatServerHelper.ALLPersons.FirstOrDefault(x => x.DBID == person.DBID);
                if (cachePersonShort != null)//zhangsl:2013.05.03 update 人可能会换座位,每次都要重新赋值
                {
                    cachePersonShort.AgentInfo.IsInitAgentInfo = true;
                    cachePersonShort.DN        = person.DN;
                    cachePersonShort.Place     = person.Place;
                    cachePersonShort.VOICE     = person.VOICE;
                    cachePersonShort.CHAT      = person.CHAT;
                    cachePersonShort.AgentInfo = (AgentInfo)person.AgentInfo.Clone();
                }
            }
            catch (Exception err)
            {
                r.SetError("发生错误:" + err.Message);
            }

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