/// <summary> /// This method fetches a 'List<LastName>' object. /// This method uses the 'LastNames_FetchAll' procedure. /// </summary> /// <returns>A 'List<LastName>'</returns> /// </summary> public List <LastName> FetchAllLastNames(FetchAllLastNamesStoredProcedure fetchAllLastNamesProc, DataConnector databaseConnector) { // Initial Value List <LastName> lastNameCollection = null; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // First Get Dataset DataSet allLastNamesDataSet = this.DataHelper.LoadDataSet(fetchAllLastNamesProc, databaseConnector); // Verify DataSet Exists if (allLastNamesDataSet != null) { // Get DataTable From DataSet DataTable table = this.DataHelper.ReturnFirstTable(allLastNamesDataSet); // if table exists if (table != null) { // Load Collection lastNameCollection = LastNameReader.LoadCollection(table); } } } // return value return(lastNameCollection); }
/// <summary> /// This method creates an instance of a /// 'FetchAllLastNamesStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'LastName_FetchAll'. /// </summary> /// <returns>An instance of a(n) 'FetchAllLastNamesStoredProcedure' object.</returns> public static FetchAllLastNamesStoredProcedure CreateFetchAllLastNamesStoredProcedure(LastName lastName) { // Initial value FetchAllLastNamesStoredProcedure fetchAllLastNamesStoredProcedure = new FetchAllLastNamesStoredProcedure(); // return value return(fetchAllLastNamesStoredProcedure); }
/// <summary> /// This method fetches all 'LastName' objects. /// </summary> /// <param name='List<PolymorphicObject>'>The 'LastName' to delete. /// <returns>A PolymorphicObject object with all 'LastNames' objects. internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals List <LastName> lastNameListCollection = null; // Create FetchAll StoredProcedure FetchAllLastNamesStoredProcedure fetchAllProc = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Get LastNameParameter // Declare Parameter LastName paramLastName = null; // verify the first parameters is a(n) 'LastName'. if (parameters[0].ObjectValue as LastName != null) { // Get LastNameParameter paramLastName = (LastName)parameters[0].ObjectValue; } // Now create FetchAllLastNamesProc from LastNameWriter fetchAllProc = LastNameWriter.CreateFetchAllLastNamesStoredProcedure(paramLastName); } // Verify fetchAllProc exists if (fetchAllProc != null) { // Execute FetchAll Stored Procedure lastNameListCollection = this.DataManager.LastNameManager.FetchAllLastNames(fetchAllProc, dataConnector); // if dataObjectCollection exists if (lastNameListCollection != null) { // set returnObject.ObjectValue returnObject.ObjectValue = lastNameListCollection; } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } // return value return(returnObject); }