Example #1
0
        public static string SendMessage(Visitor V, string Gid, string content)
        {
            ChatTeam ct = Dal.GetChatTeamByGid(Gid);

            if (ct != null)
            {
                if (ct.Visitor == V)
                {
                    ChatMessage cm = new ChatMessage
                    {
                        TeamGid    = Gid,
                        SendID     = V.ID,
                        PersonType = Person.Visitor,
                        Msg        = content,
                        SendTime   = DateTime.Now
                    };
                    Dal.InsertChatMessage(cm);
                    return(content);
                }
                else
                {
                    return("访客不在聊天列表中");
                }
            }
            else
            {
                return("聊天尚未开启");
            }
        }
Example #2
0
        public static void JoinChat(Agent A, string Gid)
        {
            ChatTeam ct = Dal.GetChatTeamByGid(Gid, A);

            if (ct == null)
            {
                ct.Agents.Add(A);
                Dal.UpdateChatTeam(ct);
            }
        }
Example #3
0
        public static void RemoveChat(Agent A, string Gid)
        {
            ChatTeam ct = Dal.GetChatTeamByGid(Gid, A);

            if (ct != null)
            {
                ct.Agents.Remove(A);

                Dal.UpdateChatTeam(ct);
            }
        }
Example #4
0
        public static void ChatAccept(Agent A, string Gid)
        {
            ChatTeam ct = Dal.GetChatTeamByGid(Gid);

            if (ct == null)
            {
                ct.Enable = true;
                ct.Agents.Add(A);
                Dal.UpdateChatTeam(ct);
            }
        }
Example #5
0
        public static void ChatRequest(Visitor v)
        {
            ChatTeam ct = new ChatTeam
            {
                Visitor = v,
                Gid     = System.Guid.NewGuid().ToString(),
                Enable  = false
            };

            Dal.InsertChatTeam(ct);
        }
Example #6
0
        public static List <ChatMessage> AcceptMessage(Agent A, string Gid)
        {
            ChatTeam ct = Dal.GetChatTeamByGid(Gid, A);

            if (ct != null)
            {
                return(Dal.AcceptMessage(Gid));
            }
            else
            {
                JoinChat(A, Gid);
                return(AcceptMessage(A, Gid));
            }
        }
Example #7
0
        public static List <ChatMessage> AcceptMessage(Visitor V, string Gid)
        {
            ChatTeam ct = Dal.GetChatTeamByGid(Gid);

            if (ct != null)
            {
                if (ct.Visitor == V)
                {
                    return(Dal.AcceptMessage(Gid));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Example #8
0
        public static string SendMessage(Agent A, string Gid, string content)
        {
            ChatTeam ct = Dal.GetChatTeamByGid(Gid, A);

            if (ct != null)
            {
                ChatMessage cm = new ChatMessage
                {
                    TeamGid    = Gid,
                    SendID     = A.ID,
                    PersonType = Person.Agent,
                    Msg        = content,
                    SendTime   = DateTime.Now
                };
                Dal.InsertChatMessage(cm);
                return(content);
            }
            else
            {
                return("该客服未在聊天列表中");
            }
        }
Example #9
0
 public static void UpdateChatTeam(ChatTeam ct)
 {
 }
Example #10
0
 public static void InsertChatTeam(ChatTeam ct)
 {
 }