Exemplo n.º 1
0
        public virtual List <PhoneCommented> GetPhonesForSendingSms()
        {
            var result = new List <PhoneCommented>();
            ContactGroupOwner owner = null;
            var groups = new ContactGroupType[0];

            if (RootService is Client)
            {
                groups = new[] { ContactGroupType.OrderManagers };
                owner  = ((Client)RootService).ContactGroupOwner;
            }
            else if (RootService is Supplier)
            {
                groups = new[] { ContactGroupType.OrderManagers, ContactGroupType.ClientManagers };
                owner  = ((Supplier)RootService).ContactGroupOwner;
            }

            if (owner != null)
            {
                result = owner.GetPhones(groups).ToList();
                if (result.Count == 0)
                {
                    result = owner.GetPhones(ContactGroupType.General).ToList();
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        public virtual string GetAddressForSendingClientCard()
        {
            ContactGroupOwner owner = null;
            var groups = new ContactGroupType[0];

            if (RootService is Client)
            {
                groups = new[] { ContactGroupType.OrderManagers };
                owner  = ((Client)RootService).ContactGroupOwner;
            }
            else if (RootService is Supplier)
            {
                groups = new[] { ContactGroupType.OrderManagers, ContactGroupType.ClientManagers };
                owner  = ((Supplier)RootService).ContactGroupOwner;
            }

            if (owner == null)
            {
                return("");
            }

            var emails = owner.GetEmails(groups);

            if (emails.Any())
            {
                return(emails.Implode());
            }

            return(owner.GetEmails(ContactGroupType.General).Implode());
        }
Exemplo n.º 3
0
		public ContactIndex(
			int indexA,
			int indexB,
			ContactGroupType type,
			int keyIndex)
		{
			IndexA = indexA;
			IndexB = indexB;
			Type = type;
			KeyIndex = keyIndex;
		}
Exemplo n.º 4
0
 public ContactIndex(
     int indexA,
     int indexB,
     ContactGroupType type,
     int keyIndex)
 {
     IndexA   = indexA;
     IndexB   = indexB;
     Type     = type;
     KeyIndex = keyIndex;
 }
Exemplo n.º 5
0
        public virtual void MergePerson(ContactGroupType type, Person person)
        {
            var group = ContactGroupOwner.ContactGroups.FirstOrDefault(g => g.Type == type)
                        ?? ContactGroupOwner.AddContactGroup(type);

            var exists = group.Persons.FirstOrDefault(p => String.Equals(p.Name, person.Name, StringComparison.CurrentCultureIgnoreCase));

            if (exists == null)
            {
                group.Persons.Add(person);
                group.Adopt();
            }
            else
            {
                foreach (var contact in person.Contacts)
                {
                    if (!exists.Contacts.Any(c => c.Type == contact.Type && String.Equals(contact.ContactText, c.ContactText, StringComparison.CurrentCultureIgnoreCase)))
                    {
                        exists.AddContact(new Contact(contact.Type, contact.ContactText, contact.Comment));
                    }
                }
            }
        }
Exemplo n.º 6
0
 public virtual ContactGroup GetContactGroup(ContactGroupType type)
 {
     return(ContactGroupOwner.ContactGroups.FirstOrDefault(contactGroup => contactGroup.Type == type));
 }