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