public LoadContacts(
     IContactsProvider contactsProvider,
     IEventAggregator eventAggregator)
 {
     _contactsProvider = contactsProvider;
     _eventAggregator  = eventAggregator;
 }
 public RemoveContact(
     IContactsProvider contactsProvider,
     int contactIndex)
 {
     _contactsProvider = contactsProvider;
     _contactIndex     = contactIndex;
 }
Example #3
0
        public override void ServerSide(List <Connection> ServerConnections, Connection ThisConnection)
        {
            IContactsProvider ContactProvider = StaticFunctions.GetContactsProvider();

            //USE THE EXTERNAL LIBRARY TO GET THE CONTACTS FROM WHEREVER CONTACTS ARE PULLED
            this.ContactList = ContactProvider.GetContacts(ThisConnection.UserID).OrderBy(a => a.DName).OrderBy(a => a.Group).ToArray();

            //SET THE USER TO ONLINE IF THEY ARE FOUND IN OUR CONNECTED LIST
            foreach (Contact tmpContact in this.ContactList)
            {
                if ((from a in ServerConnections where a.UserID == tmpContact.UserID select a).Count() != 0)
                {
                    tmpContact.Online = true;
                }
            }

            //GET THE USERS LAST KNOWN STATE FROM OUR DB
            using (UserStateDataContext tmpDB = new UserStateDataContext())
            {
                //LOOP THROUGH ALL OFFLINE CONTACTS AND MARK THEM AS OFFLINE
                foreach (Contact tmpContact in (from a in this.ContactList where a.Online == false select a))
                {
                    tmpContact.LastStatus = "Offline";
                }

                //LOOP THROUGH ALL ONLINE CONTACTS AND TAKE THEIR STATUS FROM THE DATABASE
                foreach (Contact tmpContact in (from a in this.ContactList where a.Online == true select a))
                {
                    tmpContact.LastStatus = (from b in tmpDB.LastKnownStateItems where b.UserID == tmpContact.UserID select b.LastKnownState).FirstOrDefault();
                }
            }

            //SEND THIS BACK TO THE CLIENT
            Send(ThisConnection);
        }
 public StartRequestingForContacts(
     ICurrentContext currentContext,
     IEventAggregator eventAggregator,
     IContactsProvider contactsProvider)
 {
     _currentContext   = currentContext;
     _eventAggregator  = eventAggregator;
     _contactsProvider = contactsProvider;
 }
 public StartRequestingForContacts(
     ICurrentContext currentContext,
     IEventAggregator eventAggregator,
     IContactsProvider contactsProvider)
 {
     _currentContext = currentContext;
     _eventAggregator = eventAggregator;
     _contactsProvider = contactsProvider;
 }
Example #6
0
 public AddContact(
     IEventAggregator eventAggregator,
     IContactsProvider contactsProvider,
     IServerConnection serverConnection,
     ContactStoredData contactData)
 {
     _eventAggregator  = eventAggregator;
     _contactsProvider = contactsProvider;
     _serverConnection = serverConnection;
     _contactData      = contactData;
 }
Example #7
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);
        }
Example #8
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);
            }
        }
Example #9
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);
            }
        }
 public ContactsHub(IContactsProvider contactsProvider, ISecurityProvider securityProvider, ILoggerFactory loggerFactory)
 {
     _contactsProvider = contactsProvider;
     _securityProvider = securityProvider;
     _logger = loggerFactory.CreateLogger(GetType());
 }
 public FirstViewModel(IContactsProvider contactsProvider)
 {
     _contactsProvider = contactsProvider;
 }
 public ActionController(IContactsProvider contactsProvider)
 {
     _contactsProvider = contactsProvider;
 }
 public ContactsService(IContactsProvider contactsProvider)
 {
     _contactsProvider = contactsProvider;
 }
 public ContactsController(IContactsProvider provider)
 {
     _provider = provider;
 }
 public ActionController(IContactsProvider contactsProvider)
 {
     _contactsProvider = contactsProvider;
 }
Example #16
0
 public PollingController(IContactsProvider contactsProvider, IOrdersProvider ordersProvider)
 {
     _contactsProvider = contactsProvider;
     _ordersProvider   = ordersProvider;
 }
 public PollingController(IContactsProvider contactsProvider, IOrdersProvider ordersProvider)
 {
     _contactsProvider = contactsProvider;
     _ordersProvider = ordersProvider;
 }
 public DetailViewModel(IContactsProvider contactsProvider)
 {
     _contactsProvider = contactsProvider;
 }