/// <summary> /// This method finds a 'Noun' object. /// This method uses the 'Noun_Find' procedure. /// </summary> /// <returns>A 'Noun' object.</returns> /// </summary> public Noun FindNoun(FindNounStoredProcedure findNounProc, DataConnector databaseConnector) { // Initial Value Noun noun = null; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // First Get Dataset DataSet nounDataSet = this.DataHelper.LoadDataSet(findNounProc, databaseConnector); // Verify DataSet Exists if (nounDataSet != null) { // Get DataTable From DataSet DataRow row = this.DataHelper.ReturnFirstRow(nounDataSet); // if row exists if (row != null) { // Load Noun noun = NounReader.Load(row); } } } // return value return(noun); }
/// <summary> /// This method finds a 'Noun' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'Noun' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject FindNoun(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals Noun noun = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Find StoredProcedure FindNounStoredProcedure findNounProc = null; // verify the first parameters is a 'Noun'. if (parameters[0].ObjectValue as Noun != null) { // Get NounParameter Noun paramNoun = (Noun)parameters[0].ObjectValue; // verify paramNoun exists if (paramNoun != null) { // Now create findNounProc from NounWriter // The DataWriter converts the 'Noun' // to the SqlParameter[] array needed to find a 'Noun'. findNounProc = NounWriter.CreateFindNounStoredProcedure(paramNoun); } // Verify findNounProc exists if (findNounProc != null) { // Execute Find Stored Procedure noun = this.DataManager.NounManager.FindNoun(findNounProc, dataConnector); // if dataObject exists if (noun != null) { // set returnObject.ObjectValue returnObject.ObjectValue = noun; } } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } } // return value return(returnObject); }
/// <summary> /// This method creates an instance of a /// 'FindNounStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'Noun_Find'. /// </summary> /// <param name="noun">The 'Noun' to use to /// get the primary key parameter.</param> /// <returns>An instance of an FetchUserStoredProcedure</returns> public static FindNounStoredProcedure CreateFindNounStoredProcedure(Noun noun) { // Initial Value FindNounStoredProcedure findNounStoredProcedure = null; // verify noun exists if (noun != null) { // Instanciate findNounStoredProcedure findNounStoredProcedure = new FindNounStoredProcedure(); // Now create parameters for this procedure findNounStoredProcedure.Parameters = CreatePrimaryKeyParameter(noun); } // return value return(findNounStoredProcedure); }