/// <summary> /// ctor the Mighty /// </summary> public RecipeCommentEmailMessage(IWebSettings webSettings, RecipeSummary recipeSummary, string commenterUsername, UserSummary userToNotify, RecipeComment recipeComment, BrewgrUrlBuilder brewgrUrlBuilder) : base(webSettings) { this.WebSettings = webSettings; this.RecipeSummary = recipeSummary; this.CommenterUsername = commenterUsername; this.UserToNotify = userToNotify; this.RecipeComment = recipeComment; this.BrewgrUrlBuilder = brewgrUrlBuilder; // Set Sender this.SenderAddress = webSettings.SenderAddress; this.SenderDisplayName = webSettings.SenderDisplayName; // Set Recipient this.ToRecipients.Add(userToNotify.EmailAddress); // Build Subject if (recipeSummary.CreatedBy == userToNotify.UserId) { this.Subject = string.Format("{0} commented on your recipe, {1}", commenterUsername, recipeSummary.RecipeName); } else { this.Subject = string.Format("{0} also left a comment on the recipe, {1}", commenterUsername, recipeSummary.RecipeName); } }
/// <summary> /// ctor the Mighty /// </summary> public RecipeCommentEmailMessage(IWebSettings webSettings, RecipeSummary recipeSummary, string commenterUsername, UserSummary userToNotify, RecipeComment recipeComment, BrewgrUrlBuilder brewgrUrlBuilder) : base(webSettings) { this.WebSettings = webSettings; this.RecipeSummary = recipeSummary; this.CommenterUsername = commenterUsername; this.UserToNotify = userToNotify; this.RecipeComment = recipeComment; this.BrewgrUrlBuilder = brewgrUrlBuilder; // Set Sender this.SenderAddress = webSettings.SenderAddress; this.SenderDisplayName = webSettings.SenderDisplayName; // Set Recipient this.ToRecipients.Add(userToNotify.EmailAddress); // Build Subject if (recipeSummary.CreatedBy == userToNotify.UserId) { this.Subject = string.Format("{0} commented on your recipe, {1}", commenterUsername, recipeSummary.RecipeName); } else { this.Subject = string.Format("{0} also left a comment on the recipe, {1}", commenterUsername, recipeSummary.RecipeName); } }
/// <summary> /// Builds a Recipe Detail Url /// </summary> public string BuildDetailUrl(RecipeSummary recipeSummary) { // NOTE: This Code Duplicated in Brewgr.Web UrlHelperExtensions var recipeNameForUrl = StringCleaner.CleanForUrl(recipeSummary.RecipeName); if (!string.IsNullOrWhiteSpace(recipeSummary.BJCPStyleName) && recipeSummary.BJCPStyleName.ToLower() != "unknown style") { recipeNameForUrl += "-" + StringCleaner.CleanForUrl(recipeSummary.BJCPStyleName); } if (!recipeNameForUrl.ToLower().Trim().EndsWith("recipe")) { recipeNameForUrl += "-recipe"; } return string.Format("{0}/recipe/{1}/{2}", this.WebSettings.RootPath, recipeSummary.RecipeId, recipeNameForUrl); }
/// <summary> /// Builds a Recipe Detail Url /// </summary> public string BuildDetailUrl(RecipeSummary recipeSummary) { // NOTE: This Code Duplicated in Brewgr.Web UrlHelperExtensions var recipeNameForUrl = StringCleaner.CleanForUrl(recipeSummary.RecipeName); if (!string.IsNullOrWhiteSpace(recipeSummary.BJCPStyleName) && recipeSummary.BJCPStyleName.ToLower() != "unknown style") { recipeNameForUrl += "-" + StringCleaner.CleanForUrl(recipeSummary.BJCPStyleName); } if (!recipeNameForUrl.ToLower().Trim().EndsWith("recipe")) { recipeNameForUrl += "-recipe"; } return(string.Format("/recipe/{0}/{1}", recipeSummary.RecipeId, recipeNameForUrl)); }
/// <summary> /// ctor the Mighty /// </summary> public RecipeCommentEmailMessage(IWebSettings webSettings, RecipeSummary recipeSummary, string commenterUsername, UserSummary userToNotify) { RecipeSummary = recipeSummary; CommenterUsername = commenterUsername; UserToNotify = userToNotify; this.SenderAddress = webSettings.SenderAddress; this.SenderDisplayName = webSettings.SenderDisplayName; this.ToRecipients.Add(userToNotify.EmailAddress); // Build Subject if (recipeSummary.CreatedBy == userToNotify.UserId) { this.Subject = string.Format("{0} commented on your recipe, {1}", commenterUsername, recipeSummary.RecipeName); } else { this.Subject = string.Format("{0} also left a comment on the recipe, {1}", commenterUsername, recipeSummary.RecipeName); } }