/// <summary> /// This method fetches a 'List<Noun>' object. /// This method uses the 'Nouns_FetchAll' procedure. /// </summary> /// <returns>A 'List<Noun>'</returns> /// </summary> public List <Noun> FetchAllNouns(FetchAllNounsStoredProcedure fetchAllNounsProc, DataConnector databaseConnector) { // Initial Value List <Noun> nounCollection = null; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // First Get Dataset DataSet allNounsDataSet = this.DataHelper.LoadDataSet(fetchAllNounsProc, databaseConnector); // Verify DataSet Exists if (allNounsDataSet != null) { // Get DataTable From DataSet DataTable table = this.DataHelper.ReturnFirstTable(allNounsDataSet); // if table exists if (table != null) { // Load Collection nounCollection = NounReader.LoadCollection(table); } } } // return value return(nounCollection); }
/// <summary> /// This method creates an instance of a /// 'FetchAllNounsStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'Noun_FetchAll'. /// </summary> /// <returns>An instance of a(n) 'FetchAllNounsStoredProcedure' object.</returns> public static FetchAllNounsStoredProcedure CreateFetchAllNounsStoredProcedure(Noun noun) { // Initial value FetchAllNounsStoredProcedure fetchAllNounsStoredProcedure = new FetchAllNounsStoredProcedure(); // return value return(fetchAllNounsStoredProcedure); }
/// <summary> /// This method fetches all 'Noun' objects. /// </summary> /// <param name='List<PolymorphicObject>'>The 'Noun' to delete. /// <returns>A PolymorphicObject object with all 'Nouns' objects. internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals List <Noun> nounListCollection = null; // Create FetchAll StoredProcedure FetchAllNounsStoredProcedure fetchAllProc = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Get NounParameter // Declare Parameter Noun paramNoun = null; // verify the first parameters is a(n) 'Noun'. if (parameters[0].ObjectValue as Noun != null) { // Get NounParameter paramNoun = (Noun)parameters[0].ObjectValue; } // Now create FetchAllNounsProc from NounWriter fetchAllProc = NounWriter.CreateFetchAllNounsStoredProcedure(paramNoun); } // Verify fetchAllProc exists if (fetchAllProc != null) { // Execute FetchAll Stored Procedure nounListCollection = this.DataManager.NounManager.FetchAllNouns(fetchAllProc, dataConnector); // if dataObjectCollection exists if (nounListCollection != null) { // set returnObject.ObjectValue returnObject.ObjectValue = nounListCollection; } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } // return value return(returnObject); }