Пример #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);
        }
        /// <summary>
        /// This method creates an instance of a
        /// 'FetchAllDTNTablesStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'DTNTable_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllDTNTablesStoredProcedure' object.</returns>
        public static FetchAllDTNTablesStoredProcedure CreateFetchAllDTNTablesStoredProcedure(DTNTable dTNTable)
        {
            // Initial value
            FetchAllDTNTablesStoredProcedure fetchAllDTNTablesStoredProcedure = new FetchAllDTNTablesStoredProcedure();

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

            // locals
            List <DTNTable> dTNTableListCollection = null;

            // Create FetchAll StoredProcedure
            FetchAllDTNTablesStoredProcedure fetchAllProc = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Get DTNTableParameter
                // Declare Parameter
                DTNTable paramDTNTable = null;

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

                // Now create FetchAllDTNTablesProc from DTNTableWriter
                fetchAllProc = DTNTableWriter.CreateFetchAllDTNTablesStoredProcedure(paramDTNTable);
            }

            // Verify fetchAllProc exists
            if (fetchAllProc != null)
            {
                // Execute FetchAll Stored Procedure
                dTNTableListCollection = this.DataManager.DTNTableManager.FetchAllDTNTables(fetchAllProc, dataConnector);

                // if dataObjectCollection exists
                if (dTNTableListCollection != null)
                {
                    // set returnObject.ObjectValue
                    returnObject.ObjectValue = dTNTableListCollection;
                }
            }
            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
        /// 'FetchAllDTNTablesStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'DTNTable_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllDTNTablesStoredProcedure' object.</returns>
        public static new FetchAllDTNTablesStoredProcedure CreateFetchAllDTNTablesStoredProcedure(DTNTable dTNTable)
        {
            // Initial value
            FetchAllDTNTablesStoredProcedure fetchAllDTNTablesStoredProcedure = new FetchAllDTNTablesStoredProcedure();

            // if the dTNTable object exists
            if (dTNTable != null)
            {
                // if LoadByProjectId is true
                if (dTNTable.LoadByProjectId)
                {
                    // Change the procedure name
                    fetchAllDTNTablesStoredProcedure.ProcedureName = "DTNTable_FetchAllByProjectId";

                    // Create the @ProjectId parameter
                    fetchAllDTNTablesStoredProcedure.Parameters = SqlParameterHelper.CreateSqlParameters("@ProjectId", dTNTable.ProjectId);
                }
            }

            // return value
            return(fetchAllDTNTablesStoredProcedure);
        }