/// <summary>
        /// This method fetches a  'List<Admin>' object.
        /// This method uses the 'Admins_FetchAll' procedure.
        /// </summary>
        /// <returns>A 'List<Admin>'</returns>
        /// </summary>
        public List <Admin> FetchAllAdmins(FetchAllAdminsStoredProcedure fetchAllAdminsProc, DataConnector databaseConnector)
        {
            // Initial Value
            List <Admin> adminCollection = null;

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

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

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

            // return value
            return(adminCollection);
        }
Beispiel #2
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FetchAllAdminsStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Admin_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllAdminsStoredProcedure' object.</returns>
        public static FetchAllAdminsStoredProcedure CreateFetchAllAdminsStoredProcedure(Admin admin)
        {
            // Initial value
            FetchAllAdminsStoredProcedure fetchAllAdminsStoredProcedure = new FetchAllAdminsStoredProcedure();

            // return value
            return(fetchAllAdminsStoredProcedure);
        }
Beispiel #3
0
        /// <summary>
        /// This method fetches all 'Admin' objects.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'Admin' to delete.
        /// <returns>A PolymorphicObject object with all  'Admins' objects.
        internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            List <Admin> adminListCollection = null;

            // Create FetchAll StoredProcedure
            FetchAllAdminsStoredProcedure fetchAllProc = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Get AdminParameter
                // Declare Parameter
                Admin paramAdmin = null;

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

                // Now create FetchAllAdminsProc from AdminWriter
                fetchAllProc = AdminWriter.CreateFetchAllAdminsStoredProcedure(paramAdmin);
            }

            // Verify fetchAllProc exists
            if (fetchAllProc != null)
            {
                // Execute FetchAll Stored Procedure
                adminListCollection = this.DataManager.AdminManager.FetchAllAdmins(fetchAllProc, dataConnector);

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

            // return value
            return(returnObject);
        }