moved datalayer to seperate repository

net6.0
Don Oerkfitz 3 years ago
parent bed4d56bf0
commit c062689b1f

@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<PackageId>common-library-data-layer</PackageId>
<Version>1.0.0</Version>
<Authors>Don Oerkfitz</Authors>
<Company>DMC Dynamics LLC</Company>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Common.Library\Common.Library.csproj" />
</ItemGroup>
</Project>

@ -1,54 +0,0 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC;
namespace Common.Library.DataLayer.DAO.Websites.DMCDynamics.LLC
{
public class AboutCompanyDAO : MySQL
{
public AboutCompanyDAO(string server, string database, string username, string password) : base(server, database, username, password)
{
}
public AboutCompanyDTOCollection SelectAll()
{
InitConnection();
try
{
AboutCompanyDTOCollection items = new();
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "About_Company_SelectAll";
DBReader = DBCommand.ExecuteReader();
while(DBReader.Read())
{
AboutCompanyDTO item = new AboutCompanyDTO()
{
AboutCompanyID = GetInt("AboutCompanyID").Value,
AboutHeader = GetString("AboutHeader"),
AboutDescription = GetString("AboutDescription"),
IsVisible = GetBool("IsVisible").Value,
CSS = GetString("CSS"),
ImagePath = GetString("ImagePath")
};
items.Add(item);
}
return items.Count == 0 ? null : items;
}
catch(Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
}
}

@ -1,51 +0,0 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC;
namespace Common.Library.DataLayer.DAO.Websites.DMCDynamics.LLC
{
public class CompanyInfoDAO : MySQL
{
public CompanyInfoDAO(string server, string database, string username, string password) : base(server, database, username, password)
{
}
public CompanyInfoDTO Select()
{
InitConnection();
try
{
CompanyInfoDTO item = null;
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "GetCompanyInfo";
DBReader = DBCommand.ExecuteReader();
if(DBReader.Read())
{
item = new CompanyInfoDTO()
{
CompanyName = GetString("CompanyName"),
Address = GetString("Address"),
PhoneNumber = GetString("PhoneNumber"),
EmailAddress = GetString("EmailAddress"),
CompanySlogan = GetString("CompanySlogan")
};
}
return item;
}
catch(Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
}
}

@ -1,51 +0,0 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC;
namespace Common.Library.DataLayer.DAO.Websites.DMCDynamics.LLC
{
public class ServiceInformationDAO : MySQL
{
public ServiceInformationDAO(string server, string database, string username, string password) : base(server, database, username, password)
{
}
public ServiceInformationDTO SelectOne(int serviceID)
{
InitConnection();
try
{
ServiceInformationDTO item = null;
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "ServiceInformation_SelectOne";
DBCommand.Parameters.AddWithValue("@ID", serviceID);
DBReader = DBCommand.ExecuteReader();
if (DBReader.Read())
{
item = new ServiceInformationDTO()
{
ServiceInformationID = GetInt("ServiceInformationID").Value,
ServiceID = GetInt("ServiceID").Value,
ServiceDescription = GetString("ServiceDescription")
};
}
return item;
}
catch (Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
}
}

@ -1,53 +0,0 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC;
namespace Common.Library.DataLayer.DAO.Websites.DMCDynamics.LLC
{
public class ServicesDAO : MySQL
{
public ServicesDAO(string server, string database, string username, string password) : base(server, database, username, password)
{
}
public ServicesDTOCollection SelectAll()
{
InitConnection();
try
{
ServicesDTOCollection items = new ServicesDTOCollection();
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "GetServices";
DBReader = DBCommand.ExecuteReader();
while (DBReader.Read())
{
ServicesDTO item = new ServicesDTO()
{
ServiceID = GetInt("ServiceID").Value,
ServiceName = GetString("ServiceName"),
ServiceTags = GetString("ServiceTags"),
FontAwesomeIcon = GetString("FontAwesomeIcon"),
IsEnabled = GetBool("IsEnabled").Value
};
items.Add(item);
}
return (ServicesDTOCollection)(items.Count == 0 ? null : items);
}
catch (Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
}
}

@ -1,54 +0,0 @@
using Common.Library.SQL.MySQL;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Common.Library.DataLayer.DAO.Websites.DMCDynamics.LLC
{
public class TestimonialGuidsDAO : MySQL
{
public TestimonialGuidsDAO(string server, string database, string username, string password) : base(server, database, username, password)
{
}
public bool IsTestimonialGUIDValid(string guid)
{
InitConnection();
try
{
bool isValid = false;
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "Testimonials_ValidateGUID";
DBCommand.Parameters.Add(new MySqlParameter("GUID", MySqlDbType.VarChar, 255, ParameterDirection.Input, false, 0, 0, string.Empty, DataRowVersion.Proposed, guid));
DBCommand.Parameters.Add(new MySqlParameter("IsValid", MySqlDbType.Bit, 1, ParameterDirection.InputOutput, false, 0, 0, string.Empty, DataRowVersion.Proposed, isValid));
DBCommand.ExecuteNonQuery();
isValid = Convert.ToBoolean(DBCommand.Parameters["IsValid"].Value);
return isValid;
}
catch (Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
public void MarkGUIDAsUsed(string guid)
{
}
}
}

@ -1,78 +0,0 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC;
using System.Collections.Generic;
namespace Common.Library.DataLayer.DAO.Websites.DMCDynamics.LLC
{
public class TestimonialImagesDAO : MySQL
{
public TestimonialImagesDAO(string server, string database, string username, string password) : base(server, database, username, password) { }
public TestimonialImagesDAO(DBConnectionInformation dBConnectionInformation) : base(dBConnectionInformation) { }
public TestimonialImagesDTO SelectOne(int testimonialID)
{
InitConnection();
try
{
TestimonialImagesDTO item = null;
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "Testimonial_Images_SelectOne";
DBCommand.Parameters.AddWithValue("tID", testimonialID);
DBReader = DBCommand.ExecuteReader();
if (DBReader.Read())
{
item = new TestimonialImagesDTO()
{
TestimonialImageID = GetInt("TestimonialImageID").Value,
TestimonialID = GetInt("TestimonialID").Value,
ImageType = GetString("ImageType"),
ImageData = GetBytes("ImageData")
};
}
return item;
}
catch (Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
public void InsertImage(int testimonialID, KeyValuePair<string, byte[]> imageData)
{
InitConnection();
try
{
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "Testimonial_Images_Insert";
DBCommand.Parameters.AddWithValue("@testimonialID", testimonialID);
DBCommand.Parameters.AddWithValue("@imageType", imageData.Key);
DBCommand.Parameters.AddWithValue("@imageData", imageData.Value);
DBCommand.ExecuteNonQuery();
}
catch (Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
}
}

@ -1,115 +0,0 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC;
using System.Collections.Generic;
using MySql.Data.MySqlClient;
namespace Common.Library.DataLayer.DAO.Websites.DMCDynamics.LLC
{
public class TestimonialsDAO : MySQL
{
public TestimonialsDAO(string server, string database, string username, string password) : base(server, database, username, password) { }
public TestimonialsDAO(DBConnectionInformation dBConnectionInformation) : base(dBConnectionInformation) { }
public TestimonialsDTOCollection SelectAll()
{
InitConnection();
try
{
TestimonialsDTOCollection items = new();
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "Testimonials_SelectAll";
DBReader = DBCommand.ExecuteReader();
while (DBReader.Read())
{
TestimonialsDTO item = new()
{
TestimonialID = GetInt("TestimonialID").Value,
CompanyName = GetString("CompanyName"),
CompanySpokesPerson = GetString("CompanySpokesPerson"),
CompanyTitle = GetString("CompanyTitle"),
CompanyWebsite = GetString("CompanyWebsite"),
Testimonial = GetString("Testimonial")
};
items.Add(item);
}
return (items.Count == 0 ? null : items);
}
catch (Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
public int Insert(TestimonialsDTO testimonial)
{
InitConnection();
try
{
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "Testimonials_Insert";
//> Add parameters
DBCommand.Parameters.Add(GetParameter("companyName", MySqlDbType.VarChar, 255, ParameterDirection.Input, testimonial.CompanyName));
DBCommand.Parameters.Add(GetParameter("companySpokesPerson", MySqlDbType.VarChar, 255, ParameterDirection.Input, testimonial.CompanySpokesPerson));
DBCommand.Parameters.Add(GetParameter("companyTitle", MySqlDbType.VarChar, 255, ParameterDirection.Input, testimonial.CompanyTitle));
DBCommand.Parameters.Add(GetParameter("testimonialText", MySqlDbType.Text, 65535, ParameterDirection.Input, testimonial.Testimonial));
DBCommand.Parameters.Add(GetParameter("companyWebsite", MySqlDbType.VarChar, 255, ParameterDirection.Input, testimonial.CompanyWebsite));
DBCommand.Parameters.Add(GetParameter("testimonialGUID", MySqlDbType.VarChar, 255, ParameterDirection.Input, testimonial.TestimonialGUID));
DBCommand.Parameters.Add(GetParameter("testimonialID", MySqlDbType.Int32, 0, ParameterDirection.Output, testimonial.TestimonialID));
DBCommand.ExecuteNonQuery();
return (int)DBCommand.Parameters["TestimonialID"].Value;
}
catch(Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
//public void InsertImage(int testimonialID, KeyValuePair<string, byte[]> imageData)
//{
// InitConnection();
// try
// {
// DBCommand.CommandType = CommandType.StoredProcedure;
// DBCommand.CommandText = "Testimonial_Images_Insert";
// DBCommand.Parameters.AddWithValue("@testimonialID", testimonialID);
// DBCommand.Parameters.AddWithValue("@imageType", imageData.Key);
// DBCommand.Parameters.AddWithValue("@imageData", imageData.Value);
// DBCommand.ExecuteNonQuery();
// }
// catch (Exception)
// {
// throw;
// }
// finally
// {
// DisposeConnection();
// }
//}
}
}

@ -1,45 +0,0 @@
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 = FormatNewLineForHTML(GetString("AboutPageText"), 2)
};
}
return item;
}
catch(Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
}
}

@ -1,47 +0,0 @@
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();
}
}
}
}

@ -1,112 +0,0 @@
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 = FormatBoldForHTML(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 = FormatBoldForHTML(GetString("WorkPageValue"))
};
items.Add(item);
}
return items.Count == 0 ? null : items;
}
catch (Exception)
{
throw;
}
finally
{
DisposeConnection();
}
}
// public void InsertWorkPageItem(WorkPageDTO item)
// {
// InitConnection();
// WorkPageDTOCollection items = new();
// try
// {
// DBCommand.CommandType = CommandType.StoredProcedure;
// DBCommand.CommandText = "work_page_insert_work_page_item";
// // DBCommand.Parameters.AddWithValue("@TypeID", (int)workPageType);
// DBCommand.ExecuteNonQuery();
// }
// catch (Exception)
// {
// throw;
// }
// finally
// {
// DisposeConnection();
// }
// }
}
}

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC
{
public class AboutCompanyDTO
{
public int AboutCompanyID { get; set; }
public string AboutHeader { get; set; }
public string AboutDescription { get; set; }
public bool IsVisible { get; set; }
public string CSS { get; set; }
public string ImagePath { get; set; }
}
public class AboutCompanyDTOCollection : List<AboutCompanyDTO> { }
}

@ -1,49 +0,0 @@
using System.Collections.Generic;
using Common.Library.CustomObjects;
using System.Linq;
namespace Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC
{
public class CompanyInfoDTO
{
public string CompanyName { get; set; }
public string PhoneNumber { get; set; }
public string EmailAddress { get; set; }
public string Address { get; set; }
public string CompanySlogan { get; set; }
public PhoneNumberContainer FormattedPhoneNumber
{
get
{
List<string> phoneNumber = PhoneNumber.Split(" ").Select(val => val.Trim()).ToList<string>();
return new PhoneNumberContainer { AreaCode = phoneNumber[0], PhoneNumber = phoneNumber[1] };
}
}
public AddressContainer FormattedAddress
{
get
{
List<string> address = Address.Split(",").Select(val => val.Trim()).ToList<string>();
string houseNumber = address[0].Substring(0, address[0].IndexOf(" ")).Trim();
string streetName = address[0].Substring(address[0].IndexOf(" ")).Trim();
string city = address[1].Trim();
string state = address[2].Substring(0, address[2].IndexOf(" ")).Trim();
string zip = address[2].Substring(address[2].IndexOf(" ")).Trim();
return new AddressContainer
{
HouseNumber = houseNumber,
StreetName = streetName,
City = city,
State = state,
Zip = zip
};
}
}
}
public class CompanyInfoDTOCollection : List<CompanyInfoDTO> { }
}

@ -1,15 +0,0 @@
using System.Collections.Generic;
namespace Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC
{
public class ServiceInformationDTO
{
public int ServiceInformationID { get; set; }
public int ServiceID { get; set; }
public string ServiceDescription { get; set; }
}
public class ServiceInformationDTOCollection : List<ServiceInformationDTO> {}
}

@ -1,15 +0,0 @@
using System.Collections.Generic;
namespace Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC
{
public class ServicesDTO
{
public int ServiceID { get; set; }
public string ServiceName { get; set; }
public string ServiceTags { get; set; }
public string FontAwesomeIcon { get; set; }
public bool IsEnabled { get; set; }
}
public class ServicesDTOCollection : List<ServicesDTO> {}
}

@ -1,28 +0,0 @@
using Org.BouncyCastle.Crypto.Paddings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC
{
public class TestimonialImagesDTO
{
public int TestimonialImageID { get; set; }
public int TestimonialID { get; set; }
public string ImageType { get; set; }
public byte[] ImageData { get; set; }
public string ImageDataForWeb => GetImageDataForWeb();
private string GetImageDataForWeb()
{
string imageData = ImageData == null ? string.Empty : Convert.ToBase64String(ImageData);
return $"data:{ImageType ?? string.Empty};base64,{imageData}";
}
}
public class TestimonialImagesDTOCollection : List<TestimonialImagesDTO> { }
}

@ -1,23 +0,0 @@
using Org.BouncyCastle.Crypto.Paddings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC
{
public class TestimonialsDTO
{
public int TestimonialID { get; set; }
public string CompanyName { get; set; }
public string CompanySpokesPerson { get; set; }
public string CompanyTitle { get; set; }
public string CompanyWebsite { get; set; }
public string Testimonial { get; set; }
public TestimonialImagesDTO TestimonialImage { get; set; }
public string TestimonialGUID { get; set; }
}
public class TestimonialsDTOCollection : List<TestimonialsDTO> { }
}

@ -1,12 +0,0 @@
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<AboutPageDTO>{ }
}

@ -1,12 +0,0 @@
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>{ }
}

@ -1,22 +0,0 @@
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