Example #1
0
        private EmailUser GetEmailUser(string username)
        {
            if (username == null) return null;
            EmailUser user = (EmailUser)emailPublisher.EmailUsers[username];

            // if user is not specified in the project config,
            // use the converters to create the email address from the sourcecontrol ID
            if (user == null && emailPublisher.Converters.Length > 0)
            {
                string email = username;
                foreach (IEmailConverter converter in emailPublisher.Converters)
                {
                    email = converter.Convert(email);
                }

                if (email != null)
                {
                    user = new EmailUser(username, null, email);
                }
            }
            return user;
        }
        private EmailUser GetEmailUser(string username)
        {
            if (username == null) return null;
            var user = emailPublisher.IndexedEmailUsers.ContainsKey(username) ?
                emailPublisher.IndexedEmailUsers[username] :
                null;

            // if user is not specified in the project config, 
            // use the converters to create the email address from the sourcecontrol ID           
            if (user == null && emailPublisher.Converters.Length > 0)
            {
                string email = username;
                string tempEmail = null;

                foreach (IEmailConverter converter in emailPublisher.Converters)
                {
                    tempEmail = converter.Convert(email);
                    if(tempEmail != null)
                    {
                        email = tempEmail;
                    }
                }

                if (email != null)
                {
                    user = new EmailUser(username, null, email);
                }
            }
            return user;
        }