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

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Create Delete StoredProcedure
                DeleteReferencesSetStoredProcedure deleteReferencesSetProc = null;

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

                    // verify referencesSet exists
                    if (referencesSet != null)
                    {
                        // Now create deleteReferencesSetProc from ReferencesSetWriter
                        // The DataWriter converts the 'ReferencesSet'
                        // to the SqlParameter[] array needed to delete a 'ReferencesSet'.
                        deleteReferencesSetProc = ReferencesSetWriter.CreateDeleteReferencesSetStoredProcedure(referencesSet);
                    }
                }

                // Verify deleteReferencesSetProc exists
                if (deleteReferencesSetProc != null)
                {
                    // Execute Delete Stored Procedure
                    bool deleted = this.DataManager.ReferencesSetManager.DeleteReferencesSet(deleteReferencesSetProc, dataConnector);

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

                    // If delete was successful
                    if (deleted)
                    {
                        // 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);
        }
示例#2
0
        /// <summary>
        /// This method creates an instance of an
        /// 'DeleteReferencesSet'StoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'ReferencesSet_Delete'.
        /// </summary>
        /// <param name="referencesSet">The 'ReferencesSet' to Delete.</param>
        /// <returns>An instance of a 'DeleteReferencesSetStoredProcedure' object.</returns>
        public static DeleteReferencesSetStoredProcedure CreateDeleteReferencesSetStoredProcedure(ReferencesSet referencesSet)
        {
            // Initial Value
            DeleteReferencesSetStoredProcedure deleteReferencesSetStoredProcedure = new DeleteReferencesSetStoredProcedure();

            // Now Create Parameters For The DeleteProc
            deleteReferencesSetStoredProcedure.Parameters = CreatePrimaryKeyParameter(referencesSet);

            // return value
            return(deleteReferencesSetStoredProcedure);
        }
示例#3
0
        /// <summary>
        /// This method deletes a 'ReferencesSet' object.
        /// </summary>
        /// <returns>True if successful false if not.</returns>
        /// </summary>
        public bool DeleteReferencesSet(DeleteReferencesSetStoredProcedure deleteReferencesSetProc, DataConnector databaseConnector)
        {
            // Initial Value
            bool deleted = false;

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

            // return value
            return(deleted);
        }