diff --git a/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/ServicesDAO.cs b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/ServicesDAO.cs new file mode 100644 index 0000000..12086a8 --- /dev/null +++ b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/ServicesDAO.cs @@ -0,0 +1,47 @@ +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 ServicesDAO : MySQL + { + public ServicesDAO(DBConnectionInformation connectionInformation) : base(connectionInformation){ } + + public ServicesDTOCollection GetServices() + { + InitConnection(); + ServicesDTOCollection items = new(); + + try + { + DBCommand.CommandType = CommandType.StoredProcedure; + DBCommand.CommandText = "services_page_select_all"; + DBReader = DBCommand.ExecuteReader(); + + while(DBReader.Read()) + { + ServicesDTO item = new() + { + ServicePageID = GetInt("ServicePageID").Value, + ServiceText = GetString("ServiceText") + }; + + items.Add(item); + } + + return items.Count == 0 ? null : items; + } + catch(Exception) + { + throw; + } + finally + { + DisposeConnection(); + } + } + } +} \ No newline at end of file diff --git a/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/WorkPageDAO.cs b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/WorkPageDAO.cs new file mode 100644 index 0000000..2a9aa8f --- /dev/null +++ b/Common.Library.DataLayer/DAO/Websites/JasonNeumannAudio.com/WorkPageDAO.cs @@ -0,0 +1,87 @@ +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 WorkPageDAO : MySQL + { + public WorkPageDAO(DBConnectionInformation connectionInformation) : base(connectionInformation){ } + + public WorkPageDTO SelectOne(WorkPageDTO.WorkPageType workPageType) + { + InitConnection(); + WorkPageDTO item = null; + + try + { + DBCommand.CommandType = CommandType.StoredProcedure; + DBCommand.CommandText = "work_page_select_one"; + DBCommand.Parameters.AddWithValue("@TypeID", (int)workPageType); + DBReader = DBCommand.ExecuteReader(); + + if(DBReader.Read()) + { + item = new() + { + WorkPageID = GetInt("WorkPageID").Value, + WorkPageTypeID = (WorkPageDTO.WorkPageType)GetInt("WorkPageTypeID").Value, + WorkPageName = GetString("WorkPageName"), + WorkPageLink = GetString("WorkPageLink"), + WorkPageValue = GetString("WorkPageValue") + }; + } + + return item; + } + catch(Exception) + { + throw; + } + finally + { + DisposeConnection(); + } + } + + public WorkPageDTOCollection SelectAllByWorkPageType(WorkPageDTO.WorkPageType workPageType) + { + InitConnection(); + WorkPageDTOCollection items = new(); + + try + { + DBCommand.CommandType = CommandType.StoredProcedure; + DBCommand.CommandText = "work_page_select_all_by_work_page_type"; + DBCommand.Parameters.AddWithValue("@TypeID", (int)workPageType); + DBReader = DBCommand.ExecuteReader(); + + while (DBReader.Read()) + { + WorkPageDTO item = new() + { + WorkPageID = GetInt("WorkPageID").Value, + WorkPageTypeID = (WorkPageDTO.WorkPageType)GetInt("WorkPageTypeID").Value, + WorkPageName = GetString("WorkPageName"), + WorkPageLink = GetString("WorkPageLink"), + WorkPageValue = GetString("WorkPageValue") + }; + + items.Add(item); + } + + return items.Count == 0 ? null : items; + } + catch (Exception) + { + throw; + } + finally + { + DisposeConnection(); + } + } + } +} \ No newline at end of file diff --git a/Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/ServicesDTO.cs b/Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/ServicesDTO.cs new file mode 100644 index 0000000..67aa02c --- /dev/null +++ b/Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/ServicesDTO.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Common.Library.DataLayer.DTO.Websites.JasonNeumannAudio.com +{ + public class ServicesDTO + { + public int ServicePageID { get; set; } + public string ServiceText { get; set; } + } + + public class ServicesDTOCollection : List{ } +} \ No newline at end of file diff --git a/Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/WorkPageDTO.cs b/Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/WorkPageDTO.cs new file mode 100644 index 0000000..5f018d6 --- /dev/null +++ b/Common.Library.DataLayer/DTO/Websites/JasonNeumannAudio.com/WorkPageDTO.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace Common.Library.DataLayer.DTO.Websites.JasonNeumannAudio.com +{ + public class WorkPageDTO + { + public int WorkPageID { get; set; } + public WorkPageType WorkPageTypeID { get; set; } + public string WorkPageName { get; set; } + public string WorkPageValue { get; set; } + public string WorkPageLink { get; set; } + + public enum WorkPageType + { + CopyText = 1, + Links = 2, + Poster = 3 + } + } + + public class WorkPageDTOCollection : List{ } +} \ No newline at end of file