EDMI: final changes to Client
This commit is contained in:
parent
54c96b0b1f
commit
5658c233ee
@ -95,17 +95,13 @@ Public Class frmtest
|
||||
End Sub
|
||||
|
||||
Private Async Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
|
||||
Dim oResult As Object
|
||||
|
||||
If OpenFileDialog1.ShowDialog() <> DialogResult.OK Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
txtFile2Import.Text = OpenFileDialog1.FileName
|
||||
|
||||
|
||||
|
||||
oResult = Await My.Application.Service.Client.NewFileAsync(
|
||||
Dim oResult As FileMeta = Await My.Application.Service.Client.NewFileAsync(
|
||||
txtFile2Import.Text,
|
||||
Environment.UserName,
|
||||
Date.Now,
|
||||
@ -116,7 +112,7 @@ Public Class frmtest
|
||||
}
|
||||
)
|
||||
|
||||
MsgBox($"File saved to: [{oResult}]")
|
||||
MsgBox($"File saved to: [{oResult.FilePath}]")
|
||||
'oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
|
||||
|
||||
End Sub
|
||||
|
||||
@ -104,7 +104,7 @@ Public Class Client
|
||||
''' <returns>The ObjectId of the newly generated filesystem object</returns>
|
||||
''' <exception cref="FileNotFoundException">When local filepath was not found</exception>
|
||||
''' <exception cref="ApplicationException">When there was a error in the Service</exception>
|
||||
Public Async Function NewFileAsync(pFilePath As String, pWho As String, pWhen As Date, pObjectStoreType As String, pBusinessEntity As String, ImportOptions As ImportFileOptions) As Task(Of Long)
|
||||
Public Async Function NewFileAsync(pFilePath As String, pWho As String, pWhen As Date, pObjectStoreType As String, pBusinessEntity As String, ImportOptions As ImportFileOptions) As Task(Of FileMeta)
|
||||
Const oKindType = "DOC"
|
||||
|
||||
Try
|
||||
@ -156,7 +156,10 @@ Public Class Client
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Return oObjectIdResponse.ObjectId
|
||||
Return New FileMeta With {
|
||||
.ObjectId = oObjectIdResponse.ObjectId,
|
||||
.FilePath = oFilePathResponse.FileObjectPath
|
||||
}
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
4
Modules.EDMIAPI/Client/FileMeta.vb
Normal file
4
Modules.EDMIAPI/Client/FileMeta.vb
Normal file
@ -0,0 +1,4 @@
|
||||
Public Class FileMeta
|
||||
Public FilePath As String
|
||||
Public ObjectId As String
|
||||
End Class
|
||||
@ -81,6 +81,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Client.vb" />
|
||||
<Compile Include="DataWithFallback.vb" />
|
||||
<Compile Include="Client\FileMeta.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
||||
@ -581,10 +581,7 @@ Public Class EDMIService
|
||||
|
||||
Public Function ImportFileIntoFileObject(Data As ImportFileIntoFileObjectRequest) As ImportFileIntoFileObjectResponse Implements IEDMIService.ImportFileIntoFileObject
|
||||
Try
|
||||
Dim oObjectStore = GlobalState.ObjectStores.
|
||||
Where(Function(o) o.Title = Data.ObjectStoreType).
|
||||
FirstOrDefault()
|
||||
|
||||
Dim oObjectStore = GlobalState.GetObjectStore(Data.ObjectStoreType)
|
||||
If oObjectStore Is Nothing Then
|
||||
Throw New KeyNotFoundException($"ObjectStore [{Data.ObjectStoreType}] was not found.")
|
||||
End If
|
||||
|
||||
@ -43,6 +43,12 @@ Public Class GlobalState
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Function GetObjectStore(Name As String) As ObjectStore
|
||||
Return ObjectStores.
|
||||
Where(Function(o) o.Title.ToUpper = Name.ToUpper).
|
||||
FirstOrDefault()
|
||||
End Function
|
||||
|
||||
Class ObjectStore
|
||||
Public Id As Long
|
||||
Public Title As String
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user