コード例 #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);
        }
コード例 #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());
        }
コード例 #3
0
		public ContactIndex(
			int indexA,
			int indexB,
			ContactGroupType type,
			int keyIndex)
		{
			IndexA = indexA;
			IndexB = indexB;
			Type = type;
			KeyIndex = keyIndex;
		}
コード例 #4
0
 public ContactIndex(
     int indexA,
     int indexB,
     ContactGroupType type,
     int keyIndex)
 {
     IndexA   = indexA;
     IndexB   = indexB;
     Type     = type;
     KeyIndex = keyIndex;
 }
コード例 #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));
                    }
                }
            }
        }
コード例 #6
0
 public virtual ContactGroup GetContactGroup(ContactGroupType type)
 {
     return(ContactGroupOwner.ContactGroups.FirstOrDefault(contactGroup => contactGroup.Type == type));
 }