You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6 KiB
C#

using Common.Library.SQL.MySQL;
using System;
using System.Data;
4 years ago
using Common.Library.DataLayer.DTO.Websites.DMCDynamics.LLC;
4 years ago
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();
}
}
}
}