From 4652305d91526e18bcd035b11bf7a55f2c29b7eb Mon Sep 17 00:00:00 2001 From: Don Oerkfitz Date: Sun, 18 Jul 2021 01:04:00 -0500 Subject: [PATCH] adding onto the testimonial system expanding on framework --- .../Websites/DMCDynamics.LLC/TestimonialGuidsDAO.cs | 1 - .../DMCDynamics.LLC/TestimonialImagesDAO.cs | 5 ++--- .../DAO/Websites/DMCDynamics.LLC/TestimonialsDAO.cs | 13 +++++++++---- Common.Library/SQL/MySQL/MySQL.cs | 12 ++++++++++++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialGuidsDAO.cs b/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialGuidsDAO.cs index 0f4f567..86de327 100644 --- a/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialGuidsDAO.cs +++ b/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialGuidsDAO.cs @@ -30,7 +30,6 @@ namespace Common.Library.DataLayer.DAO.Websites.DMCDynamics.LLC 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); diff --git a/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialImagesDAO.cs b/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialImagesDAO.cs index 6fba3a4..353464a 100644 --- a/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialImagesDAO.cs +++ b/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialImagesDAO.cs @@ -8,10 +8,9 @@ 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(string server, string database, string username, string password) : base(server, database, username, password) { } - } + public TestimonialImagesDAO(DBConnectionInformation dBConnectionInformation) : base(dBConnectionInformation) { } public TestimonialImagesDTO SelectOne(int testimonialID) { diff --git a/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialsDAO.cs b/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialsDAO.cs index 2dcbbb2..6a3e69c 100644 --- a/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialsDAO.cs +++ b/Common.Library.DataLayer/DAO/Websites/DMCDynamics.LLC/TestimonialsDAO.cs @@ -9,10 +9,9 @@ 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(string server, string database, string username, string password) : base(server, database, username, password) { } - } + public TestimonialsDAO(DBConnectionInformation dBConnectionInformation) : base(dBConnectionInformation) { } public TestimonialsDTOCollection SelectAll() { @@ -65,7 +64,13 @@ namespace Common.Library.DataLayer.DAO.Websites.DMCDynamics.LLC 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(); diff --git a/Common.Library/SQL/MySQL/MySQL.cs b/Common.Library/SQL/MySQL/MySQL.cs index 0697ec6..3bd0bff 100644 --- a/Common.Library/SQL/MySQL/MySQL.cs +++ b/Common.Library/SQL/MySQL/MySQL.cs @@ -216,5 +216,17 @@ namespace Common.Library.SQL.MySQL { return GetDateTime(GetOrdinal(columnName)); } + + + //new MySqlParameter("GUID", MySqlDbType.VarChar, 255, ParameterDirection.Input, false, 0, 0, string.Empty, DataRowVersion.Proposed, guid) + protected MySqlParameter GetParameter(string columnName, MySqlDbType dataType, ParameterDirection direction, object data) + { + return null; + } + + protected MySqlParameter GetParameter(string columnName, MySqlDbType dataType, int size, ParameterDirection direction, object data) + { + return new MySqlParameter(columnName, dataType, size, direction, false, 0, 0, string.Empty, DataRowVersion.Proposed, data); + } } }