Пример #1
0
        public override void ServerSide(List <Connection> ServerConnections, Connection ThisConnection)
        {
            IContactsProvider ContactProvider = StaticFunctions.GetContactsProvider();

            //RETURN THE LIST OF USERS WHO ARE ATTACHED TO THIS CONVERSATION SO THE TITLE OF A WINDOW MAY BE UPDATED
            using (ConversationDataContext tmpDB = new ConversationDataContext())
            {
                this.Recipients = (from a in tmpDB.ConversationMembers where a.ConversationItem.ConversationGUID == this.ConversationID select ContactProvider.UserNameFromID(a.UserID)).ToArray();
            }

            //SEND THE MESSAGE TO THE CLIENT
            Send(ThisConnection);
        }
Пример #2
0
        public override void ServerSide(List <Connection> ServerConnections, Connection ThisConnection)
        {
            IContactsProvider ContactProvider = StaticFunctions.GetContactsProvider();

            using (ConversationDataContext tmpDB = new ConversationDataContext())
            {
                long[]             ConvIDS  = (from a in tmpDB.ConversationMembers where a.UserID == ThisConnection.UserID select a.ConversationID).ToArray();
                ConversationItem[] ConvList = (from a in tmpDB.ConversationItems where ConvIDS.Contains(a.ConversationID) select a).ToArray();

                //GET THE RECENT MESSAGES FROM THE DATABASE
                this.RecentList = (from a in ConvList where a.MessageItems.Count() > 0 && a.DateCreated > DateTime.Now.AddDays(this.DaysToSearch * -1) select new Conversation()
                {
                    Date = a.DateCreated, Preview = ((Message_Private)MessageWrapper.UnPackageFromTCP(a.MessageItems.First().MessageData.ToArray(), true)).Message, Recipients = string.Join("; ", a.ConversationMembers.Select(b => ContactProvider.UserNameFromID(b.UserID)).OrderBy(c => c).ToArray()), MessageCount = a.MessageItems.Count(), ConversationID = a.ConversationGUID
                }).OrderBy(a => a.Date).Reverse().ToArray();

                //SEND THE INFORMATION BACK TO THE USER
                Send(ThisConnection);
            }
        }
Пример #3
0
        public override void ServerSide(List <Connection> ServerConnections, Connection ThisConnection)
        {
            IContactsProvider ContactProvider = StaticFunctions.GetContactsProvider();

            using (ConversationDataContext tmpDB = new ConversationDataContext())
            {
                long[] ConvIDS = (from a in tmpDB.MissedConversationItems where a.UserID == ThisConnection.UserID select a.MissedMessageID).ToArray();

                //CREATE THE LIST OF CONVERSATIONS WHICH WE ARE SENDING BACK TO THE USER
                this.MissedConversations = (from a in tmpDB.MissedConversationItems where ConvIDS.Contains(a.MissedMessageID) && a.ConversationItem.MessageItems.Count() > 0 select new Conversation()
                {
                    ConversationID = a.ConversationItem.ConversationGUID, Date = a.ConversationItem.DateCreated, MessageCount = a.ConversationItem.MessageItems.Count(), Recipients = string.Join("; ", a.ConversationItem.ConversationMembers.Select(b => ContactProvider.UserNameFromID(b.UserID)).ToArray())
                }).ToArray();

                //IF THERE ARE MISSED CONVERSATIONS THEN REPLY TO THE USER
                Send(ThisConnection);
            }
        }