Ejemplo n.º 1
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            string text = propertyBag.GetValueOrDefault <string>(InternalSchema.PartnerNetworkId, null);

            if (string.IsNullOrEmpty(text))
            {
                text = WellKnownNetworkNames.Outlook;
            }
            else if (text == WellKnownNetworkNames.QuickContacts)
            {
                string valueOrDefault = propertyBag.GetValueOrDefault <string>(InternalSchema.ParentDisplayName, null);
                if ("{06967759-274D-40B2-A3EB-D7F9E73727D7}" != valueOrDefault)
                {
                    text = valueOrDefault;
                }
                else
                {
                    text = ServerStrings.PeopleQuickContactsAttributionDisplayName;
                }
            }
            else if (!WellKnownNetworkNames.IsWellKnownExternalNetworkName(text))
            {
                text = WellKnownNetworkNames.Outlook;
            }
            return(text);
        }
        internal static IList <ContactLinkingSuggestion> GetSuggestions(CultureInfo culture, IList <ContactInfoForSuggestion> personContacts, IEnumerable <ContactInfoForSuggestion> otherContacts)
        {
            Dictionary <PersonId, ContactLinkingSuggestion> dictionary = new Dictionary <PersonId, ContactLinkingSuggestion>();

            foreach (ContactInfoForSuggestion contactInfoForSuggestion in otherContacts)
            {
                if (!WellKnownNetworkNames.IsHiddenSourceNetworkName(contactInfoForSuggestion.PartnerNetworkId, contactInfoForSuggestion.ParentDisplayName))
                {
                    foreach (ContactInfoForSuggestion personContact in personContacts)
                    {
                        ContactLinkingSuggestion contactLinkingSuggestion = ContactLinkingSuggestion.Create(culture, personContact, contactInfoForSuggestion);
                        if (contactLinkingSuggestion != null)
                        {
                            ContactLinkingSuggestion b;
                            if (dictionary.TryGetValue(contactLinkingSuggestion.PersonId, out b))
                            {
                                if (ContactLinkingSuggestion.Compare(contactLinkingSuggestion, b) > 0)
                                {
                                    dictionary[contactLinkingSuggestion.PersonId] = contactLinkingSuggestion;
                                }
                            }
                            else
                            {
                                dictionary.Add(contactLinkingSuggestion.PersonId, contactLinkingSuggestion);
                            }
                        }
                    }
                }
            }
            List <ContactLinkingSuggestion> list = new List <ContactLinkingSuggestion>(dictionary.Values);

            list.Sort(new Comparison <ContactLinkingSuggestion>(ContactLinkingSuggestion.Compare));
            if (list.Count > ContactLinkingSuggestion.MaximumSuggestions.Value)
            {
                list.RemoveRange(ContactLinkingSuggestion.MaximumSuggestions.Value, list.Count - ContactLinkingSuggestion.MaximumSuggestions.Value);
            }
            return(list);
        }