Exemplo n.º 1
0
        public MailMessage WelcomeMail(NewMemberMessage message)
        {
            Require.NotNull(message, "message");

            // FIXME: C'est un peu pourri ! À refaire ! Utiliser CultureInfo.DefaultThreadCurrentUICulture ?
            String template;

            if (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "fr")
            {
                template = Resources.WelcomeMailBody;
            }
            else
            {
                template = Resources.WelcomeMailBody_English;
            }

            var tpl = new Template(template);

            tpl.Add("Message", message);
            tpl.Add("SiteUrl", _siteMap.Home().ToString());

            var mail = new MailMessage {
                Body       = tpl.Render(CultureInfo.CurrentCulture),
                IsBodyHtml = false,
                Subject    = Strings.Welcome_Subject
            };

            mail.To.Add(message.EmailAddress);

            return(mail);
        }
Exemplo n.º 2
0
        private static Uri GetNextUri_(Maybe <Uri> targetUrl, ISiteMap siteMap, ChiffonEnvironment environment)
        {
            Contract.Requires(targetUrl != null);
            Contract.Requires(siteMap != null);

            return(targetUrl.Select(_ => environment.MakeAbsoluteUri(_)).ValueOrElse(siteMap.Home()));
        }