Beispiel #1
0
        public void SearchEmailInPerson()
        {
            var user     = DataMother.CreateSupplierUser();
            var supplier = (Supplier)user.RootService;

            var email        = "*****@*****.**";
            var contactGroup = new ContactGroup {
                Type              = ContactGroupType.General,
                Specialized       = true,
                Name              = email,
                ContactGroupOwner = supplier.ContactGroupOwner
            };

            session.Save(contactGroup);
            contactGroup.AddPerson("testPerson");
            contactGroup.Persons.Last().AddContact(ContactType.Email, email);
            user.ContactGroup = contactGroup;
            session.SaveOrUpdate(user);
            Flush();
            filter.SearchBy   = SearchUserBy.ByContacts;
            filter.SearchText = email;
            var result = filter.Find();

            Assert.That(result.Count, Is.EqualTo(1));
            Assert.That(result[0].ClientId, Is.EqualTo(supplier.Id));
        }
Beispiel #2
0
 public virtual void UpdatePersons(Person[] persons, Person[] deletedPersons)
 {
     if (persons == null || persons.Length == 0)
     {
         return;
     }
     if (ContactGroup == null)
     {
         AddContactGroup();
         foreach (var person in persons)
         {
             ContactGroup.AddPerson(person.Name);
         }
         return;
     }
     ContactGroup.UpdatePersons(persons, deletedPersons);
 }
Beispiel #3
0
 public virtual void AddContactPerson(string name)
 {
     if (String.IsNullOrEmpty(name))
     {
         return;
     }
     if (ContactGroup == null)
     {
         var groupOwner = Client.ContactGroupOwner;
         var group      = groupOwner.AddContactGroup(ContactGroupType.General, true);
         group.Save();
         group.AddPerson(name);
         ContactGroup = group;
     }
     else
     {
         ContactGroup.AddPerson(name);
     }
 }