Example #1
0
        /// <summary>
        /// Recupera las propiedades de un decodificador.
        /// </summary>
        /// <param name="itemid">Identificador del decodificador.</param>
        /// <returns>Una instáncia de RCDecoder.</returns>
        public Decoder GetByName(string name)
        {
            string sql = string.Empty;

            try
            {
                Connect();

                sql = @"SELECT 
                        " + DecoderDAO.SQL_FIELDS_SELECT + @" 
                    FROM 
                        " + DecoderDAO.SQL_TABLE + @" 
                    WHERE 
                        decname = @decname";

                SetParameter("decname", name);

                using (SQLiteDataReader reader = ExecuteReader(sql))
                {
                    if (reader.Read())
                    {
                        return(DecoderDAO.ReadEntityRecord(reader));
                    }
                    reader.Close();
                }

                return(null);
            }
            catch (Exception ex)
            {
                Logger.LogError(this, ex);

                throw;
            }
            finally
            {
                Disconnect();
            }
        }
Example #2
0
        /// <summary>
        /// Get all decoders.
        /// </summary>
        /// <returns>The requested list of decoders.</returns>
        public List <Decoder> GetAll()
        {
            string         sql   = string.Empty;
            List <Decoder> items = new List <Decoder>();

            try
            {
                Connect();

                sql = @"SELECT 
                        " + DecoderDAO.SQL_FIELDS_SELECT + @" 
                    FROM 
                        " + DecoderDAO.SQL_TABLE + @" 
                    ORDER BY 
                        decname Asc";

                using (SQLiteDataReader reader = ExecuteReader(sql))
                {
                    while (reader.Read())
                    {
                        items.Add(DecoderDAO.ReadEntityRecord(reader));
                    }
                    reader.Close();
                }

                return(items);
            }
            catch (Exception ex)
            {
                Logger.LogError(this, ex);

                throw;
            }
            finally
            {
                Disconnect();
            }
        }