windream
This commit is contained in:
parent
6c9fc1c9e6
commit
00924416ec
@ -38,7 +38,7 @@ Public Class ClassInit
|
|||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub Connect2NetService()
|
Private Function Connect2NetService()
|
||||||
Try
|
Try
|
||||||
_Channel = Nothing
|
_Channel = Nothing
|
||||||
_Channel = _ChannelFactory.CreateChannel()
|
_Channel = _ChannelFactory.CreateChannel()
|
||||||
@ -46,12 +46,14 @@ Public Class ClassInit
|
|||||||
AddHandler _Channel.Faulted, AddressOf Reconnect
|
AddHandler _Channel.Faulted, AddressOf Reconnect
|
||||||
|
|
||||||
_Channel.Open()
|
_Channel.Open()
|
||||||
|
Return True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
|
Return False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Function
|
||||||
Private Sub Reconnect()
|
Private Sub Reconnect()
|
||||||
_Channel.Abort()
|
_Channel.Abort()
|
||||||
|
|
||||||
|
|||||||
@ -85,35 +85,35 @@ Public Class Firebird
|
|||||||
''' <param name="Password"></param>
|
''' <param name="Password"></param>
|
||||||
''' <exception cref="Exceptions.DatabaseException"></exception>
|
''' <exception cref="Exceptions.DatabaseException"></exception>
|
||||||
Public Sub New(LogConfig As LogConfig, Datasource As String, Database As String, User As String, Password As String)
|
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
|
_connectionServer = Datasource
|
||||||
_Logger = _MyLogger.GetLogger()
|
_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
|
End Sub
|
||||||
|
|
||||||
Public Function GetConnection() As FbConnection
|
Public Function GetConnection() As FbConnection
|
||||||
|
|||||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.0.0.4")>
|
<Assembly: AssemblyVersion("1.0.0.5")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||||
|
|||||||
@ -1083,22 +1083,47 @@ Public Class Windream
|
|||||||
#End Region
|
#End Region
|
||||||
#Region "+++++ Remove +++++"
|
#Region "+++++ Remove +++++"
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Deletes a file in windream
|
''' Deletes a file in windream including all preversions
|
||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="WMPath">full path to the file</param>
|
''' <param name="WMPath">full path to the file</param>
|
||||||
''' <returns>Returns true when file was deleted, false if not</returns>
|
''' <returns>Returns true when file was deleted, false if not</returns>
|
||||||
''' <remarks></remarks>
|
''' <remarks></remarks>
|
||||||
Public Function RemFile(ByVal WMPath As String)
|
Public Function RemFile(ByVal WMPath As String)
|
||||||
Try
|
Try
|
||||||
|
Const COL_Document_VersionID = "dwVersionID"
|
||||||
|
Const WMObjectPartVersion = 128
|
||||||
|
Dim oUnexpected_Error As Boolean = False
|
||||||
WMPath = NormalizePath(WMPath)
|
WMPath = NormalizePath(WMPath)
|
||||||
Dim oWMObject = GetWMObjectForFile(WMPath)
|
Dim oWMObject = GetWMObjectForFile(WMPath)
|
||||||
If IsNothing(oWMObject) = False Then
|
If IsNothing(oWMObject) = False Then
|
||||||
oWMObject.Delete()
|
Try
|
||||||
Return True
|
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
|
Else
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
Return False
|
Return False
|
||||||
|
|||||||
@ -197,7 +197,7 @@ Public Class Windream2
|
|||||||
If TestSessionLoggedIn() = False Then
|
If TestSessionLoggedIn() = False Then
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End If
|
End If
|
||||||
|
Path = GetNormalizedPath(Path)
|
||||||
Dim oWMObject As WMObject
|
Dim oWMObject As WMObject
|
||||||
|
|
||||||
Try
|
Try
|
||||||
@ -951,13 +951,14 @@ Public Class Windream2
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim oWMObject As WMObject = Session.GetWMObjectByName(WMEntityAttribute, Path)
|
Dim oWMObject As WMObject = GetFileByPath(Path)
|
||||||
|
|
||||||
If oWMObject Is Nothing Then
|
If oWMObject Is Nothing Then
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
oWMObject.Delete()
|
oWMObject.Delete()
|
||||||
|
_logger.Warn($"file {Path} has been deleted!")
|
||||||
Return True
|
Return True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user