First pass of new mandator selection

This commit is contained in:
Jonathan Jenne
2021-11-19 16:23:18 +01:00
parent dec45ef493
commit ac50cf661b
19 changed files with 235 additions and 136 deletions

View File

@@ -4,6 +4,7 @@ Namespace My
<HideModuleName()> <HideModuleName()>
Module MyExtensions Module MyExtensions
Friend Property TemplateConfiguration As TemplateConfig Friend Property TemplateConfiguration As TemplateConfig
Friend Property MappingConfiguration As New List(Of MappingConfig) Friend Property MappingConfiguration As MappingConfig
Friend Property MandatorConfiguration As MandatorConfig
End Module End Module
End Namespace End Namespace

View File

@@ -29,13 +29,12 @@ Partial Class frmImportMain
Me.SplitContainerMain = New DevExpress.XtraEditors.SplitContainerControl() Me.SplitContainerMain = New DevExpress.XtraEditors.SplitContainerControl()
Me.GridControlFiles = New DevExpress.XtraGrid.GridControl() Me.GridControlFiles = New DevExpress.XtraGrid.GridControl()
Me.GridViewFiles = New DevExpress.XtraGrid.Views.BandedGrid.AdvBandedGridView() Me.GridViewFiles = New DevExpress.XtraGrid.Views.BandedGrid.AdvBandedGridView()
Me.gridBand1 = New DevExpress.XtraGrid.Views.BandedGrid.GridBand()
Me.colSelected = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn() Me.colSelected = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn()
Me.gridBand3 = New DevExpress.XtraGrid.Views.BandedGrid.GridBand()
Me.colFilename = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn() Me.colFilename = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn()
Me.colCreatedAt = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn() Me.colCreatedAt = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn()
Me.colMandator = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn() Me.colMandator = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn()
Me.cmbMandators = New DevExpress.XtraEditors.Repository.RepositoryItemComboBox() Me.cmbMandators = New DevExpress.XtraEditors.Repository.RepositoryItemComboBox()
Me.BandedGridColumn1 = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn()
Me.RibbonControl = New DevExpress.XtraBars.Ribbon.RibbonControl() Me.RibbonControl = New DevExpress.XtraBars.Ribbon.RibbonControl()
Me.txtVersion = New DevExpress.XtraBars.BarStaticItem() Me.txtVersion = New DevExpress.XtraBars.BarStaticItem()
Me.txtFilesLoaded = New DevExpress.XtraBars.BarStaticItem() Me.txtFilesLoaded = New DevExpress.XtraBars.BarStaticItem()
@@ -86,6 +85,9 @@ Partial Class frmImportMain
Me.GridView4 = New DevExpress.XtraGrid.Views.Grid.GridView() Me.GridView4 = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.BehaviorManager = New DevExpress.Utils.Behaviors.BehaviorManager(Me.components) Me.BehaviorManager = New DevExpress.Utils.Behaviors.BehaviorManager(Me.components)
Me.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.MultiTool.Form.frmWaitForm), True, True) Me.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.MultiTool.Form.frmWaitForm), True, True)
Me.gridBand1 = New DevExpress.XtraGrid.Views.BandedGrid.GridBand()
Me.GridBand2 = New DevExpress.XtraGrid.Views.BandedGrid.GridBand()
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem()
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerMain.SuspendLayout() Me.SplitContainerMain.SuspendLayout()
CType(Me.GridControlFiles, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridControlFiles, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -137,8 +139,8 @@ Partial Class frmImportMain
' '
'GridViewFiles 'GridViewFiles
' '
Me.GridViewFiles.Bands.AddRange(New DevExpress.XtraGrid.Views.BandedGrid.GridBand() {Me.gridBand1, Me.gridBand3}) Me.GridViewFiles.Bands.AddRange(New DevExpress.XtraGrid.Views.BandedGrid.GridBand() {Me.gridBand1, Me.GridBand2})
Me.GridViewFiles.Columns.AddRange(New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn() {Me.colSelected, Me.colFilename, Me.colMandator, Me.colCreatedAt}) Me.GridViewFiles.Columns.AddRange(New DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn() {Me.colSelected, Me.colFilename, Me.colMandator, Me.colCreatedAt, Me.BandedGridColumn1})
Me.GridViewFiles.GridControl = Me.GridControlFiles Me.GridViewFiles.GridControl = Me.GridControlFiles
Me.GridViewFiles.Name = "GridViewFiles" Me.GridViewFiles.Name = "GridViewFiles"
Me.GridViewFiles.OptionsView.ShowBands = False Me.GridViewFiles.OptionsView.ShowBands = False
@@ -146,12 +148,6 @@ Partial Class frmImportMain
Me.GridViewFiles.OptionsView.ShowGroupPanel = False Me.GridViewFiles.OptionsView.ShowGroupPanel = False
Me.GridViewFiles.OptionsView.ShowIndicator = False Me.GridViewFiles.OptionsView.ShowIndicator = False
' '
'gridBand1
'
resources.ApplyResources(Me.gridBand1, "gridBand1")
Me.gridBand1.Columns.Add(Me.colSelected)
Me.gridBand1.VisibleIndex = 0
'
'colSelected 'colSelected
' '
Me.colSelected.AutoFillDown = True Me.colSelected.AutoFillDown = True
@@ -164,18 +160,10 @@ Partial Class frmImportMain
Me.colSelected.OptionsColumn.FixedWidth = True Me.colSelected.OptionsColumn.FixedWidth = True
Me.colSelected.UnboundType = DevExpress.Data.UnboundColumnType.[Boolean] Me.colSelected.UnboundType = DevExpress.Data.UnboundColumnType.[Boolean]
' '
'gridBand3
'
resources.ApplyResources(Me.gridBand3, "gridBand3")
Me.gridBand3.Columns.Add(Me.colFilename)
Me.gridBand3.Columns.Add(Me.colCreatedAt)
Me.gridBand3.Columns.Add(Me.colMandator)
Me.gridBand3.VisibleIndex = 1
'
'colFilename 'colFilename
' '
resources.ApplyResources(Me.colFilename, "colFilename") resources.ApplyResources(Me.colFilename, "colFilename")
Me.colFilename.FieldName = "Name" Me.colFilename.FieldName = "FileName"
Me.colFilename.Name = "colFilename" Me.colFilename.Name = "colFilename"
Me.colFilename.OptionsColumn.AllowEdit = False Me.colFilename.OptionsColumn.AllowEdit = False
Me.colFilename.OptionsColumn.ReadOnly = True Me.colFilename.OptionsColumn.ReadOnly = True
@@ -195,7 +183,7 @@ Partial Class frmImportMain
Me.colMandator.ColumnEdit = Me.cmbMandators Me.colMandator.ColumnEdit = Me.cmbMandators
Me.colMandator.FieldName = "MandatorId" Me.colMandator.FieldName = "MandatorId"
Me.colMandator.Name = "colMandator" Me.colMandator.Name = "colMandator"
Me.colMandator.RowIndex = 2 Me.colMandator.RowIndex = 1
' '
'cmbMandators 'cmbMandators
' '
@@ -204,12 +192,18 @@ Partial Class frmImportMain
Me.cmbMandators.Items.AddRange(New Object() {resources.GetString("cmbMandators.Items")}) Me.cmbMandators.Items.AddRange(New Object() {resources.GetString("cmbMandators.Items")})
Me.cmbMandators.Name = "cmbMandators" Me.cmbMandators.Name = "cmbMandators"
' '
'BandedGridColumn1
'
resources.ApplyResources(Me.BandedGridColumn1, "BandedGridColumn1")
Me.BandedGridColumn1.FieldName = "Mandator"
Me.BandedGridColumn1.Name = "BandedGridColumn1"
'
'RibbonControl 'RibbonControl
' '
Me.RibbonControl.ExpandCollapseItem.Id = 0 Me.RibbonControl.ExpandCollapseItem.Id = 0
Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.txtVersion, Me.txtFilesLoaded, Me.btnLoadFiles, Me.btnTransferFile, Me.btnOpenInputDirectory, Me.btnOpenOutputDirectory, Me.btnOpenSchemaDirectory, Me.btnReloadFile, Me.btnTransferAllFiles, Me.btnOpenReport, Me.btnShowXml, Me.btnOpenLogDirectory, Me.btnOpenConfigDirectory, Me.txtCurrentFile, Me.btnConfig, Me.txtCulture, Me.btnRemoveRow, Me.BarWorkspaceMenuItem1, Me.btnTestTransferFile}) Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.txtVersion, Me.txtFilesLoaded, Me.btnLoadFiles, Me.btnTransferFile, Me.btnOpenInputDirectory, Me.btnOpenOutputDirectory, Me.btnOpenSchemaDirectory, Me.btnReloadFile, Me.btnTransferAllFiles, Me.btnOpenReport, Me.btnShowXml, Me.btnOpenLogDirectory, Me.btnOpenConfigDirectory, Me.txtCurrentFile, Me.btnConfig, Me.txtCulture, Me.btnRemoveRow, Me.BarWorkspaceMenuItem1, Me.btnTestTransferFile, Me.BarButtonItem1})
resources.ApplyResources(Me.RibbonControl, "RibbonControl") resources.ApplyResources(Me.RibbonControl, "RibbonControl")
Me.RibbonControl.MaxItemId = 30 Me.RibbonControl.MaxItemId = 31
Me.RibbonControl.Name = "RibbonControl" Me.RibbonControl.Name = "RibbonControl"
Me.RibbonControl.PageHeaderItemLinks.Add(Me.BarWorkspaceMenuItem1) Me.RibbonControl.PageHeaderItemLinks.Add(Me.BarWorkspaceMenuItem1)
Me.RibbonControl.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1, Me.RibbonPage2}) Me.RibbonControl.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1, Me.RibbonPage2})
@@ -571,6 +565,26 @@ Partial Class frmImportMain
' '
Me.SplashScreenManager.ClosingDelay = 500 Me.SplashScreenManager.ClosingDelay = 500
' '
'gridBand1
'
resources.ApplyResources(Me.gridBand1, "gridBand1")
Me.gridBand1.Columns.Add(Me.colSelected)
Me.gridBand1.VisibleIndex = 0
'
'GridBand2
'
resources.ApplyResources(Me.GridBand2, "GridBand2")
Me.GridBand2.Columns.Add(Me.colFilename)
Me.GridBand2.Columns.Add(Me.colCreatedAt)
Me.GridBand2.Columns.Add(Me.colMandator)
Me.GridBand2.VisibleIndex = 1
'
'BarButtonItem1
'
resources.ApplyResources(Me.BarButtonItem1, "BarButtonItem1")
Me.BarButtonItem1.Id = 30
Me.BarButtonItem1.Name = "BarButtonItem1"
'
'frmImportMain 'frmImportMain
' '
resources.ApplyResources(Me, "$this") resources.ApplyResources(Me, "$this")
@@ -671,9 +685,11 @@ Partial Class frmImportMain
Friend WithEvents GridView3 As GridView Friend WithEvents GridView3 As GridView
Friend WithEvents GridControl4 As DevExpress.XtraGrid.GridControl Friend WithEvents GridControl4 As DevExpress.XtraGrid.GridControl
Friend WithEvents GridView4 As GridView Friend WithEvents GridView4 As GridView
Friend WithEvents gridBand1 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
Friend WithEvents gridBand3 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
Friend WithEvents BarWorkspaceMenuItem1 As DevExpress.XtraBars.BarWorkspaceMenuItem Friend WithEvents BarWorkspaceMenuItem1 As DevExpress.XtraBars.BarWorkspaceMenuItem
Friend WithEvents WorkspaceManager1 As DevExpress.Utils.WorkspaceManager Friend WithEvents WorkspaceManager1 As DevExpress.Utils.WorkspaceManager
Friend WithEvents btnTestTransferFile As DevExpress.XtraBars.BarButtonItem Friend WithEvents btnTestTransferFile As DevExpress.XtraBars.BarButtonItem
Friend WithEvents BandedGridColumn1 As DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn
Friend WithEvents gridBand1 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
Friend WithEvents GridBand2 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem
End Class End Class

View File

@@ -150,7 +150,7 @@
<data name="gridBand1.Width" type="System.Int32, mscorlib"> <data name="gridBand1.Width" type="System.Int32, mscorlib">
<value>27</value> <value>27</value>
</data> </data>
<data name="gridBand3.Caption" xml:space="preserve"> <data name="GridBand2.Caption" xml:space="preserve">
<value>gridBand3</value> <value>gridBand3</value>
</data> </data>
<data name="colFilename.Caption" xml:space="preserve"> <data name="colFilename.Caption" xml:space="preserve">
@@ -160,7 +160,7 @@
<value>True</value> <value>True</value>
</data> </data>
<data name="colFilename.Width" type="System.Int32, mscorlib"> <data name="colFilename.Width" type="System.Int32, mscorlib">
<value>303</value> <value>683</value>
</data> </data>
<data name="colCreatedAt.Caption" xml:space="preserve"> <data name="colCreatedAt.Caption" xml:space="preserve">
<value>Eingegangen</value> <value>Eingegangen</value>
@@ -169,7 +169,7 @@
<value>True</value> <value>True</value>
</data> </data>
<data name="colCreatedAt.Width" type="System.Int32, mscorlib"> <data name="colCreatedAt.Width" type="System.Int32, mscorlib">
<value>303</value> <value>299</value>
</data> </data>
<data name="colMandator.Caption" xml:space="preserve"> <data name="colMandator.Caption" xml:space="preserve">
<value>Mandant</value> <value>Mandant</value>
@@ -184,14 +184,23 @@
<data name="cmbMandators.Items" xml:space="preserve"> <data name="cmbMandators.Items" xml:space="preserve">
<value>SIVT</value> <value>SIVT</value>
</data> </data>
<data name="colMandator.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="colMandator.Width" type="System.Int32, mscorlib"> <data name="colMandator.Width" type="System.Int32, mscorlib">
<value>144</value> <value>384</value>
</data> </data>
<data name="gridBand3.Name" xml:space="preserve"> <data name="GridBand2.Name" xml:space="preserve">
<value>gridBand3</value> <value>GridBand2</value>
</data> </data>
<data name="gridBand3.Width" type="System.Int32, mscorlib"> <data name="GridBand2.Width" type="System.Int32, mscorlib">
<value>303</value> <value>683</value>
</data>
<data name="BandedGridColumn1.Caption" xml:space="preserve">
<value>BandedGridColumn1</value>
</data>
<data name="BandedGridColumn1.Visible" type="System.Boolean, mscorlib">
<value>True</value>
</data> </data>
<data name="txtVersion.Caption" xml:space="preserve"> <data name="txtVersion.Caption" xml:space="preserve">
<value>Version 1.0.0.0</value> <value>Version 1.0.0.0</value>
@@ -262,6 +271,9 @@
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>1215, 746</value> <value>1215, 746</value>
</data> </data>
<data name="BarButtonItem1.Caption" xml:space="preserve">
<value>BarButtonItem1</value>
</data>
<data name="RibbonStatusBar.Location" type="System.Drawing.Point, System.Drawing"> <data name="RibbonStatusBar.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 722</value> <value>0, 722</value>
</data> </data>
@@ -311,24 +323,12 @@
<data name="&gt;&gt;GridViewFiles.Type" xml:space="preserve"> <data name="&gt;&gt;GridViewFiles.Type" xml:space="preserve">
<value>DevExpress.XtraGrid.Views.BandedGrid.AdvBandedGridView, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value> <value>DevExpress.XtraGrid.Views.BandedGrid.AdvBandedGridView, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data> </data>
<data name="&gt;&gt;gridBand1.Name" xml:space="preserve">
<value>gridBand1</value>
</data>
<data name="&gt;&gt;gridBand1.Type" xml:space="preserve">
<value>DevExpress.XtraGrid.Views.BandedGrid.GridBand, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;colSelected.Name" xml:space="preserve"> <data name="&gt;&gt;colSelected.Name" xml:space="preserve">
<value>colSelected</value> <value>colSelected</value>
</data> </data>
<data name="&gt;&gt;colSelected.Type" xml:space="preserve"> <data name="&gt;&gt;colSelected.Type" xml:space="preserve">
<value>DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value> <value>DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data> </data>
<data name="&gt;&gt;gridBand3.Name" xml:space="preserve">
<value>gridBand3</value>
</data>
<data name="&gt;&gt;gridBand3.Type" xml:space="preserve">
<value>DevExpress.XtraGrid.Views.BandedGrid.GridBand, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;colFilename.Name" xml:space="preserve"> <data name="&gt;&gt;colFilename.Name" xml:space="preserve">
<value>colFilename</value> <value>colFilename</value>
</data> </data>
@@ -353,6 +353,12 @@
<data name="&gt;&gt;cmbMandators.Type" xml:space="preserve"> <data name="&gt;&gt;cmbMandators.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value> <value>DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data> </data>
<data name="&gt;&gt;BandedGridColumn1.Name" xml:space="preserve">
<value>BandedGridColumn1</value>
</data>
<data name="&gt;&gt;BandedGridColumn1.Type" xml:space="preserve">
<value>DevExpress.XtraGrid.Views.BandedGrid.BandedGridColumn, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;txtVersion.Name" xml:space="preserve"> <data name="&gt;&gt;txtVersion.Name" xml:space="preserve">
<value>txtVersion</value> <value>txtVersion</value>
</data> </data>
@@ -581,6 +587,24 @@
<data name="&gt;&gt;SplashScreenManager.Type" xml:space="preserve"> <data name="&gt;&gt;SplashScreenManager.Type" xml:space="preserve">
<value>DevExpress.XtraSplashScreen.SplashScreenManager, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value> <value>DevExpress.XtraSplashScreen.SplashScreenManager, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data> </data>
<data name="&gt;&gt;gridBand1.Name" xml:space="preserve">
<value>gridBand1</value>
</data>
<data name="&gt;&gt;gridBand1.Type" xml:space="preserve">
<value>DevExpress.XtraGrid.Views.BandedGrid.GridBand, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;GridBand2.Name" xml:space="preserve">
<value>GridBand2</value>
</data>
<data name="&gt;&gt;GridBand2.Type" xml:space="preserve">
<value>DevExpress.XtraGrid.Views.BandedGrid.GridBand, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;BarButtonItem1.Name" xml:space="preserve">
<value>BarButtonItem1</value>
</data>
<data name="&gt;&gt;BarButtonItem1.Type" xml:space="preserve">
<value>DevExpress.XtraBars.BarButtonItem, DevExpress.XtraBars.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve"> <data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>frmImportMain</value> <value>frmImportMain</value>
</data> </data>

View File

@@ -76,7 +76,7 @@ Public Class frmImportMain
GridViewFiles.OptionsView.ShowAutoFilterRow = False GridViewFiles.OptionsView.ShowAutoFilterRow = False
FileEx = New DigitalData.Modules.Filesystem.File(LogConfig) FileEx = New DigitalData.Modules.Filesystem.File(LogConfig)
Winline = New WinlineData(LogConfig, Database, ConfigManager.Config) Winline = New WinlineData(LogConfig, Database, ConfigManager.Config, My.MappingConfiguration, My.MandatorConfiguration)
WebService = New WebServiceData(LogConfig, ConfigManager.Config, Application.UserAppDataPath) WebService = New WebServiceData(LogConfig, ConfigManager.Config, Application.UserAppDataPath)
AddHandler WebService.WebServiceProgress, AddressOf WebService_Progress AddHandler WebService.WebServiceProgress, AddressOf WebService_Progress
@@ -238,7 +238,11 @@ Public Class frmImportMain
SplashScreenManager.SetWaitFormDescription(oMessage) SplashScreenManager.SetWaitFormDescription(oMessage)
End Sub End Sub
If DocumentLoader.LoadFiles(ConfigManager.Config.InputDirectory, CurrentTemplate, lookupMandator.EditValue) Then If DocumentLoader.LoadFiles(
ConfigManager.Config.InputDirectory,
CurrentTemplate,
lookupMandator.EditValue
) Then
GridControlFiles.DataSource = Nothing GridControlFiles.DataSource = Nothing
GridControlFiles.DataSource = DocumentLoader.Files GridControlFiles.DataSource = DocumentLoader.Files
@@ -272,7 +276,6 @@ Public Class frmImportMain
Try Try
If oResult = DialogResult.Yes Then If oResult = DialogResult.Yes Then
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle) Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle)
Dim oNewDocument = DocumentLoader.LoadFile(oDocument.File, CurrentTemplate, lookupMandator.EditValue) Dim oNewDocument = DocumentLoader.LoadFile(oDocument.File, CurrentTemplate, lookupMandator.EditValue)
Dim oIndex = DocumentLoader.Files.IndexOf(oDocument) Dim oIndex = DocumentLoader.Files.IndexOf(oDocument)
DocumentLoader.Files.Item(oIndex) = oNewDocument DocumentLoader.Files.Item(oIndex) = oNewDocument

View File

@@ -56,10 +56,12 @@ Public Class frmMain
Await TemplateLoader.LoadTemplates() Await TemplateLoader.LoadTemplates()
Await TemplateLoader.LoadTemplateConfiguration() Await TemplateLoader.LoadTemplateConfiguration()
Await TemplateLoader.LoadMappingConfiguration() Await TemplateLoader.LoadMappingConfiguration()
Await TemplateLoader.LoadMandatorConfiguration()
' Save Schema data in 'My' Namespace ' Save Schema data in 'My' Namespace
My.MappingConfiguration = TemplateLoader.MappingConfiguration My.MappingConfiguration = TemplateLoader.MappingConfiguration
My.TemplateConfiguration = TemplateLoader.TemplateConfiguration My.TemplateConfiguration = TemplateLoader.TemplateConfiguration
My.MandatorConfiguration = TemplateLoader.MandatorConfiguration
Dim oBindingSource = New BindingList(Of Template) Dim oBindingSource = New BindingList(Of Template)
For Each oTemplate As Template In TemplateLoader.TemplateList For Each oTemplate As Template In TemplateLoader.TemplateList

View File

@@ -14,6 +14,35 @@
Public Const DB_TYPE_DECIMAL = "DECIMAL" Public Const DB_TYPE_DECIMAL = "DECIMAL"
Public Const DB_TYPE_BOOLEAN = "BOOLEAN" Public Const DB_TYPE_BOOLEAN = "BOOLEAN"
Public Const ALL_MESOCOMP = "mesocomp"
Public Const V21_ARTICLENUMBER = "c002"
Public Const V21_ARTICLEDESCRIPTION = "c003"
Public Const V21_MAINARTICLENUMBER = "c011"
Public Const V21_REPLACEMENTARTICLENUMBER = "c123"
Public Const V21_EAN = "c075"
Public Const V50_ACCOUNTNUMBER = "c002"
Public Const V50_ACCOUNTNAME = "c003"
Public Const V50_STREETNAME = "c050"
Public Const V50_ZIPCODE = "c051"
Public Const V50_CITYNAME = "c052"
Public Const V50_GLN = "c260"
Public Const T45_KEY = "c000"
Public Const T45_NAME = "c001"
Public Const T45_CONTACTNUMBER = "c063"
Public Const V05_ACCOUNTID = "c002"
Public Const V05_ACCOUNTNAME = "c003"
Public Const T357_KINDID = "c030"
Public Const T357_KINDNAME = "c001"
Public Const T01_DATABASEINFO = "c004"
Public Const T01_MANDATORID = "c000"
Public Const T01_MANDATORNAME = "c003"
Public Enum ColumnType As Integer Public Enum ColumnType As Integer
[String] [String]
[Integer] [Integer]

View File

@@ -23,7 +23,7 @@ Namespace Documents
Public ReadOnly Property HasErrors As Boolean Public ReadOnly Property HasErrors As Boolean
Get Get
Return Rows.Any(Function(r As DocumentRow) r.HasErrors) Return Mandator Is Nothing Or Rows.Any(Function(r As DocumentRow) r.HasErrors)
End Get End Get
End Property End Property

View File

@@ -49,6 +49,7 @@ Namespace Documents
oInfo.FilesTotal = oFiles.Count oInfo.FilesTotal = oFiles.Count
RaiseEvent FileLoadComplete(Me, oInfo) RaiseEvent FileLoadComplete(Me, oInfo)
Catch ex As MissingAttributeException Catch ex As MissingAttributeException
Logger.Error(ex) Logger.Error(ex)
Throw New DocumentLoaderException($"Missing Attribute '{ex.Message}' in File '{oFile.Name}'") Throw New DocumentLoaderException($"Missing Attribute '{ex.Message}' in File '{oFile.Name}'")
@@ -270,12 +271,11 @@ Namespace Documents
If oMandator Is Nothing Then If oMandator Is Nothing Then
Logger.Warn("Mandator not found for File [{0}]", pDocument.File.Name) Logger.Warn("Mandator not found for File [{0}]", pDocument.File.Name)
Throw New Exceptions.NoMandatorException($"Mandator not found for file [{pDocument.File.Name}]") Else
pDocument = MatchDocumentData(pDocument, oMandator, pTemplate)
End If End If
pDocument = MatchDocumentData(pDocument, oMandator, pTemplate)
pDocument.Mandator = oMandator pDocument.Mandator = oMandator
Return pDocument Return pDocument
End Function End Function

View File

@@ -0,0 +1,2 @@
Friend Class Helpers
End Class

View File

@@ -104,6 +104,7 @@
<Compile Include="Documents\DocumentType.vb" /> <Compile Include="Documents\DocumentType.vb" />
<Compile Include="Documents\DocumentLoader.vb" /> <Compile Include="Documents\DocumentLoader.vb" />
<Compile Include="Exceptions.vb" /> <Compile Include="Exceptions.vb" />
<Compile Include="Helpers.vb" />
<Compile Include="IDictionaryEx.vb" /> <Compile Include="IDictionaryEx.vb" />
<Compile Include="IEnumerableEx.vb" /> <Compile Include="IEnumerableEx.vb" />
<Compile Include="Mapper.vb" /> <Compile Include="Mapper.vb" />
@@ -123,7 +124,10 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<Compile Include="Templates\MandatorConfig.vb" />
<Compile Include="Templates\MandatorConfigItem.vb" />
<Compile Include="Templates\MappingConfig.vb" /> <Compile Include="Templates\MappingConfig.vb" />
<Compile Include="Templates\MappingConfigItem.vb" />
<Compile Include="Report\ReportHead.vb" /> <Compile Include="Report\ReportHead.vb" />
<Compile Include="Report\ReportPosition.vb" /> <Compile Include="Report\ReportPosition.vb" />
<Compile Include="Report\ReportSource.vb" /> <Compile Include="Report\ReportSource.vb" />
@@ -138,7 +142,7 @@
<Compile Include="Winline\Entities\Contact.vb" /> <Compile Include="Winline\Entities\Contact.vb" />
<Compile Include="Winline\Entities\DocumentKind.vb" /> <Compile Include="Winline\Entities\DocumentKind.vb" />
<Compile Include="Winline\Entities\Mandator.vb" /> <Compile Include="Winline\Entities\Mandator.vb" />
<Compile Include="Templates\ColumnConfig.vb" /> <Compile Include="Templates\TemplateConfigItem.vb" />
<Compile Include="Winline\WebServiceData.vb" /> <Compile Include="Winline\WebServiceData.vb" />
<Compile Include="XmlData.vb" /> <Compile Include="XmlData.vb" />
</ItemGroup> </ItemGroup>

View File

@@ -0,0 +1,5 @@
Namespace Templates
Public Class MandatorConfig
Public Property Items As New List(Of MandatorConfigItem)
End Class
End Namespace

View File

@@ -0,0 +1,7 @@
Namespace Templates
Public Class MandatorConfigItem
Public Property Name As String
Public Property OrderKey As Integer
End Class
End Namespace

View File

@@ -1,12 +1,6 @@
Namespace Templates Namespace Templates
Public Class MappingConfig Public Class MappingConfig
Public Property OrderKey As Integer Public Property Items As New List(Of MappingConfigItem)
Public Property SourceName As String
Public Property SourceItem As String
Public Property SourceRegex As String
Public Property DestinationName As String
Public Property DestinationItem As String
Public Property DestinationValue As String
End Class End Class
End Namespace End Namespace

View File

@@ -0,0 +1,12 @@
Namespace Templates
Public Class MappingConfigItem
Public Property OrderKey As Integer
Public Property SourceName As String
Public Property SourceItem As String
Public Property SourceRegex As String
Public Property DestinationName As String
Public Property DestinationItem As String
Public Property DestinationValue As String
End Class
End Namespace

View File

@@ -19,7 +19,7 @@
''' Required value from Schema. This value will be written in the ColumnConfig and is not relevant from that point on. ''' Required value from Schema. This value will be written in the ColumnConfig and is not relevant from that point on.
''' </summary> ''' </summary>
Public Property IsRequired As Boolean Public Property IsRequired As Boolean
Public Property Config As ColumnConfig Public Property Config As TemplateConfigItem
End Class End Class
End Class End Class
End Namespace End Namespace

View File

@@ -6,10 +6,10 @@ Namespace Templates
''' Class for loading column/field config from database ''' Class for loading column/field config from database
''' </summary> ''' </summary>
Public Class TemplateConfig Public Class TemplateConfig
Public Columns As List(Of ColumnConfig) Public Property Items As List(Of TemplateConfigItem)
Public Function GetColumn(pName As String) As ColumnConfig Public Function GetColumn(pName As String) As TemplateConfigItem
Return Columns. Return Items.
Where(Function(c) c.Name = pName). Where(Function(c) c.Name = pName).
FirstOrDefault() FirstOrDefault()
End Function End Function

View File

@@ -1,7 +1,7 @@
Imports MultiTool.Shared.Constants Imports MultiTool.Shared.Constants
Namespace Templates Namespace Templates
Public Class ColumnConfig Public Class TemplateConfigItem
Public Property Name As String Public Property Name As String
Public Property Table As String Public Property Table As String
Public Property Type As ColumnType Public Property Type As ColumnType

View File

@@ -1,8 +1,6 @@
Imports System.IO Imports System.IO
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports MultiTool.Shared.Winline
Imports MultiTool.Shared.Helpers
Namespace Templates Namespace Templates
Public Class TemplateLoader Public Class TemplateLoader
@@ -12,12 +10,15 @@ Namespace Templates
Public Property TemplateList As List(Of Template) Public Property TemplateList As List(Of Template)
Public Property TemplateConfiguration As New TemplateConfig Public Property TemplateConfiguration As New TemplateConfig
Public Property MappingConfiguration As New List(Of MappingConfig) Public Property MappingConfiguration As New MappingConfig
Public Property MandatorConfiguration As New MandatorConfig
Private ReadOnly Database As MSSQLServer Private ReadOnly Database As MSSQLServer
Private Const VWEDI_XML_ITEMS = "VWEDI_XML_ITEMS" Private Const VWEDI_XML_ITEMS = "VWEDI_XML_ITEMS"
Private Const VWEDI_XML_MAPPING = "VWEDI_XML_MAPPING" Private Const VWEDI_XML_MAPPING = "VWEDI_XML_MAPPING"
Private Const TBEDI_XML_MANDATORS = "TBEDI_XML_MANDATORS"
Private Const TBEDI_XML_TEMPLATES = "TBEDI_XML_TEMPLATES"
Public Sub New(pLogConfig As LogConfig, pMSSQL As MSSQLServer) Public Sub New(pLogConfig As LogConfig, pMSSQL As MSSQLServer)
MyBase.New(pLogConfig, pLogConfig.GetLogger) MyBase.New(pLogConfig, pLogConfig.GetLogger)
@@ -26,7 +27,7 @@ Namespace Templates
Public Async Function LoadTemplates() As Task(Of Boolean) Public Async Function LoadTemplates() As Task(Of Boolean)
Try Try
Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[TBEDI_XML_TEMPLATES]" Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{TBEDI_XML_TEMPLATES}]"
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql) Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql)
Dim oTemplates As New List(Of Template) Dim oTemplates As New List(Of Template)
@@ -55,10 +56,10 @@ Namespace Templates
Try Try
Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{VWEDI_XML_MAPPING}]" Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{VWEDI_XML_MAPPING}]"
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql) Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql)
Dim oMappingConfigList As New List(Of MappingConfig) Dim oMappingConfig As New MappingConfig
For Each oRow As DataRow In oTable.Rows For Each oRow As DataRow In oTable.Rows
Dim oTemplate As New MappingConfig With { Dim oTemplate As New MappingConfigItem With {
.OrderKey = oRow.ItemEx("ORDER_KEY", String.Empty), .OrderKey = oRow.ItemEx("ORDER_KEY", String.Empty),
.SourceName = oRow.ItemEx("SOURCE_NAME", String.Empty), .SourceName = oRow.ItemEx("SOURCE_NAME", String.Empty),
.SourceItem = oRow.ItemEx("SOURCE_ITEM", String.Empty), .SourceItem = oRow.ItemEx("SOURCE_ITEM", String.Empty),
@@ -68,10 +69,35 @@ Namespace Templates
.DestinationValue = oRow.ItemEx("DESTINATION_VALUE", String.Empty) .DestinationValue = oRow.ItemEx("DESTINATION_VALUE", String.Empty)
} }
oMappingConfigList.Add(oTemplate) oMappingConfig.Items.Add(oTemplate)
Next Next
MappingConfiguration = oMappingConfigList MappingConfiguration = oMappingConfig
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Public Async Function LoadMandatorConfiguration() As Task(Of Boolean)
Try
Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{TBEDI_XML_MANDATORS}] ORDER BY ORDER_KEY"
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql)
Dim oMandatorConfig As New MandatorConfig
For Each oRow As DataRow In oTable.Rows
Dim oMandator As New MandatorConfigItem With {
.OrderKey = oRow.ItemEx("ORDER_KEY", String.Empty),
.Name = oRow.ItemEx("NAME", String.Empty)
}
oMandatorConfig.Items.Add(oMandator)
Next
MandatorConfiguration = oMandatorConfig
Return True Return True
Catch ex As Exception Catch ex As Exception
@@ -85,20 +111,20 @@ Namespace Templates
Try Try
Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{VWEDI_XML_ITEMS}]" Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{VWEDI_XML_ITEMS}]"
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql) Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql)
Dim oItems As New List(Of ColumnConfig) Dim oItems As New List(Of TemplateConfigItem)
For Each oRow As DataRow In oTable.Rows For Each oRow As DataRow In oTable.Rows
Dim oColumn As New ColumnConfig() With { Dim oColumn As New TemplateConfigItem() With {
.Template = oRow.ItemEx("TEMPLATE_NAME", String.Empty), .Template = oRow.ItemEx("TEMPLATE_NAME", String.Empty),
.Table = oRow.ItemEx("XML_TABLE", String.Empty), .Table = oRow.ItemEx("XML_TABLE", String.Empty),
.Name = oRow.ItemEx("XML_ITEM", String.Empty), .Name = oRow.ItemEx("XML_ITEM", String.Empty),
.Type = ColumnConfig.ConvertType(ItemEx(oRow, "DATA_TYPE", String.Empty)), .Type = TemplateConfigItem.ConvertType(ItemEx(oRow, "DATA_TYPE", String.Empty)),
.OrderKey = oRow.ItemEx("ORDER_KEY", 0), .OrderKey = oRow.ItemEx("ORDER_KEY", 0),
.IsReadOnly = oRow.ItemEx("IS_READ_ONLY", False), .IsReadOnly = oRow.ItemEx("IS_READ_ONLY", False),
.IsVisible = oRow.ItemEx("IS_VISIBLE", True), .IsVisible = oRow.ItemEx("IS_VISIBLE", True),
.IsRequired = oRow.ItemEx("IS_REQUIRED", False), .IsRequired = oRow.ItemEx("IS_REQUIRED", False),
.IsHead = oRow.ItemEx("IS_HEAD", True), .IsHead = oRow.ItemEx("IS_HEAD", True),
.[Function] = New ColumnConfig.ColumnFunction With { .[Function] = New TemplateConfigItem.ColumnFunction With {
.Id = oRow.ItemEx("FUNCTION_ID", 0), .Id = oRow.ItemEx("FUNCTION_ID", 0),
.Name = oRow.ItemEx("FUNCTION_NAME", String.Empty), .Name = oRow.ItemEx("FUNCTION_NAME", String.Empty),
.Params = oRow.ItemEx("FUNCTION_PARAMETERS", String.Empty) .Params = oRow.ItemEx("FUNCTION_PARAMETERS", String.Empty)
@@ -109,7 +135,7 @@ Namespace Templates
Next Next
TemplateConfiguration = New TemplateConfig With { TemplateConfiguration = New TemplateConfig With {
.Columns = oItems .Items = oItems
} }
Return True Return True
@@ -173,7 +199,7 @@ Namespace Templates
Dim oConfig = pTemplateConfig.GetColumn(oColumn.Name) Dim oConfig = pTemplateConfig.GetColumn(oColumn.Name)
If oConfig Is Nothing Then If oConfig Is Nothing Then
oConfig = New ColumnConfig With { oConfig = New TemplateConfigItem With {
.IsRequired = oColumn.IsRequired, .IsRequired = oColumn.IsRequired,
.Name = oColumn.Name .Name = oColumn.Name
} }

View File

@@ -1,8 +1,9 @@
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
Imports MultiTool.Shared.Helpers
Imports MultiTool.Shared.Winline.Entities Imports MultiTool.Shared.Winline.Entities
Imports System.Text.RegularExpressions Imports System.Text.RegularExpressions
Imports MultiTool.Shared.Templates
Imports MultiTool.Shared.Constants
Namespace Winline Namespace Winline
Public Class WinlineData Public Class WinlineData
@@ -10,6 +11,8 @@ Namespace Winline
Private ReadOnly Database As MSSQLServer Private ReadOnly Database As MSSQLServer
Private ReadOnly Config As Config Private ReadOnly Config As Config
Private ReadOnly MandatorConfig As MandatorConfig
Private ReadOnly MappingConfig As MappingConfig
Public Articles As New List(Of Article) Public Articles As New List(Of Article)
Public Accounts As New List(Of Account) Public Accounts As New List(Of Account)
@@ -18,39 +21,12 @@ Namespace Winline
Public Years As List(Of Integer) Public Years As List(Of Integer)
Public Const ALL_MESOCOMP = "mesocomp" Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As Config, pMappingConfig As MappingConfig, pMandatorConfig As MandatorConfig)
Public Const V21_ARTICLENUMBER = "c002"
Public Const V21_ARTICLEDESCRIPTION = "c003"
Public Const V21_MAINARTICLENUMBER = "c011"
Public Const V21_REPLACEMENTARTICLENUMBER = "c123"
Public Const V21_EAN = "c075"
Public Const V50_ACCOUNTNUMBER = "c002"
Public Const V50_ACCOUNTNAME = "c003"
Public Const V50_STREETNAME = "c050"
Public Const V50_ZIPCODE = "c051"
Public Const V50_CITYNAME = "c052"
Public Const V50_GLN = "c260"
Public Const T45_KEY = "c000"
Public Const T45_NAME = "c001"
Public Const T45_CONTACTNUMBER = "c063"
Public Const V05_ACCOUNTID = "c002"
Public Const V05_ACCOUNTNAME = "c003"
Public Const T357_KINDID = "c030"
Public Const T357_KINDNAME = "c001"
Public Const T01_DATABASEINFO = "c004"
Public Const T01_MANDATORID = "c000"
Public Const T01_MANDATORNAME = "c003"
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As Config)
MyBase.New(pLogConfig, pLogConfig.GetLogger()) MyBase.New(pLogConfig, pLogConfig.GetLogger())
Database = pDatabase Database = pDatabase
Config = pConfig Config = pConfig
MandatorConfig = pMandatorConfig
MappingConfig = pMappingConfig
End Sub End Sub
<DebuggerStepThrough> <DebuggerStepThrough>
@@ -165,17 +141,14 @@ Namespace Winline
.Server = oDbInfo.Item2 .Server = oDbInfo.Item2
} }
'Dim oMandatorConfig As Config.MandatorConfig = Config.Mandators. Dim oMandatorConfig As MandatorConfigItem = MandatorConfig.Items.
' Where(Function(m) oMandator.Id = m.Name). Where(Function(item) item.Name = oMandator.Id).
' SingleOrDefault() SingleOrDefault()
'Dim oMandatorConfig2 = MappingConfiguration.Where(Function(c) c.) If oMandatorConfig IsNot Nothing Then
oMandator.IsWhitelisted = True
'If oMandatorConfig IsNot Nothing Then oMandator.Order = oMandatorConfig.OrderKey
' oMandator.IsWhitelisted = True End If
' oMandator.Regex = oMandatorConfig.ArticleRegex
' oMandator.Order = oMandatorConfig.Order
'End If
Mandators.Add(oMandator) Mandators.Add(oMandator)
Next Next
@@ -411,17 +384,20 @@ Namespace Winline
If p.Fields.ContainsKey("Artikelnummer") Then If p.Fields.ContainsKey("Artikelnummer") Then
Return p.Fields.Item("Artikelnummer").Original Return p.Fields.Item("Artikelnummer").Original
Else Else
' TODO: Throw or ignore? Return Nothing
Throw New Exceptions.MissingAttributeException("Artikelnummer")
End If End If
End Function). End Function).
Where(Function(ean) ean IsNot Nothing).
Distinct(). Distinct().
ToList() ToList()
Dim oYear = GetWinLineYear() Dim oYear = GetWinLineYear()
Dim oMandatorId As String = String.Empty Dim oMandatorId As String = String.Empty
' TODO: Instead load whitelisted mandators from database
Dim oWhitelistedMandators = Mandators. Dim oWhitelistedMandators = Mandators.
Where(Function(m) m.IsWhitelisted = True). Where(Function(m) m.IsWhitelisted = True).
OrderBy(Function(m) m.Order).
ToList() ToList()
For Each oEANNumber In oEANNumbers For Each oEANNumber In oEANNumbers
@@ -453,15 +429,19 @@ Namespace Winline
Dim oArticleNumber As String = ItemEx(oRow, V21_MAINARTICLENUMBER, String.Empty) Dim oArticleNumber As String = ItemEx(oRow, V21_MAINARTICLENUMBER, String.Empty)
' EAN was found, now we need to check it against the Regex of the current Mandantor, if one exists ' EAN was found, now we need to check it against the Regex of the current Mandantor, if one exists
If oMandator.Regex <> String.Empty Then Dim oMappingConfigItem = MappingConfig.Items.
Where(Function(item) item.DestinationName = "MANDATOR" And item.DestinationValue = oMandator.Id And item.SourceName = "ARTICLE").
SingleOrDefault()
If oMappingConfigItem IsNot Nothing Then
Try Try
Dim oRegex As New Regex(oMandator.Regex) Dim oRegex As New Regex(oMappingConfigItem.SourceRegex)
Dim oMatch = oRegex.Match(oArticleNumber) Dim oMatch = oRegex.Match(oArticleNumber)
' If ArticleNumber matches the regex, we assign it and exit ' If ArticleNumber matches the regex, we assign it and exit
If oMatch.Success Then If oMatch.Success Then
oMandatorId = oMandator.Id Return oMandator
Exit For
Else Else
' If it does not match, continue to the next mandator ' If it does not match, continue to the next mandator
End If End If
@@ -469,21 +449,15 @@ Namespace Winline
Logger.Error(ex) Logger.Error(ex)
Logger.Warn("Regex [{0}] could not be parsed. Skipping.", oMandator.Regex) Logger.Warn("Regex [{0}] could not be parsed. Skipping.", oMandator.Regex)
End Try End Try
Else Else
' If no regex was found, we assume the number matches Continue For
oMandatorId = oMandator.Id
End If End If
Next Next
Next Next
If oMandatorId = String.Empty Then Return Nothing
Return Nothing
Else
Return oWhitelistedMandators.
Where(Function(m) m.Id = oMandatorId).
Take(1).
SingleOrDefault()
End If
End Function End Function
''' <summary> ''' <summary>