Fix Automatic Profile by Regex

This commit is contained in:
Jonathan Jenne 2021-04-09 16:38:02 +02:00
parent a8531bc454
commit 0f9ad5659b

View File

@ -1581,29 +1581,28 @@ Public Class frmIndex
'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART) 'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART)
End If End If
Else End If
If DTTBGI_REGEX_DOCTYPE.Rows.Count > 0 Then
For Each oRoW As DataRow In DTTBGI_REGEX_DOCTYPE.Rows
Dim oOnlyFilename = Path.GetFileName(CURRENT_WORKFILE)
If Regex.IsMatch(oOnlyFilename, oRoW.Item("Regex")) Then
_Logger.Debug("There is a match on REGEX_DOCTYPE: [{0}]", oRoW.Item("DOCTYPE")) If ComboboxDoctype.SelectedItem Is Nothing And DTTBGI_REGEX_DOCTYPE.Rows.Count > 0 Then
_Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename) For Each oRoW As DataRow In DTTBGI_REGEX_DOCTYPE.Rows
'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(oRoW.Item("DOCTYPE")) Dim oOnlyFilename = Path.GetFileName(CURRENT_WORKFILE)
If Regex.IsMatch(oOnlyFilename, oRoW.Item("Regex")) Then
Dim oFoundDocType = ComboboxDoctype.Properties.Items. _Logger.Debug("There is a match on REGEX_DOCTYPE: [{0}]", oRoW.Item("DOCTYPE"))
Cast(Of DocType)(). _Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename)
Where(Function(dt) dt.Name = CURRENT_LASTDOKART). 'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(oRoW.Item("DOCTYPE"))
FirstOrDefault()
If oFoundDocType IsNot Nothing Then Dim oFoundDocType = ComboboxDoctype.Properties.Items.
ComboboxDoctype.SelectedItem = oFoundDocType Cast(Of DocType)().
End If Where(Function(dt) dt.Guid = oRoW.Item("DOCTYPE_ID")).
FirstOrDefault()
If oFoundDocType IsNot Nothing Then
ComboboxDoctype.SelectedItem = oFoundDocType
Exit For Exit For
End If End If
Next End If
End If Next
End If End If
Catch ex As Exception Catch ex As Exception
ShowErrorMessage(ex, "Form Shown") ShowErrorMessage(ex, "Form Shown")
@ -1626,10 +1625,8 @@ Public Class frmIndex
For Each oRow As DataRow In oDoctypes.Rows For Each oRow As DataRow In oDoctypes.Rows
ComboboxDoctype.Properties.Items.Add(New DocType With { Dim oDocType = New DocType With {.Guid = oRow.Item("DOCTYPE_ID"), .Name = oRow.Item("DOCTYPE")}
.Guid = oRow.Item("DOCTYPE_ID"), ComboboxDoctype.Properties.Items.Add(oDocType)
.Name = oRow.Item("DOCTYPE")
})
Next Next
ComboboxDoctype.SelectedIndex = -1 ComboboxDoctype.SelectedIndex = -1