/// <summary> /// This method deletes a 'NotificationHistory' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'NotificationHistory' to delete. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject DeleteNotificationHistory(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 DeleteNotificationHistoryStoredProcedure deleteNotificationHistoryProc = null; // verify the first parameters is a(n) 'NotificationHistory'. if (parameters[0].ObjectValue as NotificationHistory != null) { // Create NotificationHistory NotificationHistory notificationHistory = (NotificationHistory)parameters[0].ObjectValue; // verify notificationHistory exists if (notificationHistory != null) { // Now create deleteNotificationHistoryProc from NotificationHistoryWriter // The DataWriter converts the 'NotificationHistory' // to the SqlParameter[] array needed to delete a 'NotificationHistory'. deleteNotificationHistoryProc = NotificationHistoryWriter.CreateDeleteNotificationHistoryStoredProcedure(notificationHistory); } } // Verify deleteNotificationHistoryProc exists if (deleteNotificationHistoryProc != null) { // Execute Delete Stored Procedure bool deleted = this.DataManager.NotificationHistoryManager.DeleteNotificationHistory(deleteNotificationHistoryProc, 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 /// 'DeleteNotificationHistory'StoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'NotificationHistory_Delete'. /// </summary> /// <param name="notificationHistory">The 'NotificationHistory' to Delete.</param> /// <returns>An instance of a 'DeleteNotificationHistoryStoredProcedure' object.</returns> public static DeleteNotificationHistoryStoredProcedure CreateDeleteNotificationHistoryStoredProcedure(NotificationHistory notificationHistory) { // Initial Value DeleteNotificationHistoryStoredProcedure deleteNotificationHistoryStoredProcedure = new DeleteNotificationHistoryStoredProcedure(); // Now Create Parameters For The DeleteProc deleteNotificationHistoryStoredProcedure.Parameters = CreatePrimaryKeyParameter(notificationHistory); // return value return(deleteNotificationHistoryStoredProcedure); }
/// <summary> /// This method deletes a 'NotificationHistory' object. /// </summary> /// <returns>True if successful false if not.</returns> /// </summary> public bool DeleteNotificationHistory(DeleteNotificationHistoryStoredProcedure deleteNotificationHistoryProc, DataConnector databaseConnector) { // Initial Value bool deleted = false; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // Execute Non Query deleted = this.DataHelper.DeleteRecord(deleteNotificationHistoryProc, databaseConnector); } // return value return(deleted); }