Merge branch 'master' of http://dd-vmp07-com04:3000/AppStd/Monorepo
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Imports DigitalData.GUIs.ZooFlow.Base
|
||||
Imports DigitalData.GUIs.ZooFlow.frmGlobix_Index
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ClassValidator
|
||||
@@ -14,30 +15,18 @@ Public Class ClassValidator
|
||||
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
|
||||
Function ValidateControls(pPanel As Panel, pDocType As DocType) As Boolean
|
||||
Try
|
||||
Logger.Debug("Starting [ValidateControls]")
|
||||
Dim result As Boolean = True
|
||||
|
||||
For Each oControl As Control In pControls
|
||||
For Each oControl As Control In pPanel.Controls
|
||||
|
||||
' ========================= 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 oIndexName = GetIndexName(oTextBox, "txt")
|
||||
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
|
||||
|
||||
If oOptional = False Then
|
||||
@@ -54,7 +43,7 @@ Public Class ClassValidator
|
||||
Dim oValues As List(Of String) = oLookup.Properties.SelectedValues
|
||||
|
||||
If oValues.Count = 0 Then
|
||||
Dim oIndexName = Replace(oLookup.Name, "cmbMulti", "")
|
||||
Dim oIndexName = GetIndexName(oLookup, "cmbMulti")
|
||||
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
|
||||
|
||||
If oOptional = False Then
|
||||
@@ -70,7 +59,7 @@ Public Class ClassValidator
|
||||
Dim cmbSingle As TextBox = oControl
|
||||
|
||||
If cmbSingle.Text = "" Then
|
||||
Dim oIndexName = Replace(cmbSingle.Name, "cmbSingle", "")
|
||||
Dim oIndexName = GetIndexName(cmbSingle, "cmbSingle")
|
||||
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
|
||||
|
||||
If oOptional = False Then
|
||||
@@ -84,7 +73,7 @@ Public Class ClassValidator
|
||||
If oControl.Name.StartsWith("cmb") Then
|
||||
Dim cmb As ComboBox = oControl
|
||||
If cmb.Text = "" Then
|
||||
Dim oIndexName = Replace(cmb.Name, "cmb", "")
|
||||
Dim oIndexName = GetIndexName(cmb, "cmb")
|
||||
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
|
||||
|
||||
If oOptional = False Then
|
||||
@@ -98,7 +87,7 @@ Public Class ClassValidator
|
||||
' ========================= DATE PICKER =========================
|
||||
If oControl.Name.StartsWith("dtp") Then
|
||||
Dim dtp As DevExpress.XtraEditors.DateEdit = oControl
|
||||
Dim oIndexName As String = Replace(dtp.Name, "dtp", "")
|
||||
Dim oIndexName As String = GetIndexName(dtp, "dtp")
|
||||
|
||||
If dtp.Text = String.Empty Then
|
||||
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
|
||||
@@ -134,4 +123,124 @@ Public Class ClassValidator
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Function GetControlValues(pPanel As Panel)
|
||||
Dim oAttributeValues As New List(Of UserAttributeValue)
|
||||
|
||||
For Each oControl As Control In pPanel.Controls
|
||||
|
||||
' ========================= TEXTBOX =========================
|
||||
If oControl.Name.StartsWith("txt") Then
|
||||
Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl
|
||||
Dim oIndexName = GetIndexName(oTextBox, "txt")
|
||||
|
||||
' TODO: What to do when value is emmpty? send an empty value or skip the control?
|
||||
'If oTextBox.Text = "" Then
|
||||
'End If
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(oTextBox.Text),
|
||||
.ControlName = oTextBox.Name
|
||||
})
|
||||
End If
|
||||
|
||||
' ========================= LOOKUP =========================
|
||||
If oControl.Name.StartsWith("cmbMulti") Then
|
||||
Dim oLookup = DirectCast(oControl, LookupControl3)
|
||||
Dim oValues As List(Of String) = oLookup.Properties.SelectedValues
|
||||
Dim oIndexName = GetIndexName(oLookup, "cmbMulti")
|
||||
|
||||
If oValues.Count = 0 Then
|
||||
End If
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(oValues),
|
||||
.ControlName = oLookup.Name
|
||||
})
|
||||
End If
|
||||
|
||||
' ========================= COMBO BOX =========================
|
||||
If oControl.Name.StartsWith("cmbSingle") Then
|
||||
Dim cmbSingle As TextBox = oControl
|
||||
Dim oIndexName = GetIndexName(cmbSingle, "cmbSingle")
|
||||
|
||||
If cmbSingle.Text = "" Then
|
||||
End If
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(cmbSingle.Text),
|
||||
.ControlName = cmbSingle.Name
|
||||
})
|
||||
End If
|
||||
|
||||
If oControl.Name.StartsWith("cmb") Then
|
||||
Dim cmb As ComboBox = oControl
|
||||
Dim oIndexName = GetIndexName(cmb, "cmb")
|
||||
|
||||
If cmb.Text = "" Then
|
||||
End If
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(cmb.Text),
|
||||
.ControlName = cmb.Name
|
||||
})
|
||||
End If
|
||||
|
||||
' ========================= DATE PICKER =========================
|
||||
If oControl.Name.StartsWith("dtp") Then
|
||||
Dim dtp As DevExpress.XtraEditors.DateEdit = oControl
|
||||
Dim oIndexName As String = GetIndexName(dtp, "dtp")
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(dtp.EditValue.ToString),
|
||||
.ControlName = dtp.Name
|
||||
})
|
||||
End If
|
||||
|
||||
' ========================= CHECK BOX =========================
|
||||
If oControl.Name.StartsWith("chk") Then
|
||||
Dim chk As CheckBox = oControl
|
||||
Dim oIndexName As String = GetIndexName(chk, "chk")
|
||||
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(chk.Checked.ToString),
|
||||
.ControlName = chk.Name
|
||||
})
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oAttributeValues
|
||||
End Function
|
||||
|
||||
Private Function GetIndexName(pControl As Control, pPrefix As String) As String
|
||||
Dim oIndexName = Replace(pControl.Name, pPrefix, "")
|
||||
Return oIndexName
|
||||
End Function
|
||||
|
||||
Private Function WrapIndexValue(pValue As String) As String()
|
||||
Return New List(Of String) From {pValue}.ToArray
|
||||
End Function
|
||||
|
||||
Private Function WrapIndexValue(pValues As List(Of String)) As String()
|
||||
Return pValues.ToArray
|
||||
End Function
|
||||
|
||||
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
|
||||
End Class
|
||||
|
||||
@@ -305,9 +305,9 @@ Public Class frmGlobix_Index
|
||||
End Sub
|
||||
Sub Refresh_Dokart()
|
||||
Try
|
||||
Dim oSql = String.Format("select * from VWGI_DOCTYPE where UPPER(USERNAME) = UPPER('{0}') ORDER BY SEQUENCE", My.Application.User.UserName)
|
||||
Dim oFilter = $"USERNAME = '{My.Application.User.UserName}'"
|
||||
DT_VWGI_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSql, "VWGI_DOCTYPE", oFilter, "SEQUENCE")
|
||||
Dim oSql = String.Format("select * from VWGI_DOCTYPE_IDB where UPPER(USERNAME) = UPPER('{0}') ORDER BY SEQUENCE", My.Application.User.UserName)
|
||||
'Dim oFilter = $"USERNAME = '{My.Application.User.UserName}'"
|
||||
DT_VWGI_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSql, "VWGI_DOCTYPE_IDB", "", "SEQUENCE")
|
||||
|
||||
For Each oRow As DataRow In DT_VWGI_DOCTYPE.Rows
|
||||
cmbDocType.Properties.Items.Add(New DocType With {
|
||||
@@ -2415,7 +2415,11 @@ Public Class frmGlobix_Index
|
||||
|
||||
Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Dim oDokart As DocType = cmbDocType.SelectedItem
|
||||
Await GlobixFlowNew(oDokart)
|
||||
Dim oResult = Await GlobixFlowNew(oDokart)
|
||||
If oResult = True Then
|
||||
CancelAttempts = MaxCancelAttempts
|
||||
Close()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Async Function GlobixFlowNew(pDocType As DocType) As Threading.Tasks.Task(Of Boolean)
|
||||
@@ -2425,26 +2429,29 @@ Public Class frmGlobix_Index
|
||||
Cursor = Cursors.WaitCursor
|
||||
|
||||
Dim oValidator As New ClassValidator(My.LogConfig, My.Application.Service.Client)
|
||||
If oValidator.ValidateControls(pnlIndex.Controls, pDocType) = False Then
|
||||
If oValidator.ValidateControls(pnlIndex, pDocType) = False Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
'TODO: Globix File Import
|
||||
Dim oValues = oValidator.GetControlValues(pnlIndex)
|
||||
|
||||
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 oFileName As String = My.Application.Globix.CURRENT_WORKFILE
|
||||
Dim oObjectStore As String = "WORK"
|
||||
Dim oObjectKind As String = "DOC"
|
||||
Dim oBusinessEntity As String = "DEFAULT"
|
||||
Dim oProfileId As Integer = My.Application.Globix.CURRENT_DOCTYPE_ID
|
||||
Dim oAttributes As List(Of UserAttributeValue) = oValues
|
||||
Dim oOptions As New Modules.EDMI.API.Options.ImportFileOptions
|
||||
|
||||
Await My.Application.Service.Client.ImportFileAsync(oFileName, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessENtity, oOptions)
|
||||
Await My.Application.Service.Client.ImportFileAsync(oFileName, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessEntity, oOptions)
|
||||
|
||||
MsgBox("Die Datei wurde erfolgreich verarbeitet!", MsgBoxStyle.Information, Text)
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
MsgBox("Indexierung fehlgeschlagen!", MsgBoxStyle.Critical, Text)
|
||||
Return False
|
||||
|
||||
Finally
|
||||
Cursor = Cursors.Default
|
||||
|
||||
@@ -39,7 +39,12 @@ Public Class frmtest
|
||||
Dim oObjectId As Long = Await My.Application.Service.Client.ImportFileAsync(
|
||||
txtFile2Import.Text,
|
||||
txtProfileId.Text,
|
||||
New List(Of EDMIServiceReference.UserAttributeValue),
|
||||
New List(Of EDMIServiceReference.UserAttributeValue) From {
|
||||
New EDMIServiceReference.UserAttributeValue With {
|
||||
.AttributeName = "Attribut String1",
|
||||
.AttributeValues = New List(Of String) From {"SchreiberM"}.ToArray
|
||||
}
|
||||
},
|
||||
"WORK",
|
||||
"DOC",
|
||||
"DEFAULT"
|
||||
|
||||
Reference in New Issue
Block a user