EDMI: Include Doctypes in ClientConfig

This commit is contained in:
Jonathan Jenne
2022-02-04 16:49:05 +01:00
parent d8b1b7e2b7
commit 67852d4572
19 changed files with 1564 additions and 1357 deletions

View File

@@ -190,6 +190,10 @@
<Project>{3DCD6D1A-C830-4241-B7E4-27430E7EA483}</Project>
<Name>LookupControl</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Base\Base\Base.vbproj">
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
<Name>Base</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Config\Config.vbproj">
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
<Name>Config</Name>

View File

@@ -9,6 +9,10 @@ Namespace DocumentResultList
''' </summary>
Public Property Id As Long
''' <summary>
''' The access right given to the current user for this file
''' </summary>
''' <returns></returns>
Public Property AccessRight As AccessRight
''' <summary>
@@ -16,6 +20,7 @@ Namespace DocumentResultList
''' and showing it in the DocumentViewer. It is saved without the dot-separator.
''' </summary>
Public Property Extension As String
''' <summary>
''' Binary contents of the file.
''' </summary>
@@ -26,6 +31,7 @@ Namespace DocumentResultList
Public Property FullPath As String = Nothing
Public Property TempPath As String = Nothing
Public Property FileHash As String = Nothing
Public Property DocumentType As String = Nothing
Public Sub New(pPrimaryKey As Long)
Id = pPrimaryKey

View File

@@ -3,6 +3,7 @@ Imports DigitalData.Modules.EDMI.API
Imports DigitalData.Modules.EDMI.API.Client
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Base.IDB
Imports DigitalData.Modules.ZooFlow.Constants
Imports DigitalData.Modules.ZooFlow.State
@@ -41,24 +42,29 @@ Namespace DocumentResultList
Private Function Load_FromWindream(pObjectId As Long, pFullPath As String) As Document
Dim oFileInfo As New FileInfo(pFullPath)
Dim oResultDocumentInfo = New Document(pObjectId) With {
.Contents = Load_FromDisk(pFullPath),
.AccessRight = Rights.AccessRight.FULL,
.FullPath = pFullPath,
.Extension = oFileInfo.Extension.Substring(1)
}
.Contents = Load_FromDisk(pFullPath),
.AccessRight = Rights.AccessRight.FULL,
.FullPath = pFullPath,
.Extension = oFileInfo.Extension.Substring(1)
}
Return oResultDocumentInfo
End Function
Private Function Load_FromIDB(pObjectId As Long) As Document
Try
Dim oDocumentInfo As Client.DocumentInfo = Client.GetDocumentInfo(User.UserId, pObjectId)
Dim oDocumentInfo As DocumentInfo = Client.GetDocumentInfo(User.UserId, pObjectId)
Dim oFileInfo As New FileInfo(oDocumentInfo.FullPath)
' Load Doctype Attribute
Dim oDoctype As VariableValue = Client.GetVariableValue(pObjectId, Attributes.ATTRIBUTE_DOCTYPE)
Dim oResultDocumentInfo As New Document(pObjectId) With {
.Contents = Load_FromDisk(oDocumentInfo.FullPath),
.AccessRight = oDocumentInfo.AccessRight,
.FullPath = oDocumentInfo.FullPath,
.Extension = oFileInfo.Extension.Substring(1)
.Extension = oFileInfo.Extension.Substring(1),
.DocumentType = oDoctype.Value
}
Return oResultDocumentInfo
@@ -75,12 +81,16 @@ Namespace DocumentResultList
Return Nothing
End If
' Load Doctype Attribute
Dim oDoctype As VariableValue = Client.GetVariableValue(pObjectId, Attributes.ATTRIBUTE_DOCTYPE)
Dim oResultDocumentInfo As New Document(pObjectId) With {
.Contents = oFileObject._FileContents,
.Extension = oFileObject._FileExtension,
.AccessRight = Rights.AccessRight.FULL,
.FileHash = oFileObject._FileHash,
.FullPath = Nothing
.FullPath = Nothing,
.DocumentType = oDoctype.Value
}
Return oResultDocumentInfo

View File

@@ -209,7 +209,7 @@ Partial Class frmDocumentResultList
'
resources.ApplyResources(Me.BarButtonResetLayout, "BarButtonResetLayout")
Me.BarButtonResetLayout.Id = 10
Me.BarButtonResetLayout.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem5.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.BarButtonResetLayout.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonResetLayout.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.BarButtonResetLayout.Name = "BarButtonResetLayout"
Me.BarButtonResetLayout.Visibility = DevExpress.XtraBars.BarItemVisibility.OnlyInCustomizing
'

View File

@@ -255,7 +255,7 @@
<data name="BarButtonResetLayout.Caption" xml:space="preserve">
<value>Layout zurücksetzen</value>
</data>
<data name="BarButtonItem5.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="BarButtonResetLayout.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
@@ -452,10 +452,10 @@
<value>1189, 132</value>
</data>
<data name="RibbonStatusBar.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 649</value>
<value>0, 647</value>
</data>
<data name="RibbonStatusBar.Size" type="System.Drawing.Size, System.Drawing">
<value>1189, 22</value>
<value>1189, 24</value>
</data>
<data name="&gt;&gt;RibbonStatusBar.Name" xml:space="preserve">
<value>RibbonStatusBar</value>
@@ -482,7 +482,7 @@
<value>2</value>
</data>
<data name="GridControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>382, 513</value>
<value>382, 511</value>
</data>
<data name="GridControl1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@@ -584,7 +584,7 @@
<value>GridBand3</value>
</data>
<data name="GridControl3.Size" type="System.Drawing.Size, System.Drawing">
<value>370, 280</value>
<value>370, 278</value>
</data>
<data name="GridControl3.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@@ -617,7 +617,7 @@
<value>1</value>
</data>
<data name="SplitContainerControl2.Size" type="System.Drawing.Size, System.Drawing">
<value>370, 513</value>
<value>370, 511</value>
</data>
<data name="SplitContainerControl2.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@@ -653,7 +653,7 @@
<value>1</value>
</data>
<data name="SplitContainerControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>762, 513</value>
<value>762, 511</value>
</data>
<data name="SplitContainerControl1.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@@ -701,7 +701,7 @@
<value>0, 0</value>
</data>
<data name="DocumentViewer1.Size" type="System.Drawing.Size, System.Drawing">
<value>413, 513</value>
<value>413, 511</value>
</data>
<data name="DocumentViewer1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@@ -710,7 +710,7 @@
<value>DocumentViewer1</value>
</data>
<data name="&gt;&gt;DocumentViewer1.Type" xml:space="preserve">
<value>DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=1.6.4.0, Culture=neutral, PublicKeyToken=null</value>
<value>DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=1.6.5.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;DocumentViewer1.Parent" xml:space="preserve">
<value>SplitContainerControl3.Panel2</value>
@@ -734,7 +734,7 @@
<value>1</value>
</data>
<data name="SplitContainerControl3.Size" type="System.Drawing.Size, System.Drawing">
<value>1189, 517</value>
<value>1189, 515</value>
</data>
<data name="SplitContainerControl3.TabIndex" type="System.Int32, mscorlib">
<value>5</value>

View File

@@ -54,7 +54,7 @@ Public Class frmDocumentResultList
Private ReadOnly Params As DocumentResultList.Params
Private WithEvents Watcher As DocumentResultList.Watcher
Private _Documentloader As DocumentResultList.Loader
Private Documentloader As DocumentResultList.Loader
' Runtime variables
Private _IsLoading As Boolean = True
@@ -122,9 +122,10 @@ Public Class frmDocumentResultList
OperationMode = GetOperationMode()
If OperationMode = OperationMode.WithAppServer Or OperationMode = OperationMode.ZooFlow Then
InitAppServer()
End If
_Documentloader = New DocumentResultList.Loader(LogConfig, OperationMode, _IDBClient, Environment.User)
Documentloader = New DocumentResultList.Loader(LogConfig, OperationMode, _IDBClient, Environment.User)
If Params.WindowTitle <> "" Then
Text = $"{Text} - {Params.WindowTitle}"
@@ -204,7 +205,7 @@ Public Class frmDocumentResultList
DocumentViewer1.CloseDocument()
oDocumentInfo = _Documentloader.Load(oObjectId, oFullPath)
oDocumentInfo = Documentloader.Load(oObjectId, oFullPath)
' Check DocumentInfo
If IsNothing(oDocumentInfo) Then
@@ -237,6 +238,15 @@ Public Class frmDocumentResultList
Public Async Sub Watcher_FileChanged(sender As Object, e As DocumentResultList.Watcher.FileChangedArgs) Handles Watcher.FileChanged
Try
Dim oDoctype = Nothing
If e.File.Document.DocumentType IsNot Nothing Then
oDoctype = _IDBClient.ClientConfig.DocumentTypes.
Where(Function(doctype) doctype.Name = e.File.Document.DocumentType).
FirstOrDefault()
End If
Dim oFileInfo = New FileInfo(e.File.FilePath)
Dim oMessage = $"Die Datei '{oFileInfo.Name}' wurde außerhalb des Systems verändert. Wollen Sie diese Änderung als neue Version in das System übernehmen? 'Nein' überschreibt die ursprüngliche Datei."
Dim oResult As DialogResult = MsgBox(oMessage, MsgBoxStyle.YesNoCancel Or MsgBoxStyle.Question, "Datei verändert")
@@ -248,7 +258,7 @@ Public Class frmDocumentResultList
' - Cancel: Abort update
Select Case oResult
Case DialogResult.Cancel
MsgBox("Abbruch!")
' MsgBox("Abbruch!")
Case Else
Dim oCreateNewFileVersion = IIf(oResult = DialogResult.Yes, True, False)
@@ -482,30 +492,30 @@ Public Class frmDocumentResultList
End Try
End Sub
Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell
Try
If e.RowHandle < 0 Then
Exit Sub
End If
'Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell
' Try
' If e.RowHandle < 0 Then
' Exit Sub
' End If
e.DefaultDraw()
' e.DefaultDraw()
Dim oView As GridView = TryCast(sender, GridView)
Dim oCellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo)
Dim oRow As DataRow = oView.GetDataRow(e.RowHandle)
Dim oValue = oRow.Item(COLUMN_FILENAME)
' Dim oView As GridView = TryCast(sender, GridView)
' Dim oCellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo)
' Dim oRow As DataRow = oView.GetDataRow(e.RowHandle)
' Dim oValue = oRow.Item(COLUMN_FILENAME)
If e.Column.FieldName = COLUMN_ICON Then
Dim oIcon = Helpers.GetIconByExtension(oValue)
Dim offsetX = 0
Dim offsetY = 0
' If e.Column.FieldName = COLUMN_ICON Then
' Dim oIcon = Helpers.GetIconByExtension(oValue)
' Dim offsetX = 0
' Dim offsetY = 0
e.Cache.DrawImage(oIcon, e.Bounds.X + offsetX, e.Bounds.Y + offsetY, 18, 18)
End If
Catch ex As Exception
Logger.Error(ex)
End Try
End Sub
' e.Cache.DrawImage(oIcon, e.Bounds.X + offsetX, e.Bounds.Y + offsetY, 18, 18)
' End If
' Catch ex As Exception
' Logger.Error(ex)
' End Try
'End Sub
Private Sub BarButtonItemExportGrid1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemExportGrid1.ItemClick
Dim oActiveGrid = GetActiveGridControl()
@@ -862,6 +872,10 @@ Public Class frmDocumentResultList
End Try
End Sub
Private Sub RibbonControl_Click(sender As Object, e As EventArgs) Handles RibbonControl.Click
End Sub