diff --git a/EDMI_ClientSuite/ClassInit.vb b/EDMI_ClientSuite/ClassInit.vb index 0ec64426..dddd4769 100644 --- a/EDMI_ClientSuite/ClassInit.vb +++ b/EDMI_ClientSuite/ClassInit.vb @@ -38,7 +38,7 @@ Public Class ClassInit End Sub - Private Sub Connect2NetService() + Private Function Connect2NetService() Try _Channel = Nothing _Channel = _ChannelFactory.CreateChannel() @@ -46,12 +46,14 @@ Public Class ClassInit AddHandler _Channel.Faulted, AddressOf Reconnect _Channel.Open() + Return True Catch ex As Exception _Logger.Error(ex) + Return False End Try - End Sub + End Function Private Sub Reconnect() _Channel.Abort() diff --git a/Modules.Database/Firebird.vb b/Modules.Database/Firebird.vb index 5dbb834e..e2f6838f 100644 --- a/Modules.Database/Firebird.vb +++ b/Modules.Database/Firebird.vb @@ -85,35 +85,35 @@ Public Class Firebird ''' ''' Public Sub New(LogConfig As LogConfig, Datasource As String, Database As String, User As String, Password As String) + Try + _MyLogger = LogConfig + _Logger = _MyLogger.GetLogger() + Dim oConnectionString = GetConnectionString(Datasource, Database, User, Password) - _MyLogger = LogConfig - _Logger = _MyLogger.GetLogger() + _connectionServer = Datasource + _connectionDatabase = Database + _connectionUsername = User + _connectionPassword = Password + _connectionString = oConnectionString + _Logger.Debug("Connecting to database..") + ' Test the connection + Dim oConnection = GetConnection() + ' If initial connection was successfully, close it + oConnection.Close() + If oConnection Is Nothing Then + Throw New Exceptions.DatabaseException() + Else + _DBInitialized = True + End If - Dim oConnectionString = GetConnectionString(Datasource, Database, User, Password) + _Logger.Debug("Connection sucessfully established!") + Catch ex As Exception + _Logger.Error(ex) + End Try - _connectionServer = Datasource - _connectionDatabase = Database - _connectionUsername = User - _connectionPassword = Password - _connectionString = oConnectionString - - _logger.Debug("Connecting to database..") - - ' Test the connection - Dim oConnection = GetConnection() - ' If initial connection was successfully, close it - oConnection?.Close() - - If oConnection Is Nothing Then - Throw New Exceptions.DatabaseException() - Else - _DBInitialized = True - End If - - _logger.Debug("Connection sucessfully established!") End Sub Public Function GetConnection() As FbConnection diff --git a/Modules.Database/My Project/AssemblyInfo.vb b/Modules.Database/My Project/AssemblyInfo.vb index 1ad3a483..01b3eda0 100644 --- a/Modules.Database/My Project/AssemblyInfo.vb +++ b/Modules.Database/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/Modules.Windream/Windream.vb b/Modules.Windream/Windream.vb index 080c0483..92f8b98f 100644 --- a/Modules.Windream/Windream.vb +++ b/Modules.Windream/Windream.vb @@ -1083,22 +1083,47 @@ Public Class Windream #End Region #Region "+++++ Remove +++++" ''' - ''' Deletes a file in windream + ''' Deletes a file in windream including all preversions ''' ''' full path to the file ''' Returns true when file was deleted, false if not ''' Public Function RemFile(ByVal WMPath As String) Try + Const COL_Document_VersionID = "dwVersionID" + Const WMObjectPartVersion = 128 + Dim oUnexpected_Error As Boolean = False WMPath = NormalizePath(WMPath) Dim oWMObject = GetWMObjectForFile(WMPath) If IsNothing(oWMObject) = False Then - oWMObject.Delete() - Return True + Try + If (oWMObject.aPart And WMObjectPartVersion) Then + Dim oWMObjects As WMObjects + Dim oWMVersion As WMObject + Dim iCount As Integer + oWMObjects = oWMObject.aVersions + iCount = oWMObjects.Count + If iCount > 0 Then + For Each oWMVersion In oWMObjects + oWMVersion.Delete() + Logger.Info($">> Deleted version '{oWMVersion.GetVariableValue(COL_Document_VersionID)}' of file '{oWMVersion.aName}'!") + Next + End If + End If + Catch ex As Exception + Logger.Warn($"Unexpected Error in CheckingDeleting Prevesions: {ex.Message}") + oUnexpected_Error = True + End Try + If oUnexpected_Error = False Then + oWMObject.Delete() + Logger.Info($">> File '{oWMObject.aName}' has been deleted!") + Return True + Else + Return False + End If Else Return False End If - Catch ex As Exception Logger.Error(ex) Return False diff --git a/Modules.Windream/Windream2.vb b/Modules.Windream/Windream2.vb index 5e3a23ed..2d861b6f 100644 --- a/Modules.Windream/Windream2.vb +++ b/Modules.Windream/Windream2.vb @@ -197,7 +197,7 @@ Public Class Windream2 If TestSessionLoggedIn() = False Then Return Nothing End If - + Path = GetNormalizedPath(Path) Dim oWMObject As WMObject Try @@ -951,13 +951,14 @@ Public Class Windream2 End If Try - Dim oWMObject As WMObject = Session.GetWMObjectByName(WMEntityAttribute, Path) + Dim oWMObject As WMObject = GetFileByPath(Path) If oWMObject Is Nothing Then Return False End If oWMObject.Delete() + _logger.Warn($"file {Path} has been deleted!") Return True Catch ex As Exception _logger.Error(ex)