Common: Load files on ResultList depending on access rights
This commit is contained in:
parent
ce20e124d1
commit
083a899195
@ -33,9 +33,9 @@ Partial Class frmDocumentResultList
|
|||||||
Me.BarButtonBack = New DevExpress.XtraBars.BarButtonItem()
|
Me.BarButtonBack = New DevExpress.XtraBars.BarButtonItem()
|
||||||
Me.BarButtonItem5 = New DevExpress.XtraBars.BarButtonItem()
|
Me.BarButtonItem5 = New DevExpress.XtraBars.BarButtonItem()
|
||||||
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
|
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
|
||||||
Me.RibbonPageGroupNavigation = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
Me.RibbonPageGroup_Navigation = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||||
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
Me.RibbonPageGroup_Layout = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||||
Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
Me.RibbonPageGroup_Export = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||||
Me.RibbonStatusBar = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
|
Me.RibbonStatusBar = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
|
||||||
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
|
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
|
||||||
Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
|
Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
|
||||||
@ -153,30 +153,32 @@ Partial Class frmDocumentResultList
|
|||||||
'
|
'
|
||||||
'RibbonPage1
|
'RibbonPage1
|
||||||
'
|
'
|
||||||
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroupNavigation, Me.RibbonPageGroup1, Me.RibbonPageGroup2})
|
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup_Navigation, Me.RibbonPageGroup_Layout, Me.RibbonPageGroup_Export})
|
||||||
Me.RibbonPage1.Name = "RibbonPage1"
|
Me.RibbonPage1.Name = "RibbonPage1"
|
||||||
Me.RibbonPage1.Text = "Ergebnisse"
|
Me.RibbonPage1.Text = "Ergebnisse"
|
||||||
'
|
'
|
||||||
'RibbonPageGroupNavigation
|
'RibbonPageGroup_Navigation
|
||||||
'
|
'
|
||||||
Me.RibbonPageGroupNavigation.AllowTextClipping = False
|
Me.RibbonPageGroup_Navigation.AllowTextClipping = False
|
||||||
Me.RibbonPageGroupNavigation.ItemLinks.Add(Me.BarButtonBack)
|
Me.RibbonPageGroup_Navigation.ItemLinks.Add(Me.BarButtonBack)
|
||||||
Me.RibbonPageGroupNavigation.Name = "RibbonPageGroupNavigation"
|
Me.RibbonPageGroup_Navigation.Name = "RibbonPageGroup_Navigation"
|
||||||
Me.RibbonPageGroupNavigation.Text = "Navigation"
|
Me.RibbonPageGroup_Navigation.Text = "Navigation"
|
||||||
'
|
'
|
||||||
'RibbonPageGroup1
|
'RibbonPageGroup_Layout
|
||||||
'
|
'
|
||||||
Me.RibbonPageGroup1.ItemLinks.Add(Me.SwitchMainContainerHorizontal)
|
Me.RibbonPageGroup_Layout.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far
|
||||||
Me.RibbonPageGroup1.ItemLinks.Add(Me.SwitchDetailContainerHorizontal)
|
Me.RibbonPageGroup_Layout.ItemLinks.Add(Me.SwitchMainContainerHorizontal)
|
||||||
Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonItem5)
|
Me.RibbonPageGroup_Layout.ItemLinks.Add(Me.SwitchDetailContainerHorizontal)
|
||||||
Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
|
Me.RibbonPageGroup_Layout.ItemLinks.Add(Me.BarButtonItem5)
|
||||||
Me.RibbonPageGroup1.Text = "Layout"
|
Me.RibbonPageGroup_Layout.Name = "RibbonPageGroup_Layout"
|
||||||
|
Me.RibbonPageGroup_Layout.Text = "Layout"
|
||||||
'
|
'
|
||||||
'RibbonPageGroup2
|
'RibbonPageGroup_Export
|
||||||
'
|
'
|
||||||
Me.RibbonPageGroup2.ItemLinks.Add(Me.BarButtonItemExportGrid1)
|
Me.RibbonPageGroup_Export.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far
|
||||||
Me.RibbonPageGroup2.Name = "RibbonPageGroup2"
|
Me.RibbonPageGroup_Export.ItemLinks.Add(Me.BarButtonItemExportGrid1)
|
||||||
Me.RibbonPageGroup2.Text = "Export"
|
Me.RibbonPageGroup_Export.Name = "RibbonPageGroup_Export"
|
||||||
|
Me.RibbonPageGroup_Export.Text = "Export"
|
||||||
'
|
'
|
||||||
'RibbonStatusBar
|
'RibbonStatusBar
|
||||||
'
|
'
|
||||||
@ -380,7 +382,7 @@ Partial Class frmDocumentResultList
|
|||||||
|
|
||||||
Friend WithEvents RibbonControl As DevExpress.XtraBars.Ribbon.RibbonControl
|
Friend WithEvents RibbonControl As DevExpress.XtraBars.Ribbon.RibbonControl
|
||||||
Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage
|
Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage
|
||||||
Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
Friend WithEvents RibbonPageGroup_Layout As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
||||||
Friend WithEvents RibbonStatusBar As DevExpress.XtraBars.Ribbon.RibbonStatusBar
|
Friend WithEvents RibbonStatusBar As DevExpress.XtraBars.Ribbon.RibbonStatusBar
|
||||||
Friend WithEvents SwitchMainContainerHorizontal As DevExpress.XtraBars.BarToggleSwitchItem
|
Friend WithEvents SwitchMainContainerHorizontal As DevExpress.XtraBars.BarToggleSwitchItem
|
||||||
Friend WithEvents SwitchDetailContainerHorizontal As DevExpress.XtraBars.BarToggleSwitchItem
|
Friend WithEvents SwitchDetailContainerHorizontal As DevExpress.XtraBars.BarToggleSwitchItem
|
||||||
@ -396,7 +398,7 @@ Partial Class frmDocumentResultList
|
|||||||
Friend WithEvents GridView3 As DevExpress.XtraGrid.Views.BandedGrid.BandedGridView
|
Friend WithEvents GridView3 As DevExpress.XtraGrid.Views.BandedGrid.BandedGridView
|
||||||
Friend WithEvents GridBand3 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
|
Friend WithEvents GridBand3 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
|
||||||
Friend WithEvents BarButtonItemExportGrid1 As DevExpress.XtraBars.BarButtonItem
|
Friend WithEvents BarButtonItemExportGrid1 As DevExpress.XtraBars.BarButtonItem
|
||||||
Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
Friend WithEvents RibbonPageGroup_Export As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
||||||
Friend WithEvents SplitContainerControl3 As DevExpress.XtraEditors.SplitContainerControl
|
Friend WithEvents SplitContainerControl3 As DevExpress.XtraEditors.SplitContainerControl
|
||||||
Friend WithEvents DocumentViewer1 As DigitalData.Controls.DocumentViewer.DocumentViewer
|
Friend WithEvents DocumentViewer1 As DigitalData.Controls.DocumentViewer.DocumentViewer
|
||||||
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem
|
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem
|
||||||
@ -406,6 +408,6 @@ Partial Class frmDocumentResultList
|
|||||||
Friend WithEvents labelResultCount As DevExpress.XtraBars.BarStaticItem
|
Friend WithEvents labelResultCount As DevExpress.XtraBars.BarStaticItem
|
||||||
Friend WithEvents XtraSaveFileDialog As DevExpress.XtraEditors.XtraSaveFileDialog
|
Friend WithEvents XtraSaveFileDialog As DevExpress.XtraEditors.XtraSaveFileDialog
|
||||||
Friend WithEvents BarButtonBack As DevExpress.XtraBars.BarButtonItem
|
Friend WithEvents BarButtonBack As DevExpress.XtraBars.BarButtonItem
|
||||||
Friend WithEvents RibbonPageGroupNavigation As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
Friend WithEvents RibbonPageGroup_Navigation As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
||||||
Friend WithEvents BarButtonItem5 As DevExpress.XtraBars.BarButtonItem
|
Friend WithEvents BarButtonItem5 As DevExpress.XtraBars.BarButtonItem
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -11,6 +11,7 @@ Imports DigitalData.Modules.Logging
|
|||||||
Imports DigitalData.Modules.ZooFlow
|
Imports DigitalData.Modules.ZooFlow
|
||||||
Imports DigitalData.Modules.Language
|
Imports DigitalData.Modules.Language
|
||||||
Imports DigitalData.Modules.EDMI.API
|
Imports DigitalData.Modules.EDMI.API
|
||||||
|
Imports DigitalData.Modules.EDMI.API.Client
|
||||||
Imports DevExpress.XtraGrid.Views.Base
|
Imports DevExpress.XtraGrid.Views.Base
|
||||||
Imports DevExpress.XtraGrid.Views.BandedGrid
|
Imports DevExpress.XtraGrid.Views.BandedGrid
|
||||||
Imports System.ComponentModel
|
Imports System.ComponentModel
|
||||||
@ -18,6 +19,15 @@ Imports System.ComponentModel
|
|||||||
Public Class frmDocumentResultList
|
Public Class frmDocumentResultList
|
||||||
Implements IResultForm
|
Implements IResultForm
|
||||||
|
|
||||||
|
Private Const COLUMN_ICON = "ICON"
|
||||||
|
Private Const COLUMN_FILEPATH = "FULL_FILENAME"
|
||||||
|
Private Const COLUMN_FILENAME = "Filename"
|
||||||
|
Private Const COLUMN_DOCID = "DocID"
|
||||||
|
|
||||||
|
Private _IsLoading As Boolean = True
|
||||||
|
Private _IsLegacy As Boolean = True
|
||||||
|
Private _IDBClient As Client
|
||||||
|
|
||||||
Private _LogConfig As LogConfig
|
Private _LogConfig As LogConfig
|
||||||
Private _Logger As Logger
|
Private _Logger As Logger
|
||||||
Private _Config As ConfigManager(Of DocumentResultConfig)
|
Private _Config As ConfigManager(Of DocumentResultConfig)
|
||||||
@ -29,14 +39,7 @@ Public Class frmDocumentResultList
|
|||||||
Private _ActiveGridBand As GridBand = Nothing
|
Private _ActiveGridBand As GridBand = Nothing
|
||||||
Private _ActiveRowHandle As Integer = Constants.NO_ROW_HANDLE
|
Private _ActiveRowHandle As Integer = Constants.NO_ROW_HANDLE
|
||||||
|
|
||||||
Private Const COLUMN_ICON = "ICON"
|
Private _DocumentInfo As DocumentInfo = Nothing
|
||||||
Private Const COLUMN_FILEPATH = "FULL_FILENAME"
|
|
||||||
Private Const COLUMN_FILENAME = "Filename"
|
|
||||||
Private Const COLUMN_DOCID = "DocID"
|
|
||||||
|
|
||||||
Private _IsLoading As Boolean = True
|
|
||||||
Private _IsLegacy As Boolean = True
|
|
||||||
Private _IDBClient As Client
|
|
||||||
|
|
||||||
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
|
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
|
||||||
|
|
||||||
@ -60,7 +63,7 @@ Public Class frmDocumentResultList
|
|||||||
Private Sub MaybeInitIDB()
|
Private Sub MaybeInitIDB()
|
||||||
_IsLegacy = Not _Environment.Service.IsActive
|
_IsLegacy = Not _Environment.Service.IsActive
|
||||||
If _Environment.Service.IsActive Then
|
If _Environment.Service.IsActive Then
|
||||||
Dim oSplit As List(Of String) = _Environment.Service.Address.Split(";").ToList()
|
Dim oSplit As List(Of String) = _Environment.Service.Address.Split(":").ToList()
|
||||||
Dim oAddress As String = oSplit.Item(0)
|
Dim oAddress As String = oSplit.Item(0)
|
||||||
Dim oPort As Integer = oSplit.Item(1)
|
Dim oPort As Integer = oSplit.Item(1)
|
||||||
|
|
||||||
@ -100,6 +103,7 @@ Public Class frmDocumentResultList
|
|||||||
' Initialize Viewer with GDPicture.NET License
|
' Initialize Viewer with GDPicture.NET License
|
||||||
DocumentViewer1.Init(_LogConfig, _Environment.Settings.GdPictureKey)
|
DocumentViewer1.Init(_LogConfig, _Environment.Settings.GdPictureKey)
|
||||||
|
|
||||||
|
|
||||||
AddHandler GridView1.FocusedRowChanged, AddressOf GridView_FocusedRowChanged
|
AddHandler GridView1.FocusedRowChanged, AddressOf GridView_FocusedRowChanged
|
||||||
AddHandler GridView2.FocusedRowChanged, AddressOf GridView_FocusedRowChanged
|
AddHandler GridView2.FocusedRowChanged, AddressOf GridView_FocusedRowChanged
|
||||||
AddHandler GridView3.FocusedRowChanged, AddressOf GridView_FocusedRowChanged
|
AddHandler GridView3.FocusedRowChanged, AddressOf GridView_FocusedRowChanged
|
||||||
@ -114,6 +118,53 @@ Public Class frmDocumentResultList
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Async Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs)
|
||||||
|
_ActiveRowHandle = e.FocusedRowHandle
|
||||||
|
|
||||||
|
If e.FocusedRowHandle >= 0 Then
|
||||||
|
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
|
||||||
|
DocumentViewer1.CloseDocument()
|
||||||
|
|
||||||
|
If _IsLegacy Then
|
||||||
|
LoadFile_Legacy(oRow)
|
||||||
|
Else
|
||||||
|
Await LoadFile_IDB(oRow)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub LoadFile_Legacy(GridRow As DataRow)
|
||||||
|
Try
|
||||||
|
Dim oFullPath = GridRow.Item(COLUMN_FILEPATH)
|
||||||
|
|
||||||
|
DocumentViewer1.LoadFile(oFullPath)
|
||||||
|
Catch ex As Exception
|
||||||
|
_Logger.Error(ex)
|
||||||
|
MsgBox("Error while loading file", MsgBoxStyle.Critical, Text)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Async Function LoadFile_IDB(GridRow As DataRow) As Task
|
||||||
|
Try
|
||||||
|
Dim oObjectId = GridRow.Item(COLUMN_DOCID)
|
||||||
|
_DocumentInfo = Await _IDBClient.GetDocumentInfo(_Environment.User.UserId, oObjectId)
|
||||||
|
|
||||||
|
DocumentViewer1.LoadFile(_DocumentInfo.FullPath)
|
||||||
|
|
||||||
|
If _DocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then
|
||||||
|
DocumentViewer1.SetViewOnly(True)
|
||||||
|
RibbonPageGroup_Export.Visible = False
|
||||||
|
Else
|
||||||
|
DocumentViewer1.SetViewOnly(False)
|
||||||
|
RibbonPageGroup_Export.Visible = True
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
_Logger.Error(ex)
|
||||||
|
MsgBox("Error while loading file", MsgBoxStyle.Critical, Text)
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults
|
Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults
|
||||||
_IsLoading = True
|
_IsLoading = True
|
||||||
Try
|
Try
|
||||||
@ -210,32 +261,6 @@ Public Class frmDocumentResultList
|
|||||||
End Select
|
End Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Async Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs)
|
|
||||||
_ActiveRowHandle = e.FocusedRowHandle
|
|
||||||
|
|
||||||
If _IsLegacy Then
|
|
||||||
If e.FocusedRowHandle >= 0 Then
|
|
||||||
DocumentViewer1.CloseDocument()
|
|
||||||
|
|
||||||
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
|
|
||||||
Dim oFullPath = oRow.Item(COLUMN_FILEPATH)
|
|
||||||
|
|
||||||
DocumentViewer1.LoadFile(oFullPath)
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
If e.FocusedRowHandle >= 0 Then
|
|
||||||
DocumentViewer1.CloseDocument()
|
|
||||||
|
|
||||||
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
|
|
||||||
Dim oObjectId = oRow.Item(COLUMN_DOCID)
|
|
||||||
|
|
||||||
Dim oInfo = Await _IDBClient.GetDocumentInfo(_Environment.User.UserId, oObjectId)
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable)
|
Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable)
|
||||||
Dim oDocDatatable As New DataTable
|
Dim oDocDatatable As New DataTable
|
||||||
Try
|
Try
|
||||||
@ -607,7 +632,7 @@ Public Class frmDocumentResultList
|
|||||||
|
|
||||||
e.Menu.Items.Clear()
|
e.Menu.Items.Clear()
|
||||||
|
|
||||||
For Each oItem In oMenu.GetMenuItems(_IsLegacy)
|
For Each oItem In oMenu.GetMenuItems(_IsLegacy, _DocumentInfo.AccessRight)
|
||||||
e.Menu.Items.Add(oItem)
|
e.Menu.Items.Add(oItem)
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user