/// <summary>
        /// This method inserts a 'Adjective' object.
        /// This method uses the 'Adjective_Insert' procedure.
        /// </summary>
        /// <returns>The identity value of the new record.</returns>
        /// </summary>
        public int InsertAdjective(InsertAdjectiveStoredProcedure insertAdjectiveProc, DataConnector databaseConnector)
        {
            // Initial Value
            int newIdentity = -1;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // Execute Non Query
                newIdentity = this.DataHelper.InsertRecord(insertAdjectiveProc, databaseConnector);
            }

            // return value
            return(newIdentity);
        }
Esempio n. 2
0
        /// <summary>
        /// This method inserts a 'Adjective' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'Adjective' to insert.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject InsertAdjective(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            Adjective adjective = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Create Insert StoredProcedure
                InsertAdjectiveStoredProcedure insertAdjectiveProc = null;

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

                    // verify adjective exists
                    if (adjective != null)
                    {
                        // Now create insertAdjectiveProc from AdjectiveWriter
                        // The DataWriter converts the 'Adjective'
                        // to the SqlParameter[] array needed to insert a 'Adjective'.
                        insertAdjectiveProc = AdjectiveWriter.CreateInsertAdjectiveStoredProcedure(adjective);
                    }

                    // Verify insertAdjectiveProc exists
                    if (insertAdjectiveProc != null)
                    {
                        // Execute Insert Stored Procedure
                        returnObject.IntegerValue = this.DataManager.AdjectiveManager.InsertAdjective(insertAdjectiveProc, dataConnector);
                    }
                }
                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 an
        /// 'InsertAdjectiveStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Adjective_Insert'.
        /// </summary>
        /// <param name="adjective"The 'Adjective' object to insert</param>
        /// <returns>An instance of a 'InsertAdjectiveStoredProcedure' object.</returns>
        public static InsertAdjectiveStoredProcedure CreateInsertAdjectiveStoredProcedure(Adjective adjective)
        {
            // Initial Value
            InsertAdjectiveStoredProcedure insertAdjectiveStoredProcedure = null;

            // verify adjective exists
            if (adjective != null)
            {
                // Instanciate insertAdjectiveStoredProcedure
                insertAdjectiveStoredProcedure = new InsertAdjectiveStoredProcedure();

                // Now create parameters for this procedure
                insertAdjectiveStoredProcedure.Parameters = CreateInsertParameters(adjective);
            }

            // return value
            return(insertAdjectiveStoredProcedure);
        }