/// <summary>
        /// This method finds a  'Adjective' object.
        /// This method uses the 'Adjective_Find' procedure.
        /// </summary>
        /// <returns>A 'Adjective' object.</returns>
        /// </summary>
        public Adjective FindAdjective(FindAdjectiveStoredProcedure findAdjectiveProc, DataConnector databaseConnector)
        {
            // Initial Value
            Adjective adjective = null;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // First Get Dataset
                DataSet adjectiveDataSet = this.DataHelper.LoadDataSet(findAdjectiveProc, databaseConnector);

                // Verify DataSet Exists
                if (adjectiveDataSet != null)
                {
                    // Get DataTable From DataSet
                    DataRow row = this.DataHelper.ReturnFirstRow(adjectiveDataSet);

                    // if row exists
                    if (row != null)
                    {
                        // Load Adjective
                        adjective = AdjectiveReader.Load(row);
                    }
                }
            }

            // return value
            return(adjective);
        }
Example #2
0
        /// <summary>
        /// This method finds a 'Adjective' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'Adjective' to delete.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject FindAdjective(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 Find StoredProcedure
                FindAdjectiveStoredProcedure findAdjectiveProc = null;

                // verify the first parameters is a 'Adjective'.
                if (parameters[0].ObjectValue as Adjective != null)
                {
                    // Get AdjectiveParameter
                    Adjective paramAdjective = (Adjective)parameters[0].ObjectValue;

                    // verify paramAdjective exists
                    if (paramAdjective != null)
                    {
                        // Now create findAdjectiveProc from AdjectiveWriter
                        // The DataWriter converts the 'Adjective'
                        // to the SqlParameter[] array needed to find a 'Adjective'.
                        findAdjectiveProc = AdjectiveWriter.CreateFindAdjectiveStoredProcedure(paramAdjective);
                    }

                    // Verify findAdjectiveProc exists
                    if (findAdjectiveProc != null)
                    {
                        // Execute Find Stored Procedure
                        adjective = this.DataManager.AdjectiveManager.FindAdjective(findAdjectiveProc, dataConnector);

                        // if dataObject exists
                        if (adjective != null)
                        {
                            // set returnObject.ObjectValue
                            returnObject.ObjectValue = adjective;
                        }
                    }
                }
                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
        /// 'FindAdjectiveStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Adjective_Find'.
        /// </summary>
        /// <param name="adjective">The 'Adjective' to use to
        /// get the primary key parameter.</param>
        /// <returns>An instance of an FetchUserStoredProcedure</returns>
        public static FindAdjectiveStoredProcedure CreateFindAdjectiveStoredProcedure(Adjective adjective)
        {
            // Initial Value
            FindAdjectiveStoredProcedure findAdjectiveStoredProcedure = null;

            // verify adjective exists
            if (adjective != null)
            {
                // Instanciate findAdjectiveStoredProcedure
                findAdjectiveStoredProcedure = new FindAdjectiveStoredProcedure();

                // Now create parameters for this procedure
                findAdjectiveStoredProcedure.Parameters = CreatePrimaryKeyParameter(adjective);
            }

            // return value
            return(findAdjectiveStoredProcedure);
        }