moved Common Library out of Original Repository

net6.0
Don Oerkfitz 4 years ago
parent 6bfc089aeb
commit 679e252af5

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Common.Library.DTO\Common.Library.DTO.csproj" />
<ProjectReference Include="..\Common.Library\Common.Library.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,51 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DTO.Websites.DMCDynamics.LLC;
namespace Common.Library.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();
}
}
}
}

@ -0,0 +1,51 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DTO.Websites.DMCDynamics.LLC;
namespace Common.Library.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();
}
}
}
}

@ -0,0 +1,53 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DTO.Websites.DMCDynamics.LLC;
namespace Common.Library.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();
}
}
}
}

@ -0,0 +1,79 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DTO.Websites.DMCDynamics.LLC;
using System.Collections.Generic;
namespace Common.Library.DAO.Websites.DMCDynamics.LLC
{
public class TestimonialImagesDAO : MySQL
{
public TestimonialImagesDAO(string server, string database, string username, string password) : base(server, database, username, password)
{
}
public TestimonialImagesDTO SelectOne(int testimonialID)
{
InitConnection();
try
{
TestimonialImagesDTO item = null;
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "Testimonial_Images_SelectOne";
DBCommand.Parameters.AddWithValue("@testimonialID", 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();
}
}
}
}

@ -0,0 +1,120 @@
using Common.Library.SQL.MySQL;
using System;
using System.Data;
using Common.Library.DTO.Websites.DMCDynamics.LLC;
using System.Collections.Generic;
namespace Common.Library.DAO.Websites.DMCDynamics.LLC
{
public class TestimonialsDAO : MySQL
{
public TestimonialsDAO(string server, string database, string username, string password) : base(server, database, username, password)
{
}
//public TestimonialImagesDTO SelectOne(int testimonialID)
//{
// InitConnection();
// try
// {
// TestimonialImagesDTO item = null;
// DBCommand.CommandType = CommandType.StoredProcedure;
// DBCommand.CommandText = "Testimonial_Images_SelectOne";
// DBCommand.Parameters.AddWithValue("@testimonialID", 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 TestimonialsDTOCollection SelectAll()
{
InitConnection();
try
{
TestimonialsDTOCollection items = new TestimonialsDTOCollection();
DBCommand.CommandType = CommandType.StoredProcedure;
DBCommand.CommandText = "Testimonials_SelectAll";
DBReader = DBCommand.ExecuteReader();
while (DBReader.Read())
{
TestimonialsDTO item = new TestimonialsDTO()
{
TestimonialID = GetInt("TestimonialID").Value,
CompanyName = GetString("CompanyName"),
CompanySpokesPerson = GetString("CompanySpokesPerson"),
CompanyTitle = GetString("CompanyTitle"),
CompanyWebsite = GetString("CompanyWebsite"),
Testimonial = GetString("Testimonial")
};
items.Add(item);
}
return (TestimonialsDTOCollection)(items.Count == 0 ? null : items);
}
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();
// }
//}
}
}

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Common.Library\Common.Library.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,49 @@
using System.Collections.Generic;
using Common.Library.CustomObjects;
using System.Linq;
namespace Common.Library.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> { }
}

@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace Common.Library.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> {}
}

@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace Common.Library.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> {}
}

@ -0,0 +1,21 @@
using Org.BouncyCastle.Crypto.Paddings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Common.Library.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 => string.Format("data:{0};base64,{1}", ImageType, Convert.ToBase64String(ImageData));
}
public class TestimonialImagesDTOCollection : List<TestimonialImagesDTO> { }
}

@ -0,0 +1,21 @@
using Org.BouncyCastle.Crypto.Paddings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Common.Library.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 class TestimonialsDTOCollection : List<TestimonialsDTO> { }
}

@ -0,0 +1,62 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Debug|x64.ActiveCfg = Debug|Any CPU
{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Debug|x64.Build.0 = Debug|Any CPU
{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Debug|x86.ActiveCfg = Debug|Any CPU
{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Debug|x86.Build.0 = Debug|Any CPU
{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Release|Any CPU.Build.0 = Release|Any CPU
{0D9719C9-8A12-4549-8AFA-A85FF8E16C3A}.Release|x64.ActiveCfg = Release|Any CPU
{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
EndGlobalSection
EndGlobal

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common.Library\Common.Library.csproj" />
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

@ -0,0 +1,14 @@
using System;
using Xunit;
namespace Common.Library.Tests
{
public class ImageHandlingTests
{
[Fact]
public void ImageConversionTest()
{
}
}
}

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.7" />
<PackageReference Include="MySql.Data" Version="8.0.21" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.1" />
</ItemGroup>
</Project>

@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Common.Library.CustomObjects
{
public class AddressContainer
{
public string HouseNumber { get; set; }
public string StreetName { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
public string AddressLine1 => string.Format("{0} {1}", HouseNumber, StreetName);
public string AddressLine2 => string.Empty;
public string CityStateZip => string.Format("{0}, {1} {2}", City, (State.Length > 2 ? GetStateAbbreviationFromName(State) : State), Zip);
private Dictionary<string, string> States => new Dictionary<string, string>()
{
{"AL", "Alabama"},
{"AK", "Alaska"},
{"AZ", "Arizona"},
{"AR", "Arkansas"},
{"CA", "California"},
{"CO", "Colorado"},
{"CT", "Connecticut"},
{"DE", "Delaware"},
{"DC", "District of Columbia"},
{"FL", "Florida"},
{"GA", "Georgia"},
{"HI", "Hawaii"},
{"ID", "Idaho"},
{"IL", "Illinois"},
{"IN", "Indiana"},
{"IA", "Iowa"},
{"KS", "Kansas"},
{"KY", "Kentucky"},
{"LA", "Louisiana"},
{"ME", "Maine"},
{"MD", "Maryland"},
{"MA", "Massachusetts"},
{"MI", "Michigan"},
{"MN", "Minnesota"},
{"MS", "Mississippi"},
{"MO", "Missouri"},
{"MT", "Montana"},
{"NE", "Nebraska"},
{"NV", "Nevada"},
{"NH", "New Hampshire"},
{"NJ", "New Jersey"},
{"NM", "New Mexico"},
{"NY", "New York"},
{"NC", "North Carolina"},
{"ND", "North Dakota"},
{"OH", "Ohio"},
{"OK", "Oklahoma"},
{"OR", "Oregon"},
{"PA", "Pennsylvania"},
{"RI", "Rhode Island"},
{"SC", "South Carolina"},
{"SD", "South Dakota"},
{"TN", "Tennessee"},
{"TX", "Texas"},
{"UT", "Utah"},
{"VT", "Vermont"},
{"VA", "Virginia"},
{"WA", "Washington"},
{"WV", "West Virginia"},
{"WI", "Wisconsin"},
{"WY", "Wyoming"}
};
private string GetStateNameFromAbbreviation(string abbr)
{
return States.FirstOrDefault(val => val.Key == abbr).Value;
}
private string GetStateAbbreviationFromName(string name)
{
return States.FirstOrDefault(val => val.Value == name).Key;
}
}
public class AddressContainerCollection : List<AddressContainer> { }
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Common.Library.CustomObjects
{
public class PhoneNumberContainer
{
public string CountryCode { get; set; }
public string AreaCode { get; set; }
public string PhoneNumber{ get; set; }
}
public class PhoneNumberContainerCollection : List<PhoneNumberContainer> { }
}

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
using SixLabors.ImageSharp;
namespace Common.Library.ImageHandling
{
public interface IImageHandler
{
public KeyValuePair<string, byte[]> ConvertImageFromFile(string pathToImage);
public Image RestoreImageToFile(byte[] imageData);
}
}

@ -0,0 +1,34 @@
using Microsoft.AspNetCore.StaticFiles;
using SixLabors.ImageSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace Common.Library.ImageHandling
{
public class ImageHandler : IImageHandler
{
public ImageHandler()
{
}
public KeyValuePair<string, byte[]> ConvertImageFromFile(string pathToImage)
{
byte[] returnData = File.ReadAllBytes(pathToImage);
string imageType = new FileExtensionContentTypeProvider().Mappings[Path.GetExtension(pathToImage)];
return new KeyValuePair<string, byte[]>(imageType, returnData);
}
public Image RestoreImageToFile(byte[] imageData)
{
//string base64Data = Convert.ToBase64String(imageData, 0, imageData.Length);
//Image image = Image.Load(imageData);
return Image.Load(imageData);
}
}
}

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Common.Library.JSON
{
class JSONParser
{
}
}

@ -0,0 +1,78 @@
using System;
namespace Common.Library.SQL.Base
{
public abstract class SQLBase : IDisposable
{
protected DBConnectionInformation DBConnectionInfo;
protected enum DBType
{
MSSQL,
MYSQL
}
protected struct DBConnectionInformation
{
public string DBHost {get;set;}
public string DBName {get;set;}
public string DBUserName {get;set;}
public string DBPassword {get;set;}
public DBType DBType {get;set;}
public string GetConnectionString()
{
string rv = string.Empty;
switch(DBType)
{
case DBType.MSSQL:
break;
case DBType.MYSQL:
rv = string.Format("Server={0};Database={1};Uid={2};Pwd={3}", DBHost, DBName, DBUserName, DBPassword);
break;
}
return rv;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// free managed resources
}
// free native resources if there are any.
}
protected abstract void InitConnection();
protected abstract void DisposeConnection();
protected abstract int GetOrdinal(string columnName);
protected abstract int? GetInt(int columnID);
protected abstract int? GetInt(string columnName);
protected abstract byte? GetByte(int columnID);
protected abstract byte? GetByte(string columnName);
protected abstract byte[] GetBytes(int columnID);
protected abstract byte[] GetBytes(string columnName);
protected abstract decimal? GetDecimal(int columnID);
protected abstract decimal? GetDecimal(string columnName);
protected abstract long? GetLong(int columnID);
protected abstract long? GetLong(string columnName);
protected abstract short? GetShort(int columnID);
protected abstract short? GetShort(string columnName);
protected abstract string GetString(int columnID);
protected abstract string GetString(string columnName);
protected abstract bool? GetBool(int columnID);
protected abstract bool? GetBool(string columnName);
protected abstract DateTime? GetDateTime(int columnID);
protected abstract DateTime? GetDateTime(string columnName);
}
}

@ -0,0 +1,213 @@
using System;
using System.Data;
using System.IO;
using Common.Library.SQL.Base;
using MySql.Data.MySqlClient;
namespace Common.Library.SQL.MySQL
{
public class MySQL : SQLBase
{
protected MySqlConnection DBConnection {get;set;}
protected MySqlCommand DBCommand {get;set;}
protected MySqlDataReader DBReader {get;set;}
public MySQL(string server, string database, string username, string password)
{
DBConnectionInfo = new DBConnectionInformation()
{
DBHost = server,
DBUserName = username,
DBName = database,
DBPassword = password,
DBType = DBType.MYSQL
};
}
protected override void InitConnection()
{
DBConnection = new MySqlConnection(DBConnectionInfo.GetConnectionString());
DBConnection.Open();
DBCommand = DBConnection.CreateCommand();
}
protected override void DisposeConnection()
{
if(DBConnection.State == ConnectionState.Open)
{
DBConnection.Close();
}
}
protected override int GetOrdinal(string columnName)
{
return DBReader.GetOrdinal(columnName);
}
protected override int? GetInt(int columnID)
{
int? rv = null;
if(!DBReader.IsDBNull(columnID))
{
rv = DBReader.GetInt32(columnID);
}
return rv;
}
protected override int? GetInt(string columnName)
{
return GetInt(GetOrdinal(columnName));
}
protected override byte? GetByte(int columnID)
{
byte? rv = null;
if(!DBReader.IsDBNull(columnID))
{
rv = DBReader.GetByte(columnID);
}
return rv;
}
protected override byte? GetByte(string columnName)
{
return GetByte(GetOrdinal(columnName));
}
protected override byte[] GetBytes(int columnID)
{
byte[] rv = null;
if (!DBReader.IsDBNull(columnID))
{
const int CHUNK_SIZE = 2 * 1024;
byte[] buffer = new byte[CHUNK_SIZE];
long bytesRead;
long fieldOffset = 0;
using (var stream = new MemoryStream())
{
while ((bytesRead = DBReader.GetBytes(columnID, fieldOffset, buffer, 0, buffer.Length)) == buffer.Length)
{
stream.Write(buffer, 0, (int)bytesRead);
fieldOffset += bytesRead;
}
rv = stream.ToArray();
}
}
return rv;
}
protected override byte[] GetBytes(string columnName)
{
return GetBytes(GetOrdinal(columnName));
}
protected override decimal? GetDecimal(int columnID)
{
decimal? rv = null;
if(!DBReader.IsDBNull(columnID))
{
rv = DBReader.GetDecimal(columnID);
}
return rv;
}
protected override decimal? GetDecimal(string columnName)
{
return GetDecimal(GetOrdinal(columnName));
}
protected override long? GetLong(int columnID)
{
long? rv = null;
if(!DBReader.IsDBNull(columnID))
{
rv = DBReader.GetInt64(columnID);
}
return rv;
}
protected override long? GetLong(string columnName)
{
return GetLong(GetOrdinal(columnName));
}
protected override short? GetShort(int columnID)
{
short? rv = null;
if(!DBReader.IsDBNull(columnID))
{
rv = DBReader.GetInt16(columnID);
}
return rv;
}
protected override short? GetShort(string columnName)
{
return GetShort(GetOrdinal(columnName));
}
protected override string GetString(int columnID)
{
string rv = string.Empty;
if(!DBReader.IsDBNull(columnID))
{
rv = DBReader.GetString(columnID);
}
return rv;
}
protected override string GetString(string columnName)
{
return GetString(GetOrdinal(columnName));
}
protected override bool? GetBool(int columnID)
{
bool? rv = null;
if(!DBReader.IsDBNull(columnID))
{
rv = DBReader.GetBoolean(columnID);
}
return rv;
}
protected override bool? GetBool(string columnName)
{
return GetBool(GetOrdinal(columnName));
}
protected override DateTime? GetDateTime(int columnID)
{
DateTime? rv = null;
if(!DBReader.IsDBNull(columnID))
{
rv = GetDateTime(columnID);
}
return rv;
}
protected override DateTime? GetDateTime(string columnName)
{
return GetDateTime(GetOrdinal(columnName));
}
}
}

@ -0,0 +1,102 @@
CREATE DATABASE IF NOT EXISTS dmcdynamics;
CREATE USER 'dmcdynamics'@'localhost' IDENTIFIED BY 'Iu5I03ZDYjtYtqfD';
GRANT ALL ON dmcdynamics.* TO 'dmcdynamics'@'localhost';
FLUSH PRIVILEGES;
CREATE TABLE `companyinfo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`CompanyName` varchar(255) NOT NULL,
`PhoneNumber` varchar(20) NOT NULL,
`EmailAddress` varchar(100) NOT NULL,
`Address` varchar(255) NOT NULL,
`CompanySlogan` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ;
INSERT INTO `CompanyInfo`
(
CompanyName,
PhoneNumber,
EmailAddress,
Address
)
VALUES
(
'DMC Dynamics LLC',
'(224) 241-2285',
'jobs@dmcdynamics.llc',
'4600 Sycamore Ln, Rolling Meadows, IL 60008'
);
DROP PROCEDURE IF EXISTS dmcdynamics.GetCompanyInfo;
DELIMITER $$
$$
CREATE PROCEDURE dmcdynamics.GetCompanyInfo()
begin
SELECT CompanyName,
PhoneNumber,
EmailAddress,
Address,
CompanySlogan
FROM `CompanyInfo`
LIMIT 1;
END$$
DELIMITER ;
CREATE TABLE `services` (
`ServiceID` int NOT NULL AUTO_INCREMENT,
`ServiceName` varchar(255) NOT NULL,
`ServiceTags` varchar(255) NULL,
`FontAwesomeIcon` varchar(50) NOT NULL,
`IsEnabled` bit(1) NOT NULL DEFAULT b'1',
PRIMARY KEY (`ServiceID`)
);
INSERT INTO `Services` (ServiceName) VALUES ('Software Development');
INSERT INTO `Services` (ServiceName) VALUES ('Web Design & Hosting');
INSERT INTO `Services` (ServiceName) VALUES ('Custom Computers');
INSERT INTO `Services` (ServiceName) VALUES ('Resume Services');
INSERT INTO `Services` (ServiceName) VALUES ('VHS to DVD Conversion');
INSERT INTO `Services` (ServiceName) VALUES ('Tech Consulting');
DROP PROCEDURE IF EXISTS dmcdynamics.GetServices;
DELIMITER $$
$$
CREATE PROCEDURE dmcdynamics.GetServices()
begin
SELECT ServiceID,
ServiceName,
ServiceTags,
FontAwesomeIcon,
IsEnabled
FROM `Services`
WHERE IsEnabled = 1;
END$$
DELIMITER ;
CREATE TABLE dmcdynamics.`service-information` (
ServiceInformationID INT auto_increment NOT NULL,
ServiceID INT NOT NULL,
ServiceDescription varchar(1000) NOT NULL,
CONSTRAINT service_information_pk PRIMARY KEY (ServiceInformationID),
CONSTRAINT service_information_ServiceID_FK FOREIGN KEY (ServiceID) REFERENCES dmcdynamics.services(ServiceID)
)
DROP PROCEDURE IF EXISTS dmcdynamics.ServiceInformation_SelectOne;
DELIMITER $$
$$
CREATE PROCEDURE dmcdynamics.ServiceInformation_SelectOne(
IN ID INT
)
BEGIN
SELECT ServiceInformationID,
ServiceID,
ServiceDescription
FROM `dmcdynamics`.`service-information`
WHERE ServiceID = ID;
END$$
DELIMITER ;

@ -0,0 +1,136 @@
-- MySQL dump 10.13 Distrib 8.0.21, for Win64 (x86_64)
--
-- Host: localhost Database: dmcdynamics
-- ------------------------------------------------------
-- Server version 5.5.5-10.4.14-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `companyinfo`
--
DROP TABLE IF EXISTS `companyinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `companyinfo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`CompanyName` varchar(255) NOT NULL,
`PhoneNumber` varchar(20) NOT NULL,
`EmailAddress` varchar(100) NOT NULL,
`Address` varchar(255) NOT NULL,
`CompanySlogan` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `companyinfo`
--
LOCK TABLES `companyinfo` WRITE;
/*!40000 ALTER TABLE `companyinfo` DISABLE KEYS */;
INSERT INTO `companyinfo` VALUES (1,'DMC Dynamics LLC','(224) 241-2285','jobs@dmcdynamics.llc','4600 Sycamore Ln, Rolling Meadows, IL 60008',NULL);
/*!40000 ALTER TABLE `companyinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `services`
--
DROP TABLE IF EXISTS `services`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `services` (
`ServiceID` int(11) NOT NULL AUTO_INCREMENT,
`ServiceName` varchar(255) NOT NULL,
`ServiceTags` varchar(255) DEFAULT NULL,
`FontAwesomeIcon` varchar(50) NOT NULL,
`IsEnabled` bit(1) NOT NULL DEFAULT b'1',
PRIMARY KEY (`ServiceID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `services`
--
LOCK TABLES `services` WRITE;
/*!40000 ALTER TABLE `services` DISABLE KEYS */;
INSERT INTO `services` VALUES (1,'Software Development','C#, ASP.net, PHP','fa-file-code',_binary ''),(2,'Web Design & Hosting','','',_binary '\0'),(3,'Custom Computers Systems','Gaming, Servers','fa-tv',_binary ''),(4,'Resume Services','Updating, Creating','fa-file-word',_binary ''),(5,'VHS to DVD Conversion','','fa-compact-disc',_binary ''),(6,'Tech Consulting','Engineering','fa-user-tie',_binary '');
/*!40000 ALTER TABLE `services` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping routines for database 'dmcdynamics'
--
/*!50003 DROP PROCEDURE IF EXISTS `GetCompanyInfo` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCompanyInfo`()
begin
SELECT CompanyName,
PhoneNumber,
EmailAddress,
Address,
CompanySlogan
FROM `CompanyInfo`
LIMIT 1;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `GetServices` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetServices`()
begin
SELECT ServiceID,
ServiceName,
ServiceTags,
FontAwesomeIcon,
IsEnabled
FROM `Services`
WHERE IsEnabled = 1;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-09-16 20:56:29

@ -0,0 +1,188 @@
-- MySQL dump 10.13 Distrib 8.0.21, for Win64 (x86_64)
--
-- Host: localhost Database: dmcdynamics
-- ------------------------------------------------------
-- Server version 8.0.21
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `companyinfo`
--
DROP TABLE IF EXISTS `companyinfo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `companyinfo` (
`id` int NOT NULL AUTO_INCREMENT,
`CompanyName` varchar(255) NOT NULL,
`PhoneNumber` varchar(20) NOT NULL,
`EmailAddress` varchar(100) NOT NULL,
`Address` varchar(255) NOT NULL,
`CompanySlogan` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `companyinfo`
--
LOCK TABLES `companyinfo` WRITE;
/*!40000 ALTER TABLE `companyinfo` DISABLE KEYS */;
INSERT INTO `companyinfo` VALUES (1,'DMC Dynamics LLC','(224) 241-2285','jobs@dmcdynamics.llc','4600 Sycamore Ln, Rolling Meadows, IL 60008','Simple tech and personal service solutions that won\'t break the bank!');
/*!40000 ALTER TABLE `companyinfo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `service-information`
--
DROP TABLE IF EXISTS `service-information`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `service-information` (
`ServiceInformationID` int NOT NULL AUTO_INCREMENT,
`ServiceID` int NOT NULL,
`ServiceDescription` text NOT NULL,
PRIMARY KEY (`ServiceInformationID`),
KEY `service_information_ServiceID_FK` (`ServiceID`),
CONSTRAINT `service_information_ServiceID_FK` FOREIGN KEY (`ServiceID`) REFERENCES `services` (`ServiceID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `service-information`
--
LOCK TABLES `service-information` WRITE;
/*!40000 ALTER TABLE `service-information` DISABLE KEYS */;
INSERT INTO `service-information` VALUES (1,1,'Let me break it down for you; I have over 8 years of professional software development experience. I have worked in an enterprise setting on some of the most complex Windows desktop applications, server services, and Web APIs. I am confident that I will be able to fit the needs of your next project!');
/*!40000 ALTER TABLE `service-information` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `services`
--
DROP TABLE IF EXISTS `services`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `services` (
`ServiceID` int NOT NULL AUTO_INCREMENT,
`ServiceName` varchar(255) NOT NULL,
`ServiceTags` varchar(255) DEFAULT NULL,
`FontAwesomeIcon` varchar(50) NOT NULL,
`IsEnabled` bit(1) NOT NULL DEFAULT b'1',
PRIMARY KEY (`ServiceID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `services`
--
LOCK TABLES `services` WRITE;
/*!40000 ALTER TABLE `services` DISABLE KEYS */;
INSERT INTO `services` VALUES (1,'Software Development','C#, ASP.net, PHP','fa-file-code',_binary ''),(2,'Web Design & Hosting','','',_binary '\0'),(3,'Custom Computers Systems','Gaming, Servers','fa-tv',_binary ''),(4,'Resume Services','Updating, Creating','fa-file-word',_binary ''),(5,'VHS to DVD Conversion','','fa-compact-disc',_binary ''),(6,'Tech Consulting','Engineering','fa-user-tie',_binary '');
/*!40000 ALTER TABLE `services` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping routines for database 'dmcdynamics'
--
/*!50003 DROP PROCEDURE IF EXISTS `GetCompanyInfo` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCompanyInfo`()
begin
SELECT CompanyName,
PhoneNumber,
EmailAddress,
Address,
CompanySlogan
FROM `CompanyInfo`
LIMIT 1;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `GetServices` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetServices`()
begin
SELECT ServiceID,
ServiceName,
ServiceTags,
FontAwesomeIcon,
IsEnabled
FROM `Services`
WHERE IsEnabled = 1;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ServiceInformation_SelectOne` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ServiceInformation_SelectOne`(
IN ID INT
)
BEGIN
SELECT ServiceInformationID,
ServiceID,
ServiceDescription
FROM `dmcdynamics`.`service-information`
WHERE ServiceID = ID;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-09-16 22:43:51

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Extensions.Configuration;
namespace Common.Library.Settings
{
public static class SettingsLoader
{
public static IConfiguration Configuration { get; set; }
#region DB
public static string DBName { get => Configuration?.GetSection("Database")["DBName"]; }
public static string DBHost { get => Configuration?.GetSection("Database")["Host"]; }
public static string DBUserName { get => Configuration?.GetSection("Database")["UserName"]; }
public static string DBPassword { get => Configuration?.GetSection("Database")["Password"]; }
#endregion
}
}
Loading…
Cancel
Save