Exemple #1
0
        public static RecipientAddress ResolveAnrStringToOneOffEmail(string name, AnrManager.Options options)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            RecipientAddress recipientAddress = null;
            Participant      participant;

            if (AnrManager.TryParseParticipant(name, options, out participant) && (!options.OnlyAllowDefaultRoutingType || options.IsDefaultRoutingType(participant.RoutingType)))
            {
                recipientAddress                   = new RecipientAddress();
                recipientAddress.DisplayName       = participant.DisplayName;
                recipientAddress.AddressOrigin     = RecipientAddress.ToAddressOrigin(participant);
                recipientAddress.RoutingAddress    = (AnrManager.IsMobileNumberInput(participant, options) ? participant.DisplayName : participant.EmailAddress);
                recipientAddress.RoutingType       = participant.RoutingType;
                recipientAddress.SmtpAddress       = ((participant.RoutingType == "SMTP") ? participant.EmailAddress : null);
                recipientAddress.MobilePhoneNumber = ((participant.RoutingType == "MOBILE") ? participant.EmailAddress : null);
                StoreParticipantOrigin storeParticipantOrigin = participant.Origin as StoreParticipantOrigin;
                if (storeParticipantOrigin != null)
                {
                    recipientAddress.StoreObjectId     = storeParticipantOrigin.OriginItemId;
                    recipientAddress.EmailAddressIndex = storeParticipantOrigin.EmailAddressIndex;
                }
            }
            return(recipientAddress);
        }
Exemple #2
0
        private static AnrManager.NameParsingResult ParseNameBeforeAnr(string name, AnrManager.Options options)
        {
            AnrManager.NameParsingResult result = new AnrManager.NameParsingResult(name);
            Participant participant;

            if (AnrManager.TryParseParticipant(name, options, out participant))
            {
                result.ParsedSuccessfully = true;
                result.RoutingType        = participant.RoutingType;
                result.RoutingAddress     = participant.EmailAddress;
            }
            return(result);
        }