EDMI: WIP for Client
This commit is contained in:
parent
8e8374fc88
commit
c9dafd4bde
@ -144,11 +144,11 @@ Public Class ClassIDBData
|
||||
oOldAttributeResult = GetVariableValue(pAttributeName, oIDBTyp)
|
||||
oTypeOldResult = oOldAttributeResult.GetType.ToString
|
||||
If oTypeOldResult = "System.Data.DataTable" Then
|
||||
Dim myOldValues As DataTable = oOldAttributeResult
|
||||
If myOldValues.Rows.Count > 1 Then
|
||||
Dim oOldValues As DataTable = oOldAttributeResult
|
||||
If oOldValues.Rows.Count > 1 Then
|
||||
|
||||
'now Checking whether the old row still remains in Vector? If not it will be deleted as it cannot be replaced in multivalues
|
||||
For Each oOldValueRow As DataRow In myOldValues.Rows
|
||||
For Each oOldValueRow As DataRow In oOldValues.Rows
|
||||
Dim oExists As Boolean = False
|
||||
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
|
||||
Dim oInfo1 = $"Checking oldValue[{oOldValueRow.Item(0)}] vs NewValue [{oNewValueRow.Item(1)}]"
|
||||
|
||||
@ -45,12 +45,12 @@ Public Class ClassInit
|
||||
|
||||
' === Init Schritte definieren
|
||||
_Loader.AddStep("Initializing Database (1/2)", AddressOf InitializeDatabase, True)
|
||||
_Loader.AddStep("Initializing Service", AddressOf InitializeService, True)
|
||||
_Loader.AddStep("Initializing EDMI Service", AddressOf InitializeService, True)
|
||||
_Loader.AddStep("Initializing Database (2/2)", AddressOf InitializeDatabaseWithFallback, True)
|
||||
_Loader.AddStep("Initializing User..", AddressOf InitializeUser, True)
|
||||
_Loader.AddStep("Initializing Language..", AddressOf InitializeLanguage, False)
|
||||
_Loader.AddStep("Loading 3rd-party licenses..", AddressOf Initialize3rdParty, False)
|
||||
_Loader.AddStep("Loading Basic Configs..", AddressOf InitBasicData, False)
|
||||
_Loader.AddStep("Initializing User", AddressOf InitializeUser, True)
|
||||
_Loader.AddStep("Initializing Language", AddressOf InitializeLanguage, False)
|
||||
_Loader.AddStep("Initializing 3rd-party licenses", AddressOf Initialize3rdParty, False)
|
||||
_Loader.AddStep("Initializing Basic Config", AddressOf InitBasicData, False)
|
||||
' === Init Schritte definieren
|
||||
|
||||
AddHandler _Loader.ProgressChanged, AddressOf ProgressChanged
|
||||
@ -156,8 +156,7 @@ Public Class ClassInit
|
||||
Private Sub Initialize3rdParty(MyApplication As My.MyApplication)
|
||||
Try
|
||||
Dim oSql = "Select LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
|
||||
Dim oDatatable As DataTable = _DataASorDB.GetDatatable("DD_ECM", oSql, "TBDD_3RD_PARTY_MODULES", "", "")
|
||||
|
||||
Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSql)
|
||||
|
||||
If oDatatable.Rows.Count = 0 Then
|
||||
Throw New InitException("Konfiguration konnte nicht geladen werden!")
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace ClipboardWatcher
|
||||
Public Class ClassProfileLoader
|
||||
Private ReadOnly LogConfig As LogConfig
|
||||
Private ReadOnly Logger As Logger
|
||||
Private Database As ClassDataASorDB
|
||||
Private ReadOnly Database As DatabaseWithFallback
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, AppServerOrDB As ClassDataASorDB)
|
||||
Public Sub New(LogConfig As LogConfig, Database As DatabaseWithFallback)
|
||||
Me.LogConfig = LogConfig
|
||||
Me.Logger = LogConfig.GetLogger()
|
||||
Me.Database = AppServerOrDB
|
||||
Me.Database = Database
|
||||
End Sub
|
||||
|
||||
Public Function LoadProfiles() As Boolean
|
||||
@ -22,10 +23,10 @@ Namespace ClipboardWatcher
|
||||
Dim oWindowSQL As String = $"SELECT DISTINCT T.* FROM VWCW_PROFILE_REL_WINDOW T, VWCW_USER_PROFILE T1 WHERE T.PROFILE_ID = T1.GUID AND ({oWhereClause})"
|
||||
Dim oControlSQL As String = $"SELECT DISTINCT T.* FROM VWCW_PROFILE_REL_CONTROL T, VWCW_USER_PROFILE T1 WHERE T.PROFILE_ID = T1.GUID AND ({oWhereClause})"
|
||||
|
||||
Dim oUserProfiles = Database.GetDatatable("DD_ECM", oProfileSQL, "VWCW_USER_PROFILE", "", "", "DB")
|
||||
Dim oProfileProcesses = Database.GetDatatable("DD_ECM", oProcessSQL, "TBCW_PROFILE_PROCESS", "", "", "DB")
|
||||
Dim oProfileWindows = Database.GetDatatable("DD_ECM", oWindowSQL, "VWCW_PROFILE_REL_WINDOW", "", "", "DB")
|
||||
Dim oProfileControls = Database.GetDatatable("DD_ECM", oControlSQL, "VWCW_PROFILE_REL_CONTROL", "", "", "DB")
|
||||
Dim oUserProfiles = Database.GetDatatable("VWCW_USER_PROFILE", oProfileSQL, Constants.DatabaseType.ECM)
|
||||
Dim oProfileProcesses = Database.GetDatatable("VWCW_PROFILE_REL_WINDOW", oProcessSQL, Constants.DatabaseType.ECM)
|
||||
Dim oProfileWindows = Database.GetDatatable("VWCW_PROFILE_REL_WINDOW", oWindowSQL, Constants.DatabaseType.ECM)
|
||||
Dim oProfileControls = Database.GetDatatable("VWCW_PROFILE_REL_CONTROL", oControlSQL, Constants.DatabaseType.ECM)
|
||||
|
||||
My.Application.ClipboardWatcher.UserProfiles = oUserProfiles
|
||||
My.Application.ClipboardWatcher.ProfileProcesses = oProfileProcesses
|
||||
|
||||
@ -247,7 +247,7 @@ Public Class frmFlowForm
|
||||
|
||||
AddHandler HotkeyClass.HotKeyPressed, AddressOf HotkeyClass_HotKeyPressed
|
||||
|
||||
ProfileLoader = New ClassProfileLoader(My.LogConfig, AppServerOrDB)
|
||||
ProfileLoader = New ClassProfileLoader(My.LogConfig, My.Database)
|
||||
ProfileLoader.LoadProfiles()
|
||||
Catch ex As Exception
|
||||
ShowErrorMessage(ex)
|
||||
|
||||
@ -101,7 +101,7 @@ Public Class frmtest
|
||||
DateTimePicker1.Value,
|
||||
cmbObjectStoreType.Text,
|
||||
"DEFAULT",
|
||||
New Client.ImportFileOptions With {
|
||||
New Client.NewFileOptions With {
|
||||
.KeepExtension = True
|
||||
}
|
||||
)
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports System.IO
|
||||
Imports System.ServiceModel
|
||||
Imports DigitalData.Modules.EDMI.API.Constants
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMI.API.Rights
|
||||
Imports System.ServiceModel
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Language.Utils
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Client
|
||||
Private Const INVALID_OBEJCT_ID As Long = 0
|
||||
@ -105,12 +107,7 @@ Public Class Client
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Import options for NewFileAsync. Contains default values for all options
|
||||
''' </summary>
|
||||
Public Class ImportFileOptions
|
||||
Public KeepExtension As Boolean = True
|
||||
End Class
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' TODO: Creates a new object
|
||||
@ -120,6 +117,15 @@ Public Class Client
|
||||
Throw New NotImplementedException()
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Import options for NewFileAsync. Contains default values for all options
|
||||
''' </summary>
|
||||
Public Class NewFileOptions
|
||||
Public KeepExtension As Boolean = True
|
||||
Public Username As String = String.Empty
|
||||
Public Language As String = String.Empty
|
||||
End Class
|
||||
|
||||
''' <summary>
|
||||
''' Imports a file from a filepath, creating a IDB ObjectId and Filesystem Object
|
||||
''' </summary>
|
||||
@ -132,8 +138,12 @@ Public Class Client
|
||||
''' <exception cref="FileNotFoundException">When local filepath was not found</exception>
|
||||
''' <exception cref="ApplicationException">When there was a error in the Service</exception>
|
||||
''' <returns>The ObjectId of the newly generated filesystem object</returns>
|
||||
Public Async Function NewFileAsync(pFilePath As String, pAddedWho As String, pAddedWhen As Date, pObjectStoreType As String, pBusinessEntity As String, pImportOptions As ImportFileOptions) As Task(Of Long)
|
||||
Public Async Function NewFileAsync(pFilePath As String, pAddedWho As String, pAddedWhen As Date, pObjectStoreType As String, pBusinessEntity As String, Optional pImportOptions As NewFileOptions = Nothing) As Task(Of Long)
|
||||
Try
|
||||
If pImportOptions Is Nothing Then
|
||||
pImportOptions = New NewFileOptions()
|
||||
End If
|
||||
|
||||
If File.Exists(pFilePath) = False Then
|
||||
Throw New FileNotFoundException("ImportFileAsync: Path does not exist")
|
||||
End If
|
||||
@ -189,90 +199,288 @@ Public Class Client
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function CreateObjectId(pKindType As String, pWho As String, pBusinessEntity As String) As Long
|
||||
Try
|
||||
Dim oResponse = _channel.NewObjectId(New NewObjectIdRequest With {
|
||||
.KindType = pKindType,
|
||||
.BusinessEntity = pBusinessEntity,
|
||||
.Who = pWho
|
||||
})
|
||||
Return oResponse.ObjectId
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Public Class SetVariableValueOptions
|
||||
Public CheckDeleted As Boolean = False
|
||||
Public Username As String = String.Empty
|
||||
Public Language As String = String.Empty
|
||||
End Class
|
||||
|
||||
Public Function CreateFileStoreObject(pObjectId As Long, pStoreType As String, pDate As String, pExtension As String, pKeepExtension As String) As String
|
||||
''' <summary>
|
||||
''' Sets a value to an attribute
|
||||
''' </summary>
|
||||
''' <param name="pAttributeName"></param>
|
||||
''' <param name="pAttributeType"></param>
|
||||
''' <param name="pValue"></param>
|
||||
''' <param name="pOptions"></param>
|
||||
''' <returns></returns>
|
||||
Public Function SetVariableValue(pObjectId As Long, pAttributeName As String, pAttributeType As AttributeType, pValue As Object, Optional pOptions As SetVariableValueOptions = Nothing) As Boolean
|
||||
Try
|
||||
' Remove dot in Extension
|
||||
If pExtension.StartsWith(".") Then
|
||||
pExtension = pExtension.Substring(1)
|
||||
If pOptions Is Nothing Then
|
||||
pOptions = New SetVariableValueOptions()
|
||||
End If
|
||||
|
||||
Dim oArgs As New NewFileObjectRequest With {
|
||||
.ObjectId = pObjectId,
|
||||
.StoreType = pStoreType,
|
||||
.DateImported = pDate,
|
||||
.Extension = pExtension,
|
||||
.KeepExtension = pKeepExtension
|
||||
}
|
||||
Dim oResponse = _channel.NewFileObject(oArgs)
|
||||
Return oResponse.FileObjectPath
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Dim oLanguage = NotNull(pOptions.Language, GetUserLanguage())
|
||||
Dim oUsername = NotNull(pOptions.Username, Environment.UserName)
|
||||
|
||||
Public Async Function ImportFileObjectAsync(pContent As Byte(), pWho As String, pObjectId As Long, pObjectStoreType As String, pFileObjectPath As String) As Task(Of Boolean)
|
||||
Try
|
||||
Dim oData As New ImportFileIntoFileObjectRequest() With {
|
||||
.Contents = pContent,
|
||||
.Who = pWho,
|
||||
.FilePath = pFileObjectPath,
|
||||
.ObjectId = pObjectId,
|
||||
.ObjectStoreType = pObjectStoreType
|
||||
}
|
||||
Dim oType = pValue.GetType.Name
|
||||
|
||||
If oType = GetType(DataTable).Name Then
|
||||
Dim oDTMyNewValues As DataTable = pValue
|
||||
Dim oOldAttributeResult As Object
|
||||
Dim oTypeOldResult As Object
|
||||
|
||||
If pOptions.CheckDeleted = True Then
|
||||
oOldAttributeResult = GetVariableValue(pAttributeName, pAttributeType)
|
||||
oTypeOldResult = oOldAttributeResult.GetType.Name
|
||||
If oTypeOldResult = GetType(DataTable).Name Then
|
||||
Dim oOldValues As DataTable = oOldAttributeResult
|
||||
If oOldValues.Rows.Count > 1 Then
|
||||
|
||||
'now Checking whether the old row still remains in Vector? If not it will be deleted as it cannot be replaced in multivalues
|
||||
For Each oOldValueRow As DataRow In oOldValues.Rows
|
||||
Dim oExists As Boolean = False
|
||||
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
|
||||
Dim oInfo = $"Checking oldValue[{oOldValueRow.Item(0)}] vs NewValue [{oNewValueRow.Item(1)}]"
|
||||
If oNewValueRow.Item(1).ToString.ToUpper = oOldValueRow.Item(0).ToString.ToUpper Then
|
||||
oExists = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
If oExists = False Then
|
||||
Dim oInfo = $"Value [{oOldValueRow.Item(0)}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!"
|
||||
_logger.Debug(oInfo)
|
||||
SetVariableValue(pObjectId, My.Application.Globix.CURRENT_PROFILE_LOG_INDEX, AttributeType.Varchar, oInfo)
|
||||
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oOldValueRow.Item(0))
|
||||
End If
|
||||
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
If oDTMyNewValues.Rows.Count > 1 Then
|
||||
Dim oExists As Boolean = False
|
||||
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
|
||||
Dim oInfo1 = $"Checking oldValue[{oOldAttributeResult}] vs NewValue [{oNewValueRow.Item(1)}]"
|
||||
If oNewValueRow.Item(1).ToString.ToUpper = oOldAttributeResult.ToString.ToUpper Then
|
||||
oExists = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If oExists = False Then
|
||||
Dim oInfo = $"Value [{oOldAttributeResult}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!"
|
||||
_logger.Debug(oInfo)
|
||||
SetVariableValue(pObjectId, My.Application.Globix.CURRENT_PROFILE_LOG_INDEX, AttributeType.Varchar, oInfo)
|
||||
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oOldAttributeResult)
|
||||
End If
|
||||
Else
|
||||
Dim oInfo = $"Value [{oOldAttributeResult}] of Attribute [{pAttributeName}] obviously was updated during runtime - will be deleted!"
|
||||
_logger.Debug(oInfo)
|
||||
SetVariableValue(pObjectId, My.Application.Globix.CURRENT_PROFILE_LOG_INDEX, AttributeType.Varchar, oInfo)
|
||||
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oOldAttributeResult)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
|
||||
Dim oSuccess As Boolean = False
|
||||
Dim oSQL = $"DECLARE @NEW_OBJ_MD_ID BIGINT
|
||||
EXEC PRIDB_NEW_OBJ_DATA({pObjectId}, '{pAttributeName}', '{oUsername}', '{oNewValueRow.Item(1)}', '{oLanguage}', 0, @OMD_ID = @NEW_OBJ_MD_ID OUTPUT)"
|
||||
|
||||
Dim oResult = _channel.ExecuteNonQuery_MSSQL_IDB(oSQL)
|
||||
|
||||
If Not oResult.OK Then
|
||||
Return False
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
Else
|
||||
Dim oSql = $"DECLARE @NEW_OBJ_MD_ID BIGINT
|
||||
EXEC PRIDB_NEW_OBJ_DATA({pObjectId}, '{pAttributeName}', '{oUsername}', '{pValue}', '{oLanguage}', 0, @OMD_ID = @NEW_OBJ_MD_ID OUTPUT)"
|
||||
|
||||
Dim oResult = _channel.ExecuteNonQuery_MSSQL_IDB(oSql)
|
||||
|
||||
Return oResult.OK
|
||||
End If
|
||||
|
||||
Dim oResponse = Await _channel.ImportFileIntoFileObjectAsync(oData)
|
||||
Return oResponse.Result
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function GetFileByObjectIdAsync(ObjectId As Long) As Task(Of StreamedFile)
|
||||
Try
|
||||
Dim oData As New DocumentStreamRequest() With {.ObjectId = ObjectId}
|
||||
Dim oResponse As DocumentStreamResponse = Await _channel.GetFileByObjectIdAsync(oData)
|
||||
Dim oMemoryStream As New MemoryStream()
|
||||
oResponse.FileContents.CopyTo(oMemoryStream)
|
||||
oMemoryStream.Position = 0
|
||||
Public Class GetVariableValueOptions
|
||||
Public FromIDB As Boolean = False
|
||||
Public Username As String = String.Empty
|
||||
Public Language As String = String.Empty
|
||||
End Class
|
||||
|
||||
Return New StreamedFile() With {
|
||||
.Stream = oMemoryStream,
|
||||
.FileName = oResponse.FileName
|
||||
}
|
||||
Public Function GetVariableValue(pObjectId As Long, pAttributeName As String, pAttributeType As AttributeType, Optional pOptions As GetVariableValueOptions = Nothing) As Object
|
||||
If pOptions Is Nothing Then
|
||||
pOptions = New GetVariableValueOptions()
|
||||
End If
|
||||
|
||||
Dim oLanguage = NotNull(pOptions.Language, GetUserLanguage())
|
||||
Dim oUsername = NotNull(pOptions.Username, Environment.UserName)
|
||||
|
||||
Try
|
||||
Dim oSingleAttribute As Boolean
|
||||
Select Case pAttributeType
|
||||
Case AttributeType.VectorInteger
|
||||
oSingleAttribute = False
|
||||
Case AttributeType.VectorString
|
||||
oSingleAttribute = False
|
||||
Case Else
|
||||
oSingleAttribute = True
|
||||
End Select
|
||||
|
||||
Dim oAttributeValue As Object = Nothing
|
||||
|
||||
If Not IsNothing(My.Tables.DTIDB_DOC_DATA) Then
|
||||
If oSingleAttribute = True And My.Tables.DTIDB_DOC_DATA.Rows.Count = 1 And pOptions.FromIDB = False Then
|
||||
Try
|
||||
If pAttributeName = "IDBCreatedWhen" Then
|
||||
pAttributeName = "ADDED_WHEN"
|
||||
ElseIf pAttributeName = "IDBCreatedWho" Then
|
||||
pAttributeName = "ADDED_WHO"
|
||||
ElseIf pAttributeName = "IDBChangedWhen" Then
|
||||
pAttributeName = "CHANGED_WHEN"
|
||||
ElseIf pAttributeName = "IDBChangedWho" Then
|
||||
pAttributeName = "CHANGED_WHO"
|
||||
End If
|
||||
|
||||
oAttributeValue = My.Tables.DTIDB_DOC_DATA.Rows(0).Item(pAttributeName)
|
||||
Catch ex As Exception
|
||||
_logger.Debug($"Error getting Attribute from IDB_DT_DOC_DATA: {ex.Message}")
|
||||
End Try
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not IsNothing(oAttributeValue) Then
|
||||
Return oAttributeValue
|
||||
Else
|
||||
_logger.Debug($"oAttributeValue for Attribute [{pAttributeName}] is so far nothing..Now trying FNIDB_PM_GET_VARIABLE_VALUE ")
|
||||
End If
|
||||
Dim oFNSQL = $"SELECT * FROM [dbo].[FNIDB_PM_GET_VARIABLE_VALUE] ({pObjectId},'{pAttributeName}','{oLanguage}',CONVERT(BIT,'0'))"
|
||||
Dim oDatatable As TableResult = _channel.ReturnDatatable_MSSQL_IDB(oFNSQL)
|
||||
|
||||
If oDatatable.OK = False Then
|
||||
_logger.Warn(oDatatable.ErrorMessage)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
If oDatatable.Table.Rows.Count = 1 Then
|
||||
oAttributeValue = oDatatable.Table.Rows.Item(0).Item(0)
|
||||
End If
|
||||
Return oAttributeValue
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function ListFilesForUserAsync() As Task(Of FileList)
|
||||
Private Function DeleteTermObjectFromMetadata(pObjectId As Long, pAttributeName As String, pTerm2Delete As String, Optional pUsername As String = "", Optional pLanguage As String = "") As Boolean
|
||||
Try
|
||||
Dim oResponse As DocumentListResponse = Await _channel.ListFilesForUserAsync(New ListFilesForUserRequest())
|
||||
Return New FileList() With {
|
||||
.Datatable = oResponse.Datatable
|
||||
}
|
||||
Dim oLanguage = NotNull(pLanguage, GetUserLanguage())
|
||||
Dim oUsername = NotNull(pUsername, Environment.UserName)
|
||||
|
||||
Dim oIdIsForeign As Integer = 1
|
||||
Dim oDELSQL = $"EXEC PRIDB_DELETE_TERM_OBJECT_METADATA {pObjectId},'{pAttributeName}','{pTerm2Delete}','{oUsername}','{oLanguage}',{oIdIsForeign}"
|
||||
Dim oResult = _channel.ExecuteNonQuery_MSSQL_IDB(oDELSQL)
|
||||
|
||||
Return oResult.OK
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'Public Function CreateObjectId(pKindType As String, pWho As String, pBusinessEntity As String) As Long
|
||||
' Try
|
||||
' Dim oResponse = _channel.NewObjectId(New NewObjectIdRequest With {
|
||||
' .KindType = pKindType,
|
||||
' .BusinessEntity = pBusinessEntity,
|
||||
' .Who = pWho
|
||||
' })
|
||||
' Return oResponse.ObjectId
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
'Public Function CreateFileStoreObject(pObjectId As Long, pStoreType As String, pDate As String, pExtension As String, pKeepExtension As String) As String
|
||||
' Try
|
||||
' ' Remove dot in Extension
|
||||
' If pExtension.StartsWith(".") Then
|
||||
' pExtension = pExtension.Substring(1)
|
||||
' End If
|
||||
|
||||
' Dim oArgs As New NewFileObjectRequest With {
|
||||
' .ObjectId = pObjectId,
|
||||
' .StoreType = pStoreType,
|
||||
' .DateImported = pDate,
|
||||
' .Extension = pExtension,
|
||||
' .KeepExtension = pKeepExtension
|
||||
' }
|
||||
' Dim oResponse = _channel.NewFileObject(oArgs)
|
||||
' Return oResponse.FileObjectPath
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
'Public Async Function ImportFileObjectAsync(pContent As Byte(), pWho As String, pObjectId As Long, pObjectStoreType As String, pFileObjectPath As String) As Task(Of Boolean)
|
||||
' Try
|
||||
' Dim oData As New ImportFileIntoFileObjectRequest() With {
|
||||
' .Contents = pContent,
|
||||
' .Who = pWho,
|
||||
' .FilePath = pFileObjectPath,
|
||||
' .ObjectId = pObjectId,
|
||||
' .ObjectStoreType = pObjectStoreType
|
||||
' }
|
||||
|
||||
' Dim oResponse = Await _channel.ImportFileIntoFileObjectAsync(oData)
|
||||
' Return oResponse.Result
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
'Public Async Function GetFileByObjectIdAsync(ObjectId As Long) As Task(Of StreamedFile)
|
||||
' Try
|
||||
' Dim oData As New DocumentStreamRequest() With {.ObjectId = ObjectId}
|
||||
' Dim oResponse As DocumentStreamResponse = Await _channel.GetFileByObjectIdAsync(oData)
|
||||
' Dim oMemoryStream As New MemoryStream()
|
||||
' oResponse.FileContents.CopyTo(oMemoryStream)
|
||||
' oMemoryStream.Position = 0
|
||||
|
||||
' Return New StreamedFile() With {
|
||||
' .Stream = oMemoryStream,
|
||||
' .FileName = oResponse.FileName
|
||||
' }
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
'Public Async Function ListFilesForUserAsync() As Task(Of FileList)
|
||||
' Try
|
||||
' Dim oResponse As DocumentListResponse = Await _channel.ListFilesForUserAsync(New ListFilesForUserRequest())
|
||||
' Return New FileList() With {
|
||||
' .Datatable = oResponse.Datatable
|
||||
' }
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Public Function GetDatatableFromIDB(SQL As String) As TableResult
|
||||
Try
|
||||
Dim oResponse = _channel.ReturnDatatable_MSSQL_IDB(SQL)
|
||||
@ -324,23 +532,20 @@ Public Class Client
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function GetDatatableByNameAsync(DatatableName As String, Optional FilterExpression As String = "", Optional SortByColumn As String = "") As Task(Of TableResult)
|
||||
Try
|
||||
Dim oResponse = Await _channel.ReturnDatatableFromCacheAsync(DatatableName, FilterExpression, SortByColumn)
|
||||
Return oResponse
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Return infos about a file object
|
||||
''' </summary>
|
||||
''' <param name="UserId"></param>
|
||||
''' <param name="ObjectId"></param>
|
||||
''' <returns></returns>
|
||||
Public Function GetDocumentInfo(UserId As Long, ObjectId As Long) As DocumentInfo
|
||||
Try
|
||||
Dim oParams = New DocumentInfoRequest With {
|
||||
Dim oResponse As DocumentInfoResponse = _channel.GetFileInfoByObjectId(New DocumentInfoRequest With {
|
||||
.ObjectId = ObjectId,
|
||||
.UserId = UserId
|
||||
}
|
||||
Dim oResponse As DocumentInfoResponse = _channel.GetFileInfoByObjectId(oParams)
|
||||
})
|
||||
|
||||
Return New DocumentInfo With {
|
||||
.AccessRight = oResponse.FileRight,
|
||||
@ -413,5 +618,8 @@ Public Class Client
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetUserLanguage() As String
|
||||
Return Threading.Thread.CurrentThread.CurrentUICulture.Name
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@ -3,4 +3,16 @@
|
||||
ECM
|
||||
IDB
|
||||
End Enum
|
||||
|
||||
Public Enum AttributeType
|
||||
Varchar = 1
|
||||
BigInteger = 2
|
||||
Float = 3
|
||||
[Decimal] = 4
|
||||
[Date] = 5
|
||||
[DateTime] = 6
|
||||
Bit = 7
|
||||
VectorString = 8
|
||||
VectorInteger = 9
|
||||
End Enum
|
||||
End Class
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user