public static ContactsCollection GetContactsByCustClientID(int clientId) { ContactsCollection contact = new ContactsCollection(); contact.LoadByCustClientID(clientId); return(contact); }
private void LoadContacts(ICollection <ContactUi> contacts) { ContactsCollection.Clear(); foreach (var contactUi in contacts) { ContactsCollection.Add(contactUi); } }
public void GivenANewContactsCollection_WhenAddingAContact_ThenANewContactShouldBeFoundAtPosition0() { ContactsCollection cc = new ContactsCollection(); cc.Add("name", "phoneNumber"); Assert.AreEqual("name", cc[0].Name); Assert.AreEqual("phoneNumber", cc[0].PhoneNumber); ContactsCollection people = cc.Where(checkIfPhoneNumberStrtsWith06); ContactsCollection people2 = cc.Where(contact => contact.PhoneNumber.StartsWith("06")); }
public void AddContactButton_RaiseContactAddedEvent(object sender, ContactAddedEventArgs e) { var contact = IMService.GetUser(e.Username); if (contact != null) { IMService.AddContact(LoggedInUser, contact); ContactsCollection.Add(contact); ContactsDetails.Add(new ContactDetails { Username = contact.Username, FirstName = contact.FirstName, LastName = contact.LastName }); } }
/// <summary> /// Ctor. /// </summary> public ContactsProvider(IContacts contacts, IMessages messages, TaskFactory sync) { this.contacts = contacts; this.sync = sync; contacts.UserAdded += Contacts_UserAdded; contacts.UserRemoved += Contacts_UserRemoved; contacts.UserChanged += Contacts_UserChanged; messages.NewMessage += Messages_NewMessage; Contacts = new ContactsCollection(); }
public static ContactsCollection GetAllItem() { ContactsCollection collection = new ContactsCollection(); using (var reader = SqlHelper.ExecuteReader("Contacts_GetAll", null)) { while (reader.Read()) { Contacts obj = new Contacts(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static ContactsCollection GetbyUser(string CreatedUser) { ContactsCollection collection = new ContactsCollection(); Contacts obj; using (var reader = SqlHelper.ExecuteReader("Contacts_GetAll_byUser", new SqlParameter("@CreatedUser", CreatedUser))) { while (reader.Read()) { obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
private int upperIndexTextInView = 4; //the upper index of the texts currently being displayed (or will be display) #endregion Fields #region Constructors //private TextMessageOptions.CollectionType collectionType; //constructor public TextMessageCollection(string incomingFileName, CollectionType type) { fileName = incomingFileName; //int intType = (int)type; collectionType = type; cc = ps.cc; if (fileName != "") { fileData = FileManager.Load (fileName); LoadSavedTexts (); SetUpperIndexTextInViewToTop (); } }
private void DeleteSelectedContact() { IMService.DeleteContact(LoggedInUser, GetSelectedUser()); foreach (var contact in ContactsCollection.ToList()) { if (contact.Username == SelectedContact.Username) { ContactsCollection.Remove(contact); } } foreach (var message in MessagesCollection.ToList()) { MessagesCollection.Remove(message); } ResetContactsDetails(); }
private void InitContactsCollection(List <User> contactList) { if (ContactsCollection == null) { ContactsCollection = new ObservableCollection <User>(); } else { foreach (var contact in ContactsCollection.ToList()) { ContactsCollection.Remove(contact); } } foreach (var contact in contactList) { ContactsCollection.Add(contact); } }
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); } } } }
// Use this for initialization //TurnOnPhone() void Start() { tsc = gameObject.GetComponent<TextStringCreation>(); cs = (CanvasScript) canvas.GetComponent<CanvasScript>(); cs.ResetAllLines (); tmm = new TextMessageMenu(); mm = new MainMenu (); inboxTexts = new TextMessageCollection (inboxTextsJson, TextMessageCollection.CollectionType.Inbox); outboxTexts = new TextMessageCollection (outboxTextsJson, TextMessageCollection.CollectionType.Outbox); draftTexts = new TextMessageCollection (draftTextsJson, TextMessageCollection.CollectionType.Drafts); newlyWrittenText = new TextMessageCollection ("", TextMessageCollection.CollectionType.Create); cc = new ContactsCollection (); cc.LoadSavedContacts (); MainMenu.SetState (MainMenu.MainMenuState.Messages); TextMessageMenu.SetState (TextMessageMenu.TextMessageMenuState.Inbox); numberOnScreen = ""; HandleHasUnreadMessages (); SetViewToHomeScreen (); if (hasReception) { receptionIcon.GetComponent<SpriteRenderer> ().sprite = hasReceptionSprite; } else { receptionIcon.GetComponent<SpriteRenderer> ().sprite = noReceptionSprite; } //example of adding a new contact //Contact c5 = new Contact ("lisa", "1234567"); //cc.AddContactToContacts (c5, true); //example of adding a new inbox text //TextMessage txt1 = new TextMessage ("1234", "content txt1"); //inboxTexts.HandleNewIncomingText(txt1, true); //example of adding a new outbox text //TextMessage outText = new TextMessage ("me", "my text message"); //outboxTexts.AddTextToTexts(outText); }
//display a list of the texts on the screen //texts are shown as "date time sender (inbox)/recipient (outbox)" public void SetViewToTextMessageCollection() { cc = ps.cc; //update it in case Contacts has been changed int index = 1; int count = 0; if (textsLength == 0) { cs.SetLineContent(index, "No messages", false); cs.SetNavRightText (""); } else { foreach (TextMessage text in texts) { if (count >= lowerIndexTextInView && count <= upperIndexTextInView) { //ps.hasUnreadTexts = ps.hasUnreadTexts || !text.m_read; string senderNumber = ""; if (collectionType == CollectionType.Inbox) { senderNumber = text.GetSender(); } else { senderNumber = text.GetRecipient(); } string str = GetDateTimeFromTimestamp(text.GetTimestamp()) + " " + GetContactFromNumber(senderNumber, text.IsTraceable()); bool selected = index == selectedTextIndex+1; text.SetIsSelected(selected); cs.SetLineContent(index, str, selected); index += 1; } count += 1; } if (collectionType != CollectionType.Drafts) cs.SetNavRightText ("Read"); else cs.SetNavRightText ("Edit"); } ps.HandleHasUnreadMessages (); cs.SetHeadingText("Message Inbox"); cs.SetNavLeftText ("Back"); if (collectionType == CollectionType.Inbox) { PhoneState.SetState (PhoneState.State.TextMessageInbox); } else if (collectionType == CollectionType.Outbox) { PhoneState.SetState (PhoneState.State.TextMessageOutbox); } else if (collectionType == CollectionType.Drafts) { PhoneState.SetState(PhoneState.State.TextMessageDrafts); } }
private async void OnDeleteContact(ContactUi contactUi) { await _contactServiceAdapter.DeleteContactByxIdAsync(contactUi.Id); ContactsCollection.Remove(contactUi); }