added more DAO and DTO items

net6.0
Don Oerkfitz 4 years ago
parent 6772590076
commit cc00c4f33e

@ -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();
}
}
}
}

@ -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();
}
}
}
}

@ -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<ServicesDTO>{ }
}

@ -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<WorkPageDTO>{ }
}
Loading…
Cancel
Save