From 84afbc435b2680a6b2d899f4ee770cc1a8cfe092 Mon Sep 17 00:00:00 2001 From: Don Oerkfitz Date: Wed, 24 Feb 2021 00:15:31 -0600 Subject: [PATCH] added stuff for jasonneumannaudio.com --- .../Common.Library.DataLayer.csproj | 4 ++ .../JasonNeumannAudio.com/AboutPageDAO.cs | 45 +++++++++++++++++++ .../JasonNeumannAudio.com/AboutPageDTO.cs | 12 +++++ Common.Library.System.sln | 40 ++++++----------- Common.Library/Common.Library.csproj | 6 ++- Common.Library/SQL/Base/SQLBase.cs | 4 +- Common.Library/SQL/MySQL/MySQL.cs | 5 +++ Common.Library/Settings/SettingsLoader.cs | 12 +++++ 8 files changed, 97 insertions(+), 31 deletions(-) create mode 100644 Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/AboutPageDAO.cs create mode 100644 Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/AboutPageDTO.cs diff --git a/Common.Library.DataLayer/Common.Library.DataLayer.csproj b/Common.Library.DataLayer/Common.Library.DataLayer.csproj index a60a370..236e904 100644 --- a/Common.Library.DataLayer/Common.Library.DataLayer.csproj +++ b/Common.Library.DataLayer/Common.Library.DataLayer.csproj @@ -2,6 +2,10 @@ net5.0 + common-library-data-layer + 1.0.0 + Don Oerkfitz + DMC Dynamics LLC diff --git a/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/AboutPageDAO.cs b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/AboutPageDAO.cs new file mode 100644 index 0000000..381449c --- /dev/null +++ b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/AboutPageDAO.cs @@ -0,0 +1,45 @@ +using Common.Library.SQL.MySQL; +using System; +using System.Data; +using Common.Library.DataLayer.DTO.Websites.JasonNeumannAudio.com; + + +namespace Common.Library.DataLayer.DAO.Websites.JasonNeumannAudio.com +{ + public class AboutPageDAO : MySQL + { + public AboutPageDAO(DBConnectionInformation connectionInformation) : base(connectionInformation){ } + + public AboutPageDTO SelectAboutPageText() + { + InitConnection(); + AboutPageDTO item = null; + + try + { + DBCommand.CommandType = CommandType.StoredProcedure; + DBCommand.CommandText = "about_page_select_text"; + DBReader = DBCommand.ExecuteReader(); + + if(DBReader.Read()) + { + item = new() + { + AboutPageID = GetInt("AboutPageID").Value, + AboutPageText = GetString("AboutPageText") + }; + } + + return item; + } + catch(Exception) + { + throw; + } + finally + { + DisposeConnection(); + } + } + } +} \ No newline at end of file diff --git a/Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/AboutPageDTO.cs b/Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/AboutPageDTO.cs new file mode 100644 index 0000000..7aad297 --- /dev/null +++ b/Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/AboutPageDTO.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Common.Library.DataLayer.DTO.Websites.JasonNeumannAudio.com +{ + public class AboutPageDTO + { + public int AboutPageID { get; set;} + public string AboutPageText { get; set; } + } + + public class AboutPageDTOCollection : List{ } +} \ No newline at end of file diff --git a/Common.Library.System.sln b/Common.Library.System.sln index ba687a8..cc3f3f3 100644 --- a/Common.Library.System.sln +++ b/Common.Library.System.sln @@ -5,9 +5,7 @@ VisualStudioVersion = 15.0.26124.0 MinimumVisualStudioVersion = 15.0.26124.0 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Library", "Common.Library\Common.Library.csproj", "{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Library.DAO", "Common.Library.DAO\Common.Library.DAO.csproj", "{05AE0B7C-889C-4EA2-B44E-748BA345135D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Library.DTO", "Common.Library.DTO\Common.Library.DTO.csproj", "{04E1D9B0-6AE1-4361-850F-45325D61BD0C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Library.DataLayer", "Common.Library.DataLayer\Common.Library.DataLayer.csproj", "{29741C82-C18E-499C-8B7E-360227FD5A68}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -34,29 +32,17 @@ Global {0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Release|x64.Build.0 = Release|Any CPU {0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Release|x86.ActiveCfg = Release|Any CPU {0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Release|x86.Build.0 = Release|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Debug|x64.ActiveCfg = Debug|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Debug|x64.Build.0 = Debug|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Debug|x86.ActiveCfg = Debug|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Debug|x86.Build.0 = Debug|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Release|Any CPU.Build.0 = Release|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Release|x64.ActiveCfg = Release|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Release|x64.Build.0 = Release|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Release|x86.ActiveCfg = Release|Any CPU - {05AE0B7C-889C-4EA2-B44E-748BA345135D}.Release|x86.Build.0 = Release|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Debug|x64.ActiveCfg = Debug|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Debug|x64.Build.0 = Debug|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Debug|x86.ActiveCfg = Debug|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Debug|x86.Build.0 = Debug|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Release|Any CPU.Build.0 = Release|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Release|x64.ActiveCfg = Release|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Release|x64.Build.0 = Release|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Release|x86.ActiveCfg = Release|Any CPU - {04E1D9B0-6AE1-4361-850F-45325D61BD0C}.Release|x86.Build.0 = Release|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Debug|Any CPU.Build.0 = Debug|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Debug|x64.ActiveCfg = Debug|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Debug|x64.Build.0 = Debug|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Debug|x86.ActiveCfg = Debug|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Debug|x86.Build.0 = Debug|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Release|Any CPU.ActiveCfg = Release|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Release|Any CPU.Build.0 = Release|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Release|x64.ActiveCfg = Release|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Release|x64.Build.0 = Release|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Release|x86.ActiveCfg = Release|Any CPU + {29741C82-C18E-499C-8B7E-360227FD5A68}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/Common.Library/Common.Library.csproj b/Common.Library/Common.Library.csproj index 2fff6a0..c2c052d 100644 --- a/Common.Library/Common.Library.csproj +++ b/Common.Library/Common.Library.csproj @@ -2,14 +2,16 @@ net5.0 + common-library + 1.0.0 + Don Oerkfitz + DMC Dynamics LLC - - diff --git a/Common.Library/SQL/Base/SQLBase.cs b/Common.Library/SQL/Base/SQLBase.cs index 661e716..87474ad 100644 --- a/Common.Library/SQL/Base/SQLBase.cs +++ b/Common.Library/SQL/Base/SQLBase.cs @@ -6,12 +6,12 @@ namespace Common.Library.SQL.Base { protected DBConnectionInformation DBConnectionInfo; - protected enum DBType + public enum DBType { MSSQL, MYSQL } - protected struct DBConnectionInformation + public struct DBConnectionInformation { public string DBHost {get;set;} public string DBName {get;set;} diff --git a/Common.Library/SQL/MySQL/MySQL.cs b/Common.Library/SQL/MySQL/MySQL.cs index 3b8b44e..7b783d4 100644 --- a/Common.Library/SQL/MySQL/MySQL.cs +++ b/Common.Library/SQL/MySQL/MySQL.cs @@ -23,6 +23,11 @@ namespace Common.Library.SQL.MySQL DBType = DBType.MYSQL }; } + + public MySQL(DBConnectionInformation connectionInformation) + { + DBConnectionInfo = connectionInformation; + } protected override void InitConnection() { diff --git a/Common.Library/Settings/SettingsLoader.cs b/Common.Library/Settings/SettingsLoader.cs index 102a74f..2d60d49 100644 --- a/Common.Library/Settings/SettingsLoader.cs +++ b/Common.Library/Settings/SettingsLoader.cs @@ -16,5 +16,17 @@ namespace Common.Library.Settings public static string DBPassword { get => Configuration?.GetSection("Database")["Password"]; } #endregion + + public static SQL.Base.SQLBase.DBConnectionInformation GetDBConnectionInformation(IConfiguration configuration, SQL.Base.SQLBase.DBType dbType) + { + return new() + { + DBName = configuration?.GetSection("Database")["DBName"], + DBHost = configuration?.GetSection("Database")["Host"], + DBUserName = configuration?.GetSection("Database")["UserName"], + DBPassword = configuration?.GetSection("Database")["Password"], + DBType = dbType + }; + } } }