Example #1
0
        /// <summary>
        /// This method fetches a  'List<DTNTable>' object.
        /// This method uses the 'DTNTables_FetchAll' procedure.
        /// </summary>
        /// <returns>A 'List<DTNTable>'</returns>
        /// </summary>
        public List <DTNTable> FetchAllDTNTables(FetchAllDTNTablesStoredProcedure fetchAllDTNTablesProc, DataConnector databaseConnector)
        {
            // Initial Value
            List <DTNTable> dTNTableCollection = null;

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

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

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

            // return value
            return(dTNTableCollection);
        }
Example #2
0
        /// <summary>
        /// This method finds a  'DTNTable' object.
        /// This method uses the 'DTNTable_Find' procedure.
        /// </summary>
        /// <returns>A 'DTNTable' object.</returns>
        /// </summary>
        public DTNTable FindDTNTable(FindDTNTableStoredProcedure findDTNTableProc, DataConnector databaseConnector)
        {
            // Initial Value
            DTNTable dTNTable = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load DTNTable
                        dTNTable = DTNTableReader.Load(row);
                    }
                }
            }

            // return value
            return(dTNTable);
        }