public static List <CentralLog> GetAll(string centralId)
        {
            List <CentralLog> logs = new List <CentralLog>();

            using (MySqlConnection connection = new MySqlConnection(DbAccess.Instance.ConnectionString))
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = connection;
                cmd.CommandText = "SELECT * FROM central_log WHERE central_ID = @IdCentral ORDER BY fecha DESC LIMIT 20";
                cmd.CommandType = System.Data.CommandType.Text;

                cmd.Parameters.AddWithValue("@IdCentral", centralId);

                connection.Open();

                using (MySqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        int id = Convert.ToInt32(reader["central_log_ID"]);

                        CentralLog log = new CentralLog(CentralMonitoreo.Get(reader["central_ID"].ToString()), CentralLogTipo.Get((ECentralLogTipo)Convert.ToInt32(reader["central_log_tipo_ID"])));
                        log.LogId = id;
                        log.Fecha = Convert.ToDateTime(reader["fecha"]);

                        // Agrego el log a la lista de retorno
                        logs.Add(log);
                    }
                }
            }

            return(logs);
        }
        /*
         * Obtiene el log más reciente
         */
        public static CentralLog GetLast(string centralId)
        {
            CentralLog log = null;

            using (MySqlConnection connection = new MySqlConnection(DbAccess.Instance.ConnectionString))
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = connection;
                cmd.CommandText = "SELECT * FROM central_log WHERE central_ID = @IdCentral ORDER BY fecha DESC LIMIT 1";
                cmd.CommandType = System.Data.CommandType.Text;

                cmd.Parameters.AddWithValue("@IdCentral", centralId);

                connection.Open();

                using (MySqlDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.Read())
                    {
                        log       = new CentralLog(CentralMonitoreo.Get(reader["central_ID"].ToString()), CentralLogTipo.Get((ECentralLogTipo)Convert.ToInt32(reader["central_log_tipo_ID"])));
                        log.LogId = Convert.ToInt32(reader["central_log_ID"]);
                        log.Fecha = Convert.ToDateTime(reader["fecha"]);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }

            return(log);
        }