This commit is contained in:
2021-12-08 10:53:30 +01:00
20 changed files with 498 additions and 364 deletions

View File

@@ -0,0 +1,137 @@
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.GUIs.ZooFlow.Base
Imports DigitalData.GUIs.ZooFlow.frmGlobix_Index
Imports DigitalData.Modules.EDMI.API
Imports DigitalData.Modules.Logging
Public Class ClassValidator
Inherits BaseClass
Private ReadOnly Client As Client
Public Sub New(pLogConfig As LogConfig, pClient As Client)
MyBase.New(pLogConfig)
Client = pClient
End Sub
Private Function TestIsIndexOptional(pDocType As DocType, pIndexName As String) As Boolean
Dim oIsOptional As Boolean = My.Helpers.GetValueFromDatatable(
My.Application.Globix.CURR_DT_MAN_INDEXE,
$"DOK_ID = {pDocType.Guid} AND INDEXNAME = '{pIndexName}'", "OPTIONAL", "")
Return oIsOptional
End Function
Private Sub ShowValidationMessage()
MsgBox(ClassStrings.TEXT_MISSING_INPUT, MsgBoxStyle.Exclamation, ClassStrings.TITLE_MISSING_INPUT)
End Sub
Function ValidateControls(pControls As ControlCollection, pDocType As DocType) As Boolean
Try
Logger.Debug("Starting [ValidateControls]")
Dim result As Boolean = True
For Each oControl As Control In pControls
' ========================= TEXT BOX =========================
If oControl.Name.StartsWith("txt") Then
Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl
If oTextBox.Text = "" Then
Dim oIndexName = Replace(oTextBox.Name, "txt", "")
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
oTextBox.Focus()
Return False
End If
End If
End If
' ========================= LOOKUP =========================
If oControl.Name.StartsWith("cmbMulti") Then
Dim oLookup = DirectCast(oControl, LookupControl3)
Dim oValues As List(Of String) = oLookup.Properties.SelectedValues
If oValues.Count = 0 Then
Dim oIndexName = Replace(oLookup.Name, "cmbMulti", "")
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
oLookup.Focus()
Return False
End If
End If
End If
' ========================= COMBO BOX =========================
If oControl.Name.StartsWith("cmbSingle") Then
Dim cmbSingle As TextBox = oControl
If cmbSingle.Text = "" Then
Dim oIndexName = Replace(cmbSingle.Name, "cmbSingle", "")
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
cmbSingle.Focus()
Return False
End If
End If
End If
If oControl.Name.StartsWith("cmb") Then
Dim cmb As ComboBox = oControl
If cmb.Text = "" Then
Dim oIndexName = Replace(cmb.Name, "cmb", "")
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
cmb.Focus()
Return False
End If
End If
End If
' ========================= DATE PICKER =========================
If oControl.Name.StartsWith("dtp") Then
Dim dtp As DevExpress.XtraEditors.DateEdit = oControl
Dim oIndexName As String = Replace(dtp.Name, "dtp", "")
If dtp.Text = String.Empty Then
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
If oOptional = False Then
ShowValidationMessage()
dtp.Focus()
Return False
End If
End If
End If
' ========================= CHECK BOX =========================
If oControl.Name.StartsWith("chk") Then
Dim chk As CheckBox = oControl
'result = True
End If
'If TypeOf (oControl) Is Button Then
' Continue For
'End If
'If oControl.Name.StartsWith("lbl") = False And result = False Then
' Logger.Info("Die Überprüfung der manuellen Indices ist fehlerhaft. Bitte informieren Sie den Systembetreuer")
' Return False
'End If
Next
Return True
Catch ex As Exception
Logger.Warn("Unvorhergesehener Fehler in ValidateControls")
Logger.Error(ex.Message)
Return False
End Try
End Function
End Class

View File

@@ -52,9 +52,10 @@ Partial Class frmGlobix_Index
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
Me.pnlIndex = New System.Windows.Forms.Panel()
Me.Panel3 = New System.Windows.Forms.Panel()
Me.Button1 = New System.Windows.Forms.Button()
Me.btnAblageFlow = New System.Windows.Forms.Button()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.ComboBoxEdit1 = New DevExpress.XtraEditors.ComboBoxEdit()
Me.cmbDocType = New DevExpress.XtraEditors.ComboBoxEdit()
Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer()
Me.GlobixDataset = New DigitalData.GUIs.ZooFlow.GlobixDataset()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -62,7 +63,7 @@ Partial Class frmGlobix_Index
Me.SplitContainerControl1.SuspendLayout()
Me.Panel3.SuspendLayout()
Me.Panel1.SuspendLayout()
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cmbDocType.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GlobixDataset, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
@@ -263,6 +264,7 @@ Partial Class frmGlobix_Index
'
'Panel3
'
Me.Panel3.Controls.Add(Me.Button1)
Me.Panel3.Controls.Add(Me.btnAblageFlow)
Me.Panel3.Dock = System.Windows.Forms.DockStyle.Bottom
Me.Panel3.Location = New System.Drawing.Point(0, 433)
@@ -270,24 +272,35 @@ Partial Class frmGlobix_Index
Me.Panel3.Size = New System.Drawing.Size(522, 75)
Me.Panel3.TabIndex = 2
'
'Button1
'
Me.Button1.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.Button1.Location = New System.Drawing.Point(317, 15)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(186, 44)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Starte Ablage (Neu)"
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button1.UseVisualStyleBackColor = True
'
'btnAblageFlow
'
Me.btnAblageFlow.Dock = System.Windows.Forms.DockStyle.Fill
Me.btnAblageFlow.Font = New System.Drawing.Font("Tahoma", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnAblageFlow.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnAblageFlow.Image = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.ZooFlow_g_64___Kopie
Me.btnAblageFlow.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnAblageFlow.Location = New System.Drawing.Point(0, 0)
Me.btnAblageFlow.Location = New System.Drawing.Point(12, 6)
Me.btnAblageFlow.Name = "btnAblageFlow"
Me.btnAblageFlow.Size = New System.Drawing.Size(522, 75)
Me.btnAblageFlow.Size = New System.Drawing.Size(185, 63)
Me.btnAblageFlow.TabIndex = 1
Me.btnAblageFlow.Text = "Starte Ablage"
Me.btnAblageFlow.Text = "Starte Ablage (Alt)"
Me.btnAblageFlow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnAblageFlow.UseVisualStyleBackColor = True
'
'Panel1
'
Me.Panel1.BackColor = System.Drawing.Color.Silver
Me.Panel1.Controls.Add(Me.ComboBoxEdit1)
Me.Panel1.Controls.Add(Me.cmbDocType)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top
Me.Panel1.Location = New System.Drawing.Point(0, 0)
Me.Panel1.Name = "Panel1"
@@ -296,18 +309,18 @@ Partial Class frmGlobix_Index
'
'ComboBoxEdit1
'
Me.ComboBoxEdit1.Dock = System.Windows.Forms.DockStyle.Top
Me.ComboBoxEdit1.Location = New System.Drawing.Point(0, 0)
Me.ComboBoxEdit1.MenuManager = Me.RibbonControl1
Me.ComboBoxEdit1.Name = "ComboBoxEdit1"
Me.cmbDocType.Dock = System.Windows.Forms.DockStyle.Top
Me.cmbDocType.Location = New System.Drawing.Point(0, 0)
Me.cmbDocType.MenuManager = Me.RibbonControl1
Me.cmbDocType.Name = "ComboBoxEdit1"
SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer))
SerializableAppearanceObject1.Options.UseBackColor = True
Me.ComboBoxEdit1.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", 20, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", Nothing, Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
Me.ComboBoxEdit1.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat
Me.ComboBoxEdit1.Properties.NullText = "Bitte wählen Sie ein Profil"
Me.ComboBoxEdit1.Properties.Padding = New System.Windows.Forms.Padding(5)
Me.ComboBoxEdit1.Size = New System.Drawing.Size(522, 30)
Me.ComboBoxEdit1.TabIndex = 4
Me.cmbDocType.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", 20, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", Nothing, Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
Me.cmbDocType.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat
Me.cmbDocType.Properties.NullText = "Bitte wählen Sie ein Profil"
Me.cmbDocType.Properties.Padding = New System.Windows.Forms.Padding(5)
Me.cmbDocType.Size = New System.Drawing.Size(522, 30)
Me.cmbDocType.TabIndex = 4
'
'DocumentViewer1
'
@@ -342,7 +355,7 @@ Partial Class frmGlobix_Index
Me.SplitContainerControl1.ResumeLayout(False)
Me.Panel3.ResumeLayout(False)
Me.Panel1.ResumeLayout(False)
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cmbDocType.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GlobixDataset, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -376,6 +389,7 @@ Partial Class frmGlobix_Index
Friend WithEvents pnlIndex As Panel
Friend WithEvents Panel3 As Panel
Friend WithEvents GlobixDataset As GlobixDataset
Friend WithEvents ComboBoxEdit1 As DevExpress.XtraEditors.ComboBoxEdit
Friend WithEvents cmbDocType As DevExpress.XtraEditors.ComboBoxEdit
Friend WithEvents btnAblageFlow As Button
Friend WithEvents Button1 As Button
End Class

View File

@@ -11,6 +11,7 @@ Imports DigitalData.Modules.Language.Utils
Imports DigitalData.Controls.LookupGrid
Imports Independentsoft
Imports DevExpress.XtraEditors.Controls
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Public Class frmGlobix_Index
#Region "+++++ Variablen ++++++"
@@ -51,11 +52,13 @@ Public Class frmGlobix_Index
Return Name
End Function
End Class
Public Class ControlMeta
Public Property IndexName As String
Public Property IndexType As String
Public Property MultipleValues As Boolean = False
End Class
#End Region
Public Sub New(LogConfig As LogConfig)
@@ -260,12 +263,12 @@ Public Class frmGlobix_Index
checkItemPreselection.Checked = True
If My.Application.Globix.CURRENT_LASTDOCTYPE <> "" Then
Dim oFoundDocType = ComboBoxEdit1.Properties.Items.
Dim oFoundDocType = cmbDocType.Properties.Items.
Cast(Of DocType)().
Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE).
FirstOrDefault()
If oFoundDocType IsNot Nothing Then
ComboBoxEdit1.SelectedItem = oFoundDocType
cmbDocType.SelectedItem = oFoundDocType
End If
@@ -278,13 +281,13 @@ Public Class frmGlobix_Index
_Logger.Debug("There is a match on REGEX_DOCTYPE: [{0}]", oRoW.Item("DOCTYPE"))
_Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename)
Dim oFoundDocType = ComboBoxEdit1.Properties.Items.
Dim oFoundDocType = cmbDocType.Properties.Items.
Cast(Of DocType)().
Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE).
FirstOrDefault()
If oFoundDocType IsNot Nothing Then
ComboBoxEdit1.SelectedItem = oFoundDocType
cmbDocType.SelectedItem = oFoundDocType
End If
Exit For
End If
@@ -307,7 +310,7 @@ Public Class frmGlobix_Index
DT_VWGI_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSql, "VWGI_DOCTYPE", oFilter, "SEQUENCE")
For Each oRow As DataRow In DT_VWGI_DOCTYPE.Rows
ComboBoxEdit1.Properties.Items.Add(New DocType With {
cmbDocType.Properties.Items.Add(New DocType With {
.Guid = oRow.Item("DOCTYPE_ID"),
.Name = oRow.Item("DOCTYPE")
})
@@ -319,9 +322,9 @@ Public Class frmGlobix_Index
End Sub
Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxEdit1.SelectedIndexChanged
If ComboBoxEdit1.SelectedIndex <> -1 And FormLoaded = True Then
Dim oSelectedItem As DocType = ComboBoxEdit1.SelectedItem
Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbDocType.SelectedIndexChanged
If cmbDocType.SelectedIndex <> -1 And FormLoaded = True Then
Dim oSelectedItem As DocType = cmbDocType.SelectedItem
My.Application.Globix.CURRENT_DOCTYPE_ID = oSelectedItem.Guid
@@ -393,8 +396,8 @@ Public Class frmGlobix_Index
_Controls = oControls
If DT_INDEXEMAN.Rows.Count = 0 Then
ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert")
_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert")
ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDocType.Text & " definiert")
_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDocType.Text & " definiert")
End If
For Each oRow As DataRow In DT_INDEXEMAN.Rows
@@ -778,13 +781,15 @@ Public Class frmGlobix_Index
Private Sub GlobixFlow()
ClearError()
ClearNotice()
Me.Cursor = Cursors.WaitCursor
Cursor = Cursors.WaitCursor
Refresh_RegexTable()
For Each rowregex As DataRow In My.Application.Globix.DT_FUNCTION_REGEX.Rows
If rowregex.Item("FUNCTION_NAME") = "CLEAN_FILENAME" Then
My.Application.Globix.REGEX_CLEAN_FILENAME = rowregex.Item("REGEX")
End If
Next
If chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always And chkMultiindexing.Checked = True Then
'Die erste Datei indexieren
If WORK_FILE() = True Then
@@ -854,7 +859,7 @@ Public Class frmGlobix_Index
_Logger.Debug("Manuelle Indexe geladen")
If My.Application.Globix.CURR_DT_MAN_INDEXE.Rows.Count > 0 Then
Dim oDokart As DocType = ComboBoxEdit1.SelectedItem
Dim oDokart As DocType = cmbDocType.SelectedItem
My.Application.Globix.CURRENT_DOCTYPE_ID = oDokart.Guid
If CheckWrite_IndexeMan(oDokart.Guid) = True Then
@@ -2404,11 +2409,48 @@ Public Class frmGlobix_Index
End Function
Private Sub PictureEdit1_EditValueChanged(sender As Object, e As EventArgs)
End Sub
Private Sub btnAblageFlow_Click(sender As Object, e As EventArgs) Handles btnAblageFlow.Click
GlobixFlow()
End Sub
Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim oDokart As DocType = cmbDocType.SelectedItem
Await GlobixFlowNew(oDokart)
End Sub
Private Async Function GlobixFlowNew(pDocType As DocType) As Threading.Tasks.Task(Of Boolean)
Try
ClearError()
ClearNotice()
Cursor = Cursors.WaitCursor
Dim oValidator As New ClassValidator(My.LogConfig, My.Application.Service.Client)
If oValidator.ValidateControls(pnlIndex.Controls, pDocType) = False Then
Return False
End If
'TODO: Globix File Import
Dim oFileName As String
Dim oObjectStore As String
Dim oObjectKind As String
Dim oBusinessENtity As String
Dim oProfileId As Integer
Dim oAttributes As List(Of UserAttributeValue)
Dim oOptions As New Modules.EDMI.API.Options.ImportFileOptions
Await My.Application.Service.Client.ImportFileAsync(oFileName, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessENtity, oOptions)
Return True
Catch ex As Exception
_Logger.Error(ex)
MsgBox("Indexierung fehlgeschlagen!", MsgBoxStyle.Critical, Text)
Finally
Cursor = Cursors.Default
End Try
End Function
End Class