예제 #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("聊天尚未开启");
            }
        }
예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #5
0
        public static void ChatRequest(Visitor v)
        {
            ChatTeam ct = new ChatTeam
            {
                Visitor = v,
                Gid     = System.Guid.NewGuid().ToString(),
                Enable  = false
            };

            Dal.InsertChatTeam(ct);
        }
예제 #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));
            }
        }
예제 #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);
            }
        }
예제 #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("该客服未在聊天列表中");
            }
        }
예제 #9
0
 public static void UpdateChatTeam(ChatTeam ct)
 {
 }
예제 #10
0
 public static void InsertChatTeam(ChatTeam ct)
 {
 }