private string ReplaceEventsInfoTokens(EmailTemplate value, object source) { if (value.Body.Contains(EventsInfo)) { value.Body = value.Body.Replace(EventsInfo, GetConsolidatedEventInfoTemplateResults()); } value.Body = TextTemplateUtils.ReplacePropertyTokens(source, value.Body); return value.Body; }
public void SetUp() { _mockTemplateRepo = new Mock<IRepository<EmailTemplate>>(); _testTemplate = new EmailTemplate() { Body = "test body", Description = "test description", FromAddress = "*****@*****.**", Subject = "test subject", Title = "test title" }; }
private string PreProcessGroupsAndReplaceTokensInTemplate(EmailTemplate value, object source) { string eventsInfoText = string.Empty; value.Body = value.Body.Replace(EventDonationInfo, GetDonationInformation()); if (value.Body.Contains(EventsInfo)) { value.Body = value.Body.Replace(EventsInfo, GetConsolidatedEventInfoTemplateResults()); } else { int start = value.Body.IndexOf(EventsInfoStartToken, StringComparison.OrdinalIgnoreCase); int length = value.Body.IndexOf(EventsInfoEndToken, StringComparison.OrdinalIgnoreCase) + EventsInfoEndToken.Length - value.Body.IndexOf(EventsInfoStartToken, StringComparison.OrdinalIgnoreCase); if (start > 0) { eventsInfoText = value.Body.Substring(start, length); value.Body = value.Body.Replace(eventsInfoText, GetGroupedEventInfoTemplateResults(eventsInfoText)); } } value.Body = TextTemplateUtils.ReplacePropertyTokens(source, value.Body); return value.Body; }