/// <summary>
        /// This method updates a 'Adverb'.
        /// This method uses the 'Adverb_Update' procedure.
        /// </summary>
        /// <returns>True if successful false if not.</returns>
        /// </summary>
        public bool UpdateAdverb(UpdateAdverbStoredProcedure updateAdverbProc, DataConnector databaseConnector)
        {
            // Initial Value
            bool saved = false;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // Execute Update.
                saved = this.DataHelper.UpdateRecord(updateAdverbProc, databaseConnector);
            }

            // return value
            return(saved);
        }
Example #2
0
        /// <summary>
        /// This method creates an instance of an
        /// 'UpdateAdverbStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Adverb_Update'.
        /// </summary>
        /// <param name="adverb"The 'Adverb' object to update</param>
        /// <returns>An instance of a 'UpdateAdverbStoredProcedure</returns>
        public static UpdateAdverbStoredProcedure CreateUpdateAdverbStoredProcedure(Adverb adverb)
        {
            // Initial Value
            UpdateAdverbStoredProcedure updateAdverbStoredProcedure = null;

            // verify adverb exists
            if (adverb != null)
            {
                // Instanciate updateAdverbStoredProcedure
                updateAdverbStoredProcedure = new UpdateAdverbStoredProcedure();

                // Now create parameters for this procedure
                updateAdverbStoredProcedure.Parameters = CreateUpdateParameters(adverb);
            }

            // return value
            return(updateAdverbStoredProcedure);
        }
        /// <summary>
        /// This method updates a 'Adverb' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'Adverb' to update.
        /// <returns>A PolymorphicObject object with a value.
        internal PolymorphicObject UpdateAdverb(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            Adverb adverb = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Create Update StoredProcedure
                UpdateAdverbStoredProcedure updateAdverbProc = null;

                // verify the first parameters is a(n) 'Adverb'.
                if (parameters[0].ObjectValue as Adverb != null)
                {
                    // Create Adverb Parameter
                    adverb = (Adverb)parameters[0].ObjectValue;

                    // verify adverb exists
                    if (adverb != null)
                    {
                        // Now create updateAdverbProc from AdverbWriter
                        // The DataWriter converts the 'Adverb'
                        // to the SqlParameter[] array needed to update a 'Adverb'.
                        updateAdverbProc = AdverbWriter.CreateUpdateAdverbStoredProcedure(adverb);
                    }

                    // Verify updateAdverbProc exists
                    if (updateAdverbProc != null)
                    {
                        // Execute Update Stored Procedure
                        bool saved = this.DataManager.AdverbManager.UpdateAdverb(updateAdverbProc, dataConnector);

                        // Create returnObject.Boolean
                        returnObject.Boolean = new NullableBoolean();

                        // If save was successful
                        if (saved)
                        {
                            // Set returnObject.Boolean.Value to true
                            returnObject.Boolean.Value = NullableBooleanEnum.True;
                        }
                        else
                        {
                            // Set returnObject.Boolean.Value to false
                            returnObject.Boolean.Value = NullableBooleanEnum.False;
                        }
                    }
                    else
                    {
                        // Raise Error Data Connection Not Available
                        throw new Exception("The database connection is not available.");
                    }
                }
            }

            // return value
            return(returnObject);
        }