Ejemplo n.º 1
0
        /// <summary>
        /// This method fetches a  'List<Enumeration>' object.
        /// This method uses the 'Enumerations_FetchAll' procedure.
        /// </summary>
        /// <returns>A 'List<Enumeration>'</returns>
        /// </summary>
        public List <Enumeration> FetchAllEnumerations(FetchAllEnumerationsStoredProcedure fetchAllEnumerationsProc, DataConnector databaseConnector)
        {
            // Initial Value
            List <Enumeration> enumerationCollection = null;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // First Get Dataset
                DataSet allEnumerationsDataSet = this.DataHelper.LoadDataSet(fetchAllEnumerationsProc, databaseConnector);

                // Verify DataSet Exists
                if (allEnumerationsDataSet != null)
                {
                    // Get DataTable From DataSet
                    DataTable table = this.DataHelper.ReturnFirstTable(allEnumerationsDataSet);

                    // if table exists
                    if (table != null)
                    {
                        // Load Collection
                        enumerationCollection = EnumerationReader.LoadCollection(table);
                    }
                }
            }

            // return value
            return(enumerationCollection);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method finds a  'Enumeration' object.
        /// This method uses the 'Enumeration_Find' procedure.
        /// </summary>
        /// <returns>A 'Enumeration' object.</returns>
        /// </summary>
        public Enumeration FindEnumeration(FindEnumerationStoredProcedure findEnumerationProc, DataConnector databaseConnector)
        {
            // Initial Value
            Enumeration enumeration = null;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // First Get Dataset
                DataSet enumerationDataSet = this.DataHelper.LoadDataSet(findEnumerationProc, databaseConnector);

                // Verify DataSet Exists
                if (enumerationDataSet != null)
                {
                    // Get DataTable From DataSet
                    DataRow row = this.DataHelper.ReturnFirstRow(enumerationDataSet);

                    // if row exists
                    if (row != null)
                    {
                        // Load Enumeration
                        enumeration = EnumerationReader.Load(row);
                    }
                }
            }

            // return value
            return(enumeration);
        }