Common/DocumentResultList: Catch errors better
This commit is contained in:
parent
38608e353a
commit
b1af861810
@ -20,6 +20,7 @@
|
|||||||
<OutputPath>bin\Debug\</OutputPath>
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
<DocumentationFile>DigitalData.GUIs.Common.xml</DocumentationFile>
|
<DocumentationFile>DigitalData.GUIs.Common.xml</DocumentationFile>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
|
|||||||
@ -4,6 +4,7 @@ Imports DigitalData.Modules.EDMI.API.Client
|
|||||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports DigitalData.Modules.ZooFlow.Constants
|
Imports DigitalData.Modules.ZooFlow.Constants
|
||||||
|
Imports DigitalData.Modules.ZooFlow.State
|
||||||
|
|
||||||
Public Class DocumentLoader
|
Public Class DocumentLoader
|
||||||
Inherits Modules.ZooFlow.Base.BaseClass
|
Inherits Modules.ZooFlow.Base.BaseClass
|
||||||
@ -27,7 +28,6 @@ Public Class DocumentLoader
|
|||||||
Case OperationMode.WithAppServer
|
Case OperationMode.WithAppServer
|
||||||
Return Load_FromIDB(pObjectId)
|
Return Load_FromIDB(pObjectId)
|
||||||
|
|
||||||
|
|
||||||
Case OperationMode.ZooFlow
|
Case OperationMode.ZooFlow
|
||||||
Return Load_FromZooflow(pObjectId)
|
Return Load_FromZooflow(pObjectId)
|
||||||
|
|
||||||
@ -49,20 +49,30 @@ Public Class DocumentLoader
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function Load_FromIDB(pObjectId As Long) As DocumentResultInfo
|
Private Function Load_FromIDB(pObjectId As Long) As DocumentResultInfo
|
||||||
Dim oDocumentInfo As DocumentInfo = Client.GetDocumentInfo(User.UserId, pObjectId)
|
Try
|
||||||
Dim oFileInfo As New FileInfo(oDocumentInfo.FullPath)
|
Dim oDocumentInfo As DocumentInfo = Client.GetDocumentInfo(User.UserId, pObjectId)
|
||||||
Dim oResultDocumentInfo As New DocumentResultInfo(pObjectId) With {
|
Dim oFileInfo As New FileInfo(oDocumentInfo.FullPath)
|
||||||
.Contents = Load_FromDisk(oDocumentInfo.FullPath),
|
Dim oResultDocumentInfo As New DocumentResultInfo(pObjectId) With {
|
||||||
.AccessRight = oDocumentInfo.AccessRight,
|
.Contents = Load_FromDisk(oDocumentInfo.FullPath),
|
||||||
.FullPath = oDocumentInfo.FullPath,
|
.AccessRight = oDocumentInfo.AccessRight,
|
||||||
.Extension = oFileInfo.Extension.Substring(1)
|
.FullPath = oDocumentInfo.FullPath,
|
||||||
}
|
.Extension = oFileInfo.Extension.Substring(1)
|
||||||
|
}
|
||||||
|
|
||||||
Return oResultDocumentInfo
|
Return oResultDocumentInfo
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
Return Nothing
|
||||||
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function Load_FromZooflow(pObjectId As Long) As DocumentResultInfo
|
Private Function Load_FromZooflow(pObjectId As Long) As DocumentResultInfo
|
||||||
Dim oFileObject As FileObject = Client.GetFileObject(pObjectId, pLoadFileContents:=True)
|
Dim oFileObject As FileObject = Client.GetFileObject(pObjectId, pLoadFileContents:=True)
|
||||||
|
|
||||||
|
If oFileObject Is Nothing Then
|
||||||
|
Return Nothing
|
||||||
|
End If
|
||||||
|
|
||||||
Dim oResultDocumentInfo As New DocumentResultInfo(pObjectId) With {
|
Dim oResultDocumentInfo As New DocumentResultInfo(pObjectId) With {
|
||||||
.Contents = oFileObject._FileContents,
|
.Contents = oFileObject._FileContents,
|
||||||
.Extension = oFileObject._FileExtension,
|
.Extension = oFileObject._FileExtension,
|
||||||
|
|||||||
@ -210,12 +210,6 @@ Public Class frmDocumentResultList
|
|||||||
DocumentViewer1.CloseDocument()
|
DocumentViewer1.CloseDocument()
|
||||||
|
|
||||||
oDocumentInfo = _documentloader.Load(oObjectId, oFullPath)
|
oDocumentInfo = _documentloader.Load(oObjectId, oFullPath)
|
||||||
Dim oFileName = $"{oObjectId}.{oDocumentInfo.Extension}"
|
|
||||||
|
|
||||||
DocumentViewer1.LoadFile(oFileName, New MemoryStream(oDocumentInfo.Contents))
|
|
||||||
|
|
||||||
' Save reference to current
|
|
||||||
_CurrentDocument = oDocumentInfo
|
|
||||||
|
|
||||||
' Check DocumentInfo
|
' Check DocumentInfo
|
||||||
If IsNothing(oDocumentInfo) Then
|
If IsNothing(oDocumentInfo) Then
|
||||||
@ -223,6 +217,13 @@ Public Class frmDocumentResultList
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Dim oFileName = $"{oObjectId}.{oDocumentInfo.Extension}"
|
||||||
|
|
||||||
|
DocumentViewer1.LoadFile(oFileName, New MemoryStream(oDocumentInfo.Contents))
|
||||||
|
|
||||||
|
' Save reference to current
|
||||||
|
_CurrentDocument = oDocumentInfo
|
||||||
|
|
||||||
If oDocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then
|
If oDocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then
|
||||||
DocumentViewer1.SetViewOnly(True)
|
DocumentViewer1.SetViewOnly(True)
|
||||||
RibbonPageGroup_Export.Visible = False
|
RibbonPageGroup_Export.Visible = False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user