Exemple #1
0
        public static void JoinChat(LoginUser loginUser, int id, ChatParticipantType type, int chatID, string ipAddress)
        {
            ChatMessages    messages = new ChatMessages(loginUser);
            ChatParticipant part     = (new ChatParticipants(loginUser)).AddNewChatParticipant();

            part.ChatID          = chatID;
            part.DateJoined      = DateTime.UtcNow;
            part.ParticipantID   = id;
            part.ParticipantType = type;
            part.IPAddress       = ipAddress;
            part.LastTyped       = DateTime.UtcNow.AddYears(-10);
            part.LastMessageID   = messages.GetLastMessageID(chatID);
            part.Collection.Save();

            part = ChatParticipants.GetChatParticipant(loginUser, id, type, chatID);
            if (part == null)
            {
                return;
            }

            AddNotification(loginUser, chatID, id, type, string.Format("{0} {1} has joined the chat.", part.FirstName, part.LastName));
        }