/// <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); }
/// <summary> /// This method creates an instance of an /// 'DeleteMethod'StoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'Method_Delete'. /// </summary> /// <param name="method">The 'Method' to Delete.</param> /// <returns>An instance of a 'DeleteMethodStoredProcedure' object.</returns> public static DeleteMethodStoredProcedure CreateDeleteMethodStoredProcedure(Method method) { // Initial Value DeleteMethodStoredProcedure deleteMethodStoredProcedure = new DeleteMethodStoredProcedure(); // Now Create Parameters For The DeleteProc deleteMethodStoredProcedure.Parameters = CreatePrimaryKeyParameter(method); // return value return(deleteMethodStoredProcedure); }
/// <summary> /// This method deletes a 'Method' object. /// </summary> /// <returns>True if successful false if not.</returns> /// </summary> public bool DeleteMethod(DeleteMethodStoredProcedure deleteMethodProc, DataConnector databaseConnector) { // Initial Value bool deleted = false; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // Execute Non Query deleted = this.DataHelper.DeleteRecord(deleteMethodProc, databaseConnector); } // return value return(deleted); }