Ejemplo n.º 1
0
        public void StartAgent(string name, bool isRefresh = false)
        {
            var cookies = this.Context.RequestCookies;

            if (cookies.ContainsKey("AdminID"))
            {
                var adminID = this.Context.RequestCookies["AdminID"].Value;

                AgentHelper agentHelper = new AgentHelper(_agentDataModel, _queueDataModel, _chatHub);
                var         agent       = agentHelper.RegisterAgent(name, new Guid(Context.ConnectionId), new Guid(adminID));

                if (agent != null && isRefresh)
                {
                    foreach (var activeChat in agent.ActiveChats)
                    {
                        _chatHub.StartChat(activeChat.ToString(), agent.ID.ToString());
                    }
                }
            }
        }