Exemplo n.º 1
0
        /// <summary>
        /// This method deletes a 'ProjectReference' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'ProjectReference' to delete.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject DeleteProjectReference(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
                DeleteProjectReferenceStoredProcedure deleteProjectReferenceProc = null;

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

                    // verify projectReference exists
                    if (projectReference != null)
                    {
                        // Now create deleteProjectReferenceProc from ProjectReferenceWriter
                        // The DataWriter converts the 'ProjectReference'
                        // to the SqlParameter[] array needed to delete a 'ProjectReference'.
                        deleteProjectReferenceProc = ProjectReferenceWriter.CreateDeleteProjectReferenceStoredProcedure(projectReference);
                    }
                }

                // Verify deleteProjectReferenceProc exists
                if (deleteProjectReferenceProc != null)
                {
                    // Execute Delete Stored Procedure
                    bool deleted = this.DataManager.ProjectReferenceManager.DeleteProjectReference(deleteProjectReferenceProc, 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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method creates an instance of an
        /// 'DeleteProjectReference'StoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'ProjectReference_Delete'.
        /// </summary>
        /// <param name="projectReference">The 'ProjectReference' to Delete.</param>
        /// <returns>An instance of a 'DeleteProjectReferenceStoredProcedure' object.</returns>
        public static DeleteProjectReferenceStoredProcedure CreateDeleteProjectReferenceStoredProcedure(ProjectReference projectReference)
        {
            // Initial Value
            DeleteProjectReferenceStoredProcedure deleteProjectReferenceStoredProcedure = new DeleteProjectReferenceStoredProcedure();

            // Now Create Parameters For The DeleteProc
            deleteProjectReferenceStoredProcedure.Parameters = CreatePrimaryKeyParameter(projectReference);

            // return value
            return(deleteProjectReferenceStoredProcedure);
        }
        /// <summary>
        /// This method deletes a 'ProjectReference' object.
        /// </summary>
        /// <returns>True if successful false if not.</returns>
        /// </summary>
        public bool DeleteProjectReference(DeleteProjectReferenceStoredProcedure deleteProjectReferenceProc, DataConnector databaseConnector)
        {
            // Initial Value
            bool deleted = false;

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

            // return value
            return(deleted);
        }