Пример #1
0
        public override Task OnDisconnected(bool stopCalled)
        {
            UserPrincipal user = Context.User as UserPrincipal;

            GroupsHelper.RemoveUserFromAllGroups(user.Id);
            return(base.OnDisconnected(stopCalled));
        }
Пример #2
0
 public void SendToGroup(MessageInfo messageInfo)
 {
     ProcessFactory.GetDiscussionProcess().InsertMessage(Convert.ToInt32(messageInfo.ChannelName), messageInfo.UserId, messageInfo.Message);
     Clients.Group(messageInfo.ChannelName).receiveMessage(messageInfo.ChannelName, messageInfo.UserId, messageInfo.UserName, messageInfo.Message);
     Clients.Group(OWNER_GROUP_NAME).notifyOwners(messageInfo.ChannelName, messageInfo.UserId, messageInfo.UserName, messageInfo.Message);
     GroupsHelper.MarkUnReadForOfflineUsers(messageInfo.ChannelName);
 }
Пример #3
0
        public Task RemoveFromGroup(string channelName)
        {
            UserPrincipal user = Context.User as UserPrincipal;

            GroupsHelper.RemoveUserFromGroup(channelName, user.Id);

            return(Groups.Remove(Context.ConnectionId, channelName));
        }
Пример #4
0
        public void SendFile(FileInfo fileInfo)
        {
            int ideaId = Convert.ToInt32(fileInfo.ChannelName);

            ProcessFactory.GetDiscussionProcess().InsertFile(ideaId, fileInfo.UserId, fileInfo.FileId);
            FileDataObject file = ProcessFactory.GetFileProcess().FetchThumbnail(fileInfo.FileId, ideaId);

            Clients.Group(fileInfo.ChannelName).receiveFile(fileInfo.ChannelName, fileInfo.UserId, fileInfo.UserName, fileInfo.FileId, file.Name, file.ThumbnailBase64, file.ContentType, file.IsImage);
            Clients.Group(OWNER_GROUP_NAME).notifyOwners(fileInfo.ChannelName, fileInfo.UserId, fileInfo.UserName, null);
            GroupsHelper.MarkUnReadForOfflineUsers(fileInfo.ChannelName);
        }
Пример #5
0
        public Task AddToGroup(string channelName)
        {
            int           creatorUserId = ProcessFactory.GetIdeaProcess().GetCreatorUserId(Convert.ToInt32(channelName));
            UserPrincipal user          = Context.User as UserPrincipal;

            if (user.Id != creatorUserId)
            {
                Clients.User(creatorUserId.ToString()).joinGroup(channelName);
            }
            GroupsHelper.AddUserToGroup(channelName, user.Id);
            return(Groups.Add(Context.ConnectionId, channelName));
        }