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