Esempio n. 1
0
        /// <summary>
        /// This method fetches a  'List<User>' object.
        /// This method uses the 'Users_FetchAll' procedure.
        /// </summary>
        /// <returns>A 'List<User>'</returns>
        /// </summary>
        public List <User> FetchAllUsers(FetchAllUsersStoredProcedure fetchAllUsersProc, DataConnector databaseConnector)
        {
            // Initial Value
            List <User> userCollection = null;

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

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

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

            // return value
            return(userCollection);
        }