/// <summary>
        /// This method fetches a  'List<DTNDatabase>' object.
        /// This method uses the 'DTNDatabases_FetchAll' procedure.
        /// </summary>
        /// <returns>A 'List<DTNDatabase>'</returns>
        /// </summary>
        public List <DTNDatabase> FetchAllDTNDatabases(FetchAllDTNDatabasesStoredProcedure fetchAllDTNDatabasesProc, DataConnector databaseConnector)
        {
            // Initial Value
            List <DTNDatabase> dTNDatabaseCollection = null;

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

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

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

            // return value
            return(dTNDatabaseCollection);
        }
Пример #2
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FetchAllDTNDatabasesStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'DTNDatabase_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllDTNDatabasesStoredProcedure' object.</returns>
        public static FetchAllDTNDatabasesStoredProcedure CreateFetchAllDTNDatabasesStoredProcedure(DTNDatabase dTNDatabase)
        {
            // Initial value
            FetchAllDTNDatabasesStoredProcedure fetchAllDTNDatabasesStoredProcedure = new FetchAllDTNDatabasesStoredProcedure();

            // return value
            return(fetchAllDTNDatabasesStoredProcedure);
        }
Пример #3
0
        /// <summary>
        /// This method fetches all 'DTNDatabase' objects.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'DTNDatabase' to delete.
        /// <returns>A PolymorphicObject object with all  'DTNDatabases' objects.
        internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            List <DTNDatabase> dTNDatabaseListCollection = null;

            // Create FetchAll StoredProcedure
            FetchAllDTNDatabasesStoredProcedure fetchAllProc = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Get DTNDatabaseParameter
                // Declare Parameter
                DTNDatabase paramDTNDatabase = null;

                // verify the first parameters is a(n) 'DTNDatabase'.
                if (parameters[0].ObjectValue as DTNDatabase != null)
                {
                    // Get DTNDatabaseParameter
                    paramDTNDatabase = (DTNDatabase)parameters[0].ObjectValue;
                }

                // Now create FetchAllDTNDatabasesProc from DTNDatabaseWriter
                fetchAllProc = DTNDatabaseWriter.CreateFetchAllDTNDatabasesStoredProcedure(paramDTNDatabase);
            }

            // Verify fetchAllProc exists
            if (fetchAllProc != null)
            {
                // Execute FetchAll Stored Procedure
                dTNDatabaseListCollection = this.DataManager.DTNDatabaseManager.FetchAllDTNDatabases(fetchAllProc, dataConnector);

                // if dataObjectCollection exists
                if (dTNDatabaseListCollection != null)
                {
                    // set returnObject.ObjectValue
                    returnObject.ObjectValue = dTNDatabaseListCollection;
                }
            }
            else
            {
                // Raise Error Data Connection Not Available
                throw new Exception("The database connection is not available.");
            }

            // return value
            return(returnObject);
        }
Пример #4
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FetchAllDTNDatabasesUsersStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'DTNDatabase_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllDTNDatabasesStoredProcedure' object.</returns>
        public new static FetchAllDTNDatabasesStoredProcedure CreateFetchAllDTNDatabasesStoredProcedure(DTNDatabase database)
        {
            // Initial value
            FetchAllDTNDatabasesStoredProcedure fetchAllDTNDatabasesStoredProcedure = new FetchAllDTNDatabasesStoredProcedure();

            // verify the database exists
            if ((database != null) && (database.ProjectId > 0))
            {
                // set the procedure name
                fetchAllDTNDatabasesStoredProcedure.ProcedureName = "DTNDatabase_FetchAllForProject";

                // create the parameters
                fetchAllDTNDatabasesStoredProcedure.Parameters = SqlParameterHelper.CreateSqlParameters("@ProjectId", database.ProjectId);
            }

            // return value
            return(fetchAllDTNDatabasesStoredProcedure);
        }