/// <summary> /// This method deletes a 'Method' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'Method' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject DeleteMethod(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 DeleteMethodStoredProcedure deleteMethodProc = null; // verify the first parameters is a(n) 'Method'. if (parameters[0].ObjectValue as Method != null) { // Create Method Method method = (Method)parameters[0].ObjectValue; // verify method exists if (method != null) { // Now create deleteMethodProc from MethodWriter // The DataWriter converts the 'Method' // to the SqlParameter[] array needed to delete a 'Method'. deleteMethodProc = MethodWriter.CreateDeleteMethodStoredProcedure(method); } } // Verify deleteMethodProc exists if (deleteMethodProc != null) { // Execute Delete Stored Procedure bool deleted = this.DataManager.MethodManager.DeleteMethod(deleteMethodProc, 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); }