/// <summary>
        /// This method finds a  'Verb' object.
        /// This method uses the 'Verb_Find' procedure.
        /// </summary>
        /// <returns>A 'Verb' object.</returns>
        /// </summary>
        public Verb FindVerb(FindVerbStoredProcedure findVerbProc, DataConnector databaseConnector)
        {
            // Initial Value
            Verb verb = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load Verb
                        verb = VerbReader.Load(row);
                    }
                }
            }

            // return value
            return(verb);
        }
        /// <summary>
        /// This method finds a 'Verb' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'Verb' to delete.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject FindVerb(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            Verb verb = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Create Find StoredProcedure
                FindVerbStoredProcedure findVerbProc = null;

                // verify the first parameters is a 'Verb'.
                if (parameters[0].ObjectValue as Verb != null)
                {
                    // Get VerbParameter
                    Verb paramVerb = (Verb)parameters[0].ObjectValue;

                    // verify paramVerb exists
                    if (paramVerb != null)
                    {
                        // Now create findVerbProc from VerbWriter
                        // The DataWriter converts the 'Verb'
                        // to the SqlParameter[] array needed to find a 'Verb'.
                        findVerbProc = VerbWriter.CreateFindVerbStoredProcedure(paramVerb);
                    }

                    // Verify findVerbProc exists
                    if (findVerbProc != null)
                    {
                        // Execute Find Stored Procedure
                        verb = this.DataManager.VerbManager.FindVerb(findVerbProc, dataConnector);

                        // if dataObject exists
                        if (verb != null)
                        {
                            // set returnObject.ObjectValue
                            returnObject.ObjectValue = verb;
                        }
                    }
                }
                else
                {
                    // Raise Error Data Connection Not Available
                    throw new Exception("The database connection is not available.");
                }
            }

            // return value
            return(returnObject);
        }
Esempio n. 3
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FindVerbStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Verb_Find'.
        /// </summary>
        /// <param name="verb">The 'Verb' to use to
        /// get the primary key parameter.</param>
        /// <returns>An instance of an FetchUserStoredProcedure</returns>
        public static FindVerbStoredProcedure CreateFindVerbStoredProcedure(Verb verb)
        {
            // Initial Value
            FindVerbStoredProcedure findVerbStoredProcedure = null;

            // verify verb exists
            if (verb != null)
            {
                // Instanciate findVerbStoredProcedure
                findVerbStoredProcedure = new FindVerbStoredProcedure();

                // Now create parameters for this procedure
                findVerbStoredProcedure.Parameters = CreatePrimaryKeyParameter(verb);
            }

            // return value
            return(findVerbStoredProcedure);
        }