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