From bdaeac6f3e235407b08d750ae6e7ae926c26d784 Mon Sep 17 00:00:00 2001 From: Don Oerkfitz Date: Mon, 15 Mar 2021 01:05:52 -0500 Subject: [PATCH] updated wrapper updated SQLBase to add new HTML formatting functions --- .../JasonNeumannAudio.com/AboutPageDAO.cs | 2 +- .../JasonNeumannAudio.com/WorkPageDAO.cs | 4 ++-- Common.Library/SQL/Base/SQLBase.cs | 22 +++++++++++++++++++ Common.Library/TMDB/TMDBWrapper.cs | 2 +- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/AboutPageDAO.cs b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/AboutPageDAO.cs index 1f1f56a..af7fb89 100644 --- a/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/AboutPageDAO.cs +++ b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/AboutPageDAO.cs @@ -26,7 +26,7 @@ namespace Common.Library.DataLayer.DAO.Websites.JasonNeumannAudio.com item = new() { AboutPageID = GetInt("AboutPageID").Value, - AboutPageText = GetString("AboutPageText").Replace("\\r\\n", "

") + AboutPageText = FormatNewLineForHTML(GetString("AboutPageText"), 2) }; } diff --git a/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/WorkPageDAO.cs b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/WorkPageDAO.cs index 1e932f8..450624c 100644 --- a/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/WorkPageDAO.cs +++ b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/WorkPageDAO.cs @@ -30,7 +30,7 @@ namespace Common.Library.DataLayer.DAO.Websites.JasonNeumannAudio.com WorkPageTypeID = (WorkPageDTO.WorkPageType)GetInt("WorkPageTypeID").Value, WorkPageName = GetString("WorkPageName"), WorkPageLink = GetString("WorkPageLink"), - WorkPageValue = GetString("WorkPageValue") + WorkPageValue = FormatBoldForHTML(GetString("WorkPageValue")) }; } @@ -66,7 +66,7 @@ namespace Common.Library.DataLayer.DAO.Websites.JasonNeumannAudio.com WorkPageTypeID = (WorkPageDTO.WorkPageType)GetInt("WorkPageTypeID").Value, WorkPageName = GetString("WorkPageName"), WorkPageLink = GetString("WorkPageLink"), - WorkPageValue = GetString("WorkPageValue") + WorkPageValue = FormatBoldForHTML(GetString("WorkPageValue")) }; items.Add(item); diff --git a/Common.Library/SQL/Base/SQLBase.cs b/Common.Library/SQL/Base/SQLBase.cs index 87474ad..3da6599 100644 --- a/Common.Library/SQL/Base/SQLBase.cs +++ b/Common.Library/SQL/Base/SQLBase.cs @@ -1,4 +1,5 @@ using System; +using System.Text; namespace Common.Library.SQL.Base { @@ -51,6 +52,27 @@ namespace Common.Library.SQL.Base // free native resources if there are any. } + protected string FormatNewLineForHTML(string input) + { + return input.Replace("\\r\\n", "
"); + } + + protected string FormatNewLineForHTML(string input, int numberOfBreaksToAdd) + { + StringBuilder breaks = new(); + for (int x = 0; x < numberOfBreaksToAdd; x++) + { + breaks.Append("
"); + } + + return input.Replace("\\r\\n", breaks.ToString()); + } + + protected string FormatBoldForHTML(string input) + { + return input.Replace("[b]", "").Replace("[/b]", ""); + } + protected abstract void InitConnection(); protected abstract void DisposeConnection(); diff --git a/Common.Library/TMDB/TMDBWrapper.cs b/Common.Library/TMDB/TMDBWrapper.cs index f9dd28b..dc9f0b1 100644 --- a/Common.Library/TMDB/TMDBWrapper.cs +++ b/Common.Library/TMDB/TMDBWrapper.cs @@ -32,7 +32,7 @@ namespace Common.Library.TMDB posterLink = container.TvResults[0].PosterPath; } - return $"https://www.themoviedb.org/t/p/original{posterLink}"; + return !string.IsNullOrWhiteSpace(posterLink) ? $"https://www.themoviedb.org/t/p/original{posterLink}" : null; } public List GetPosterLinks(List imdbIDs)