Exemplo n.º 1
0
        private void PopulateMessageCollection()
        {
            var messageList = IMService.GetAllMessagesBetweenContacts(LoggedInUser, GetSelectedUser());

            foreach (var message in messageList)
            {
                MessagesCollection.Add(message);
            }
        }
Exemplo n.º 2
0
 private void SendButton_Click(object sender, RoutedEventArgs e)
 {
     if (MessageContent != null && MessageContent != "" && SelectedContact != null)
     {
         var message = new Message {
             Sender = LoggedInUser.Username, Receiver = SelectedContact.Username, TimeSent = DateTime.Now, Content = MessageContent
         };
         IMService.SendMessage(message);
         MessagesCollection.Add(message);
         MessageContent = "";
         SelectedContact.LastMessageContent = message.Content;
         SelectedContact.LastMessageTime    = message.TimeSent;
     }
 }
Exemplo n.º 3
0
        public static MessagesCollection Search(SearchFilter SearchKey)
        {
            MessagesCollection collection = new MessagesCollection();

            using (var reader = SqlHelper.ExecuteReader("Messages_Search", SearchFilterManager.SqlSearchDynParam(SearchKey)))
            {
                while (reader.Read())
                {
                    Messages obj = new Messages();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Exemplo n.º 4
0
        public static MessagesCollection GetbyUser(string CreatedUser, int CompanyID)
        {
            MessagesCollection collection = new MessagesCollection();
            Messages           obj;
            var sqlParams = new SqlParameter[]
            {
                new SqlParameter("@CreatedUser", CreatedUser),
                new SqlParameter("@CompanyID", CompanyID),
            };

            using (var reader = SqlHelper.ExecuteReader("Messages_GetAll_byUser", sqlParams))
            {
                while (reader.Read())
                {
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Exemplo n.º 5
0
        public static MessagesCollection GetAllItem(int CompanyID)
        {
            MessagesCollection collection = new MessagesCollection();

            var sqlParams = new SqlParameter[]
            {
                new SqlParameter("@CompanyID", CompanyID),
            };

            using (var reader = SqlHelper.ExecuteReader("Messages_GetAll", sqlParams))
            {
                while (reader.Read())
                {
                    Messages obj = new Messages();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Exemplo n.º 6
0
 private void CheckForNewMessagesAndContacts()
 {
     if (LoggedInUser != null && SelectedContact != null)
     {
         var messagesList = IMService.GetAllMessagesBetweenContacts(LoggedInUser, GetSelectedUser());
         foreach (var message in messagesList)
         {
             if (MessagesCollection.Count(c => c.Id == message.Id) == 0)
             {
                 MessagesCollection.Add(message);
             }
         }
         var contactsList = IMService.GetContacts(LoggedInUser);
         foreach (var contact in contactsList)
         {
             if (ContactsCollection.Count(c => c.Username == contact.Username) == 0)
             {
                 ContactsCollection.Add(contact);
                 AddToContactsDetails(contact);
             }
         }
     }
 }
		public void AddAndInsertThrowsException()
		{
			var messages = new MessagesCollection();
			Assert.Throws<NotSupportedException>(() => messages.Add(new Interfaces.Net.Message()));
			Assert.Throws<NotSupportedException>(() => messages.Insert(0, new Interfaces.Net.Message()));
		}