Пример #1
0
        /// <summary>
        /// This method deletes a 'FieldSet' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'FieldSet' to delete.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject DeleteFieldSet(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
                DeleteFieldSetStoredProcedure deleteFieldSetProc = null;

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

                    // verify fieldSet exists
                    if (fieldSet != null)
                    {
                        // Now create deleteFieldSetProc from FieldSetWriter
                        // The DataWriter converts the 'FieldSet'
                        // to the SqlParameter[] array needed to delete a 'FieldSet'.
                        deleteFieldSetProc = FieldSetWriter.CreateDeleteFieldSetStoredProcedure(fieldSet);
                    }
                }

                // Verify deleteFieldSetProc exists
                if (deleteFieldSetProc != null)
                {
                    // Execute Delete Stored Procedure
                    bool deleted = this.DataManager.FieldSetManager.DeleteFieldSet(deleteFieldSetProc, 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
        /// 'DeleteFieldSet'StoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'FieldSet_Delete'.
        /// </summary>
        /// <param name="fieldSet">The 'FieldSet' to Delete.</param>
        /// <returns>An instance of a 'DeleteFieldSetStoredProcedure' object.</returns>
        public static DeleteFieldSetStoredProcedure CreateDeleteFieldSetStoredProcedure(FieldSet fieldSet)
        {
            // Initial Value
            DeleteFieldSetStoredProcedure deleteFieldSetStoredProcedure = new DeleteFieldSetStoredProcedure();

            // Now Create Parameters For The DeleteProc
            deleteFieldSetStoredProcedure.Parameters = CreatePrimaryKeyParameter(fieldSet);

            // return value
            return(deleteFieldSetStoredProcedure);
        }
Пример #3
0
        /// <summary>
        /// This method deletes a 'FieldSet' object.
        /// </summary>
        /// <returns>True if successful false if not.</returns>
        /// </summary>
        public bool DeleteFieldSet(DeleteFieldSetStoredProcedure deleteFieldSetProc, DataConnector databaseConnector)
        {
            // Initial Value
            bool deleted = false;

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

            // return value
            return(deleted);
        }