From 0b83ddcc4d18ceecfba5c193f1f40cef64c5c32e Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 28 Oct 2021 14:04:56 +0200 Subject: [PATCH] WIP --- EDIDocumentImport/ImporterForm.vbproj | 1 + .../My Project/Resources.Designer.vb | 10 +++ EDIDocumentImport/My Project/Resources.resx | 31 ++++---- EDIDocumentImport/Resources/redo.svg | 7 ++ EDIDocumentImport/frmImportMain.Designer.vb | 8 +++ EDIDocumentImport/frmImportMain.resx | 3 + EDIDocumentImport/frmImportMain.vb | 22 ++++++ EDIDocumentImport/frmRowEditor.Designer.vb | 8 ++- EDIDocumentImport/frmRowEditor.resx | 32 +++++++++ EDIDocumentImport/frmRowEditor.vb | 71 ++++++++++++------- ImporterShared/Documents/Document.vb | 4 +- ImporterShared/Documents/DocumentLoader.vb | 16 +++-- ImporterShared/Documents/DocumentRow.vb | 2 +- 13 files changed, 165 insertions(+), 50 deletions(-) create mode 100644 EDIDocumentImport/Resources/redo.svg diff --git a/EDIDocumentImport/ImporterForm.vbproj b/EDIDocumentImport/ImporterForm.vbproj index 2c2b70d..2c563b2 100644 --- a/EDIDocumentImport/ImporterForm.vbproj +++ b/EDIDocumentImport/ImporterForm.vbproj @@ -262,6 +262,7 @@ + diff --git a/EDIDocumentImport/My Project/Resources.Designer.vb b/EDIDocumentImport/My Project/Resources.Designer.vb index feca4b6..32ffec8 100644 --- a/EDIDocumentImport/My Project/Resources.Designer.vb +++ b/EDIDocumentImport/My Project/Resources.Designer.vb @@ -260,6 +260,16 @@ Namespace My.Resources End Get End Property + ''' + ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. + ''' + Friend ReadOnly Property redo() As DevExpress.Utils.Svg.SvgImage + Get + Dim obj As Object = ResourceManager.GetObject("redo", resourceCulture) + Return CType(obj,DevExpress.Utils.Svg.SvgImage) + End Get + End Property + ''' ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. ''' diff --git a/EDIDocumentImport/My Project/Resources.resx b/EDIDocumentImport/My Project/Resources.resx index 3535f98..967ef32 100644 --- a/EDIDocumentImport/My Project/Resources.resx +++ b/EDIDocumentImport/My Project/Resources.resx @@ -121,9 +121,6 @@ ..\Resources\logical.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\togglefieldcodes.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - ..\Resources\wraptext.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -145,12 +142,15 @@ ..\Resources\actions_checkcircled.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\bo_validation.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\togglefieldcodes.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\open21.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\parameters.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\paymentrefund.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -163,8 +163,8 @@ ..\Resources\up.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\resetview.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\singlepageview.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\open1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -172,15 +172,12 @@ ..\Resources\export.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\import.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\bo_validation.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\rotatecounterclockwise.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\singlepageview.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - ..\Resources\actions_arrow4down.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -196,16 +193,22 @@ ..\Resources\open22.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\import.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\pagesetup.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\open.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\resetview.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\itemtypechecked.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\parameters.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\redo.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a \ No newline at end of file diff --git a/EDIDocumentImport/Resources/redo.svg b/EDIDocumentImport/Resources/redo.svg new file mode 100644 index 0000000..917784e --- /dev/null +++ b/EDIDocumentImport/Resources/redo.svg @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/EDIDocumentImport/frmImportMain.Designer.vb b/EDIDocumentImport/frmImportMain.Designer.vb index 7e5a8cc..178d30c 100644 --- a/EDIDocumentImport/frmImportMain.Designer.vb +++ b/EDIDocumentImport/frmImportMain.Designer.vb @@ -22,7 +22,9 @@ Partial Class frmImportMain 'Do not modify it using the code editor. Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmImportMain)) + Dim SnapOptions1 As DevExpress.Utils.Controls.SnapOptions = New DevExpress.Utils.Controls.SnapOptions() Me.RibbonControl = New DevExpress.XtraBars.Ribbon.RibbonControl() Me.txtVersion = New DevExpress.XtraBars.BarStaticItem() Me.txtFilesLoaded = New DevExpress.XtraBars.BarStaticItem() @@ -65,6 +67,7 @@ Partial Class frmImportMain Me.SplitContainerGrids = New DevExpress.XtraEditors.SplitContainerControl() Me.SplitContainerGrids1 = New DevExpress.XtraEditors.SplitContainerControl() Me.SplitContainerGrids2 = New DevExpress.XtraEditors.SplitContainerControl() + Me.BehaviorManager = New DevExpress.Utils.Behaviors.BehaviorManager(Me.components) CType(Me.RibbonControl, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.RepositoryItemComboBox1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -84,6 +87,7 @@ Partial Class frmImportMain Me.SplitContainerGrids1.SuspendLayout() CType(Me.SplitContainerGrids2, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainerGrids2.SuspendLayout() + CType(Me.BehaviorManager, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'RibbonControl @@ -265,6 +269,7 @@ Partial Class frmImportMain 'SplitContainerControl1 ' Me.SplitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill + Me.SplitContainerControl1.Enabled = False Me.SplitContainerControl1.Location = New System.Drawing.Point(0, 158) Me.SplitContainerControl1.Name = "SplitContainerControl1" Me.SplitContainerControl1.Panel1.Controls.Add(Me.GridControlFiles) @@ -470,6 +475,7 @@ Partial Class frmImportMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.BehaviorManager.SetBehaviors(Me, New DevExpress.Utils.Behaviors.Behavior() {CType(DevExpress.Utils.Behaviors.Common.SnapWindowBehavior.Create(GetType(DevExpress.Utils.BehaviorSource.SnapWindowBehaviorSourceForForm), SnapOptions1), DevExpress.Utils.Behaviors.Behavior)}) Me.ClientSize = New System.Drawing.Size(1215, 746) Me.Controls.Add(Me.SplitContainerControl1) Me.Controls.Add(Me.RibbonStatusBar) @@ -498,6 +504,7 @@ Partial Class frmImportMain Me.SplitContainerGrids1.ResumeLayout(False) CType(Me.SplitContainerGrids2, System.ComponentModel.ISupportInitialize).EndInit() Me.SplitContainerGrids2.ResumeLayout(False) + CType(Me.BehaviorManager, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -545,4 +552,5 @@ Partial Class frmImportMain Friend WithEvents GridLookUpEdit1View As GridView Friend WithEvents colId As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents colName As DevExpress.XtraGrid.Columns.GridColumn + Friend WithEvents BehaviorManager As DevExpress.Utils.Behaviors.BehaviorManager End Class diff --git a/EDIDocumentImport/frmImportMain.resx b/EDIDocumentImport/frmImportMain.resx index 072ab73..3b050d3 100644 --- a/EDIDocumentImport/frmImportMain.resx +++ b/EDIDocumentImport/frmImportMain.resx @@ -136,4 +136,7 @@ ZWVuIiAvPg0KICA8L2c+DQo8L3N2Zz4L + + 17, 17 + \ No newline at end of file diff --git a/EDIDocumentImport/frmImportMain.vb b/EDIDocumentImport/frmImportMain.vb index 70d9622..e0e5934 100644 --- a/EDIDocumentImport/frmImportMain.vb +++ b/EDIDocumentImport/frmImportMain.vb @@ -2,6 +2,7 @@ Imports System.IO Imports System.Net.Http Imports System.Xml +Imports DevExpress.Utils.Behaviors.Common Imports DevExpress.XtraGrid Imports DevExpress.XtraGrid.Views.Grid Imports DigitalData.Controls.SQLConfig @@ -36,6 +37,22 @@ Public Class frmImportMain Private CurrentDocument As Document + Public Sub New() + InitializeComponent() + BehaviorManager.Attach(Of PersistenceBehavior)(Me, AddressOf LoadPersistenceSettings) + End Sub + + Protected Overrides Sub OnLoad(e As EventArgs) + GridControlFiles.ForceInitialize() + MyBase.OnLoad(e) + End Sub + + Private Sub LoadPersistenceSettings(pBehaviour As PersistenceBehavior) + pBehaviour.Properties.StoreChildLayouts = DevExpress.Utils.DefaultBoolean.True + pBehaviour.Properties.Storage = Storage.File + pBehaviour.Properties.Path = Application.UserAppDataPath + End Sub + Private Sub frmImportMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try txtVersion.Caption = String.Format(txtVersion.Caption, Application.ProductVersion) @@ -204,6 +221,7 @@ Public Class frmImportMain Private Sub btnLoadFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnLoadFiles.ItemClick Try + SplitContainerControl1.Enabled = False If DocumentLoader.LoadFiles(ConfigManager.Config.InputDirectory, CurrentSchema, lookupMandator.EditValue) Then GridControlFiles.DataSource = DocumentLoader.Files txtFilesLoaded.Caption = String.Format(txtFilesLoaded.Tag.ToString, DocumentLoader.Files.Count) @@ -214,6 +232,8 @@ Public Class frmImportMain Catch ex As Exception ShowError(ex, "Laden der Dokumente") + Finally + SplitContainerControl1.Enabled = True End Try End Sub @@ -321,6 +341,7 @@ Public Class frmImportMain Try GridViewFiles.ShowLoadingPanel() SetDocumentButtonsEnabled(False) + btnLoadFiles.Enabled = False SplitContainerGrids.Enabled = False Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle) @@ -335,6 +356,7 @@ Public Class frmImportMain Finally SplitContainerGrids.Enabled = True + btnLoadFiles.Enabled = True SetDocumentButtonsEnabled(False) GridViewFiles.HideLoadingPanel() diff --git a/EDIDocumentImport/frmRowEditor.Designer.vb b/EDIDocumentImport/frmRowEditor.Designer.vb index 57f5671..833d77f 100644 --- a/EDIDocumentImport/frmRowEditor.Designer.vb +++ b/EDIDocumentImport/frmRowEditor.Designer.vb @@ -19,6 +19,7 @@ Partial Class frmRowEditor 'Do not modify it using the code editor. Private Sub InitializeComponent() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmRowEditor)) Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() Me.btnSave = New DevExpress.XtraBars.BarButtonItem() Me.btnApplyFromWinline = New DevExpress.XtraBars.BarButtonItem() @@ -69,9 +70,9 @@ Partial Class frmRowEditor ' 'btnApplyFromOriginal ' - Me.btnApplyFromOriginal.Caption = "Zurücksetzen" + Me.btnApplyFromOriginal.Caption = "Auf Originalwert setzen" Me.btnApplyFromOriginal.Id = 3 - Me.btnApplyFromOriginal.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.resetview + Me.btnApplyFromOriginal.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.redo Me.btnApplyFromOriginal.Name = "btnApplyFromOriginal" ' 'RibbonPage1 @@ -177,10 +178,11 @@ Partial Class frmRowEditor Me.Controls.Add(Me.GridControl1) Me.Controls.Add(Me.RibbonStatusBar1) Me.Controls.Add(Me.RibbonControl1) + Me.IconOptions.SvgImage = CType(resources.GetObject("frmRowEditor.IconOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.Name = "frmRowEditor" Me.Ribbon = Me.RibbonControl1 Me.StatusBar = Me.RibbonStatusBar1 - Me.Text = "frmRowEditor" + Me.Text = "Zeilen Editor" CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() diff --git a/EDIDocumentImport/frmRowEditor.resx b/EDIDocumentImport/frmRowEditor.resx index 1af7de1..1e55e8a 100644 --- a/EDIDocumentImport/frmRowEditor.resx +++ b/EDIDocumentImport/frmRowEditor.resx @@ -117,4 +117,36 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z + LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl + dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAIIFAAAC77u/ + PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi + IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv + MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh + Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg + MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLlllbGxvd3tmaWxsOiNGRkIxMTU7fQoJ + LlJlZHtmaWxsOiNEMTFDMUM7fQoJLkJsYWNre2ZpbGw6IzcyNzI3Mjt9CgkuQmx1ZXtmaWxsOiMxMTc3 + RDc7fQoJLldoaXRle2ZpbGw6I0ZGRkZGRjt9CgkuR3JlZW57ZmlsbDojMDM5QzIzO30KCS5zdDB7b3Bh + Y2l0eTowLjc1O30KCS5zdDF7b3BhY2l0eTowLjU7fQoJLnN0MntvcGFjaXR5OjAuMjU7fQoJLnN0M3tm + aWxsOiNGRkIxMTU7fQo8L3N0eWxlPg0KICA8ZyAvPg0KICA8ZyBpZD0iUmVuYW1lIj4NCiAgICA8cGF0 + aCBkPSJNMjEuNiwxMC4zYzAtMC43LTAuMy0xLjMtMC45LTEuN0MyMC4xLDguMiwxOS4xLDgsMTcuOSw4 + SDE0djkuOVYxOGg0YzEuMiwwLDIuMi0wLjIsMi45LTAuOCAgIEMyMS43LDE2LjYsMjIsMTYsMjIsMTVj + MC0wLjYtMC4yLTEuMi0wLjctMS42Yy0wLjUtMC40LTEuMS0wLjctMS44LTAuOGMwLjYtMC4yLDEuMS0w + LjUsMS41LTAuOUMyMS40LDExLjMsMjEuNiwxMC45LDIxLjYsMTAuM3ogICAgTTE2LjQsOS43aDAuOWMx + LjEsMCwxLjcsMC40LDEuNywxLjFjMCwwLjQtMC4xLDAuNy0wLjQsMC45QzE4LjQsMTEuOSwxOCwxMiwx + Ny41LDEyaC0xLjFWOS43eiBNMTksMTUuOGMtMC4zLDAuMi0wLjgsMC40LTEuMywwLjQgICBoLTEuM3Yt + Mi42aDEuM2MwLjUsMCwwLjksMC4xLDEuMywwLjNjMC4zLDAuMiwwLjUsMC42LDAuNSwwLjlDMTkuNSwx + NS4zLDE5LjQsMTUuNiwxOSwxNS44eiBNMTcuMiwyMkgxYy0wLjUsMC0xLTAuNS0xLTFWNSAgIGMwLTAu + NSwwLjUtMSwxLTFoMjRjMC41LDAsMSwwLjUsMSwxdjguMmwtMiwyVjZIMnYxNGgxNy4yTDE3LjIsMjJ6 + IE00LjEsMThoMi4ybDAuNi0yLjNoMy4ybDAuNiwyLjNIMTNMOS44LDhINy40TDQuMSwxOHogICAgTTgu + NCwxMC43YzAuMS0wLjMsMC4xLTAuNiwwLjEtMC45aDAuMWMwLDAuMywwLjEsMC42LDAuMSwwLjlsMSwz + LjNINy40TDguNCwxMC43eiIgY2xhc3M9IkJsYWNrIiAvPg0KICAgIDxwYXRoIGQ9Ik0yOSwyMWwtOCw4 + bC00LTRsOC04TDI5LDIxeiBNMzAsMjBsMS43LTEuN2MwLjQtMC40LDAuNC0xLDAtMS4zTDI5LDE0LjNj + LTAuNC0wLjQtMS0wLjQtMS4zLDBMMjYsMTZMMzAsMjB6ICAgIE0xNiwyNnY0aDRMMTYsMjZ6IiBjbGFz + cz0iQmx1ZSIgLz4NCiAgPC9nPg0KPC9zdmc+Cw== + + \ No newline at end of file diff --git a/EDIDocumentImport/frmRowEditor.vb b/EDIDocumentImport/frmRowEditor.vb index 278b2cd..df09710 100644 --- a/EDIDocumentImport/frmRowEditor.vb +++ b/EDIDocumentImport/frmRowEditor.vb @@ -8,6 +8,7 @@ Imports ImporterShared.Winline Imports DigitalData.Modules.Language Imports DevExpress.XtraEditors.Controls Imports System.Globalization +Imports DevExpress.XtraEditors Public Class frmRowEditor Private ReadOnly _Columns As List(Of String) @@ -15,9 +16,10 @@ Public Class frmRowEditor Private ReadOnly _Accounts As List(Of Account) Private ReadOnly _DocumentRow As ImporterShared.DocumentRow - Private ReadOnly DatePicker As New RepositoryItemDateEdit() - Private ReadOnly MultilineEditor As New RepositoryItemMemoEdit() + Private ReadOnly DatePicker As New RepositoryItemDateEdit + Private ReadOnly MultilineEditor As New RepositoryItemMemoEdit Private ReadOnly AccountPicker As New RepositoryItemSearchLookUpEdit + Private ReadOnly MaskDateEditor As New RepositoryItemTextEdit Private Const COL_KEY = "KEY" Private Const COL_VALUE_ORIGINAL = "VALUE_ORIGINAL" @@ -43,26 +45,31 @@ Public Class frmRowEditor AccountPicker.DisplayMember = "Name" AccountPicker.ValueMember = "Id" + 'DatePicker.CalendarTimeEditing = DevExpress.Utils.DefaultBoolean.False + 'DatePicker.EditMask = "yyyy-MM-dd" + 'DatePicker.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTimeAdvancingCaret 'DatePicker.DisplayFormat.FormatString = "yyyy-MM-dd" - DatePicker.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime + ' DatePicker.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime + 'DatePicker.DisplayFormat.FormatString = "d" 'DatePicker.EditFormat.FormatString = "yyyy-MM-dd" - DatePicker.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime + 'DatePicker.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime + 'DatePicker.EditFormat.FormatString = "d" 'DatePicker.Mask.UseMaskAsDisplayFormat = True 'DatePicker.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime ' DatePicker.Mask.EditMask = "yyyy-MM-dd" - 'AddHandler DatePicker.ParseEditValue, AddressOf DatePicker_ParseEditValue + 'MaskDateEditor.Mask.EditMask = "yyyy-MM-dd" + 'MaskDateEditor.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Simple End Sub Private Sub DatePicker_ParseEditValue(sender As Object, e As ConvertEditValueEventArgs) - If TypeOf e.Value Is String Then - Try - Dim oDateTime = Date.ParseExact(e.Value.ToString, "yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture) - e.Value = oDateTime - e.Handled = True - Catch ex As Exception - - End Try + + If TypeOf sender Is RepositoryItemDateEdit Then + + + Debug.WriteLine($"RepoItem # {e.Value} # {e.Value.GetType.Name}") + ElseIf TypeOf sender Is DateEdit Then + Debug.WriteLine($"DateEdit # {e.Value} # {e.Value.GetType.Name}") End If End Sub @@ -108,7 +115,14 @@ Public Class frmRowEditor End If Dim oFieldValue As FieldValue = oField.Value - Dim oGridValue = Utils.NotNull(oRow.Item(COL_VALUE_FINAL), String.Empty) + Dim oGridValue As String = Utils.NotNull(oRow.Item(COL_VALUE_FINAL), String.Empty) + + If oField.Key = "Datum_Auftrag-Bestellung" And oGridValue.Length > 0 Then + If TryParseDate(oGridValue) Is Nothing Then + MsgBox($"Datumswert für '{oField.Key}' enthält einen ungüligen Wert. Bitte benutzen Sie das Format 'YYYY-MM-DD'.", MsgBoxStyle.Exclamation, Text) + Exit Sub + End If + End If If Not oFieldValue.Final.Equals(oGridValue) Then oFieldValue.Final = Utils.NotNull(oRow.Item(COL_VALUE_FINAL), String.Empty) @@ -126,36 +140,41 @@ Public Class frmRowEditor Close() End Sub - Private Sub btnApplyFromWinline_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnApplyFromWinline.ItemClick - Dim oSelectedRow As DataRow = GridView1.GetDataRow(GridView1.FocusedRowHandle) - - If oSelectedRow Is Nothing Then - Exit Sub - End If + Private Function TryParseDate(pValue As String) + Try + Return Date.ParseExact(pValue, "yyyy-MM-dd", CultureInfo.InvariantCulture) + Catch ex As Exception + Return Nothing + End Try + End Function - oSelectedRow.Item(COL_VALUE_FINAL) = oSelectedRow.Item(COL_VALUE_EXTERNAL) - oSelectedRow.AcceptChanges() + Private Sub btnApplyFromWinline_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnApplyFromWinline.ItemClick + CopyValueToFinalColumn(COL_VALUE_EXTERNAL) End Sub Private Sub btnApplyFromOriginal_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnApplyFromOriginal.ItemClick + CopyValueToFinalColumn(COL_VALUE_ORIGINAL) + End Sub + + Private Sub CopyValueToFinalColumn(pSourceColumnName As String) Dim oSelectedRow As DataRow = GridView1.GetDataRow(GridView1.FocusedRowHandle) If oSelectedRow Is Nothing Then Exit Sub End If - oSelectedRow.Item(COL_VALUE_FINAL) = oSelectedRow.Item(COL_VALUE_ORIGINAL) + oSelectedRow.Item(COL_VALUE_FINAL) = oSelectedRow.Item(pSourceColumnName) oSelectedRow.AcceptChanges() + GridView1.CloseEditor() End Sub - - Private Sub GridView1_CustomRowCellEdit(sender As Object, e As CustomRowCellEditEventArgs) Handles GridView1.CustomRowCellEdit Dim oDataRow As DataRow = GridView1.GetDataRow(e.RowHandle) If e.Column.FieldName = COL_VALUE_ORIGINAL Or e.Column.FieldName = COL_VALUE_FINAL Then If oDataRow.Item(COL_KEY) = "Datum_Auftrag-Bestellung" Then - e.RepositoryItem = DatePicker + 'e.RepositoryItem = DatePicker + 'e.RepositoryItem = MaskDateEditor ElseIf e.CellValue.ToString.Length > 100 Then e.RepositoryItem = MultilineEditor ElseIf oDataRow.Item(COL_KEY) = "Fakt_Kontonummer" Or oDataRow.Item(COL_KEY) = "Lief_Kontonummer" Then diff --git a/ImporterShared/Documents/Document.vb b/ImporterShared/Documents/Document.vb index c1f4253..d081d99 100644 --- a/ImporterShared/Documents/Document.vb +++ b/ImporterShared/Documents/Document.vb @@ -9,8 +9,6 @@ Namespace Documents Public Schema As Schema Public Mandator As Mandator - Public Selected As Boolean = False - Public TemplateName As String Public TemplateType As Integer Public [Option] As Integer @@ -21,6 +19,8 @@ Namespace Documents ''' Public Property Rows As New List(Of DocumentRow) + Public Property Selected As Boolean = False + Public ReadOnly Property MandatorId As String Get Return Mandator?.Id diff --git a/ImporterShared/Documents/DocumentLoader.vb b/ImporterShared/Documents/DocumentLoader.vb index 5c7a006..9e52b20 100644 --- a/ImporterShared/Documents/DocumentLoader.vb +++ b/ImporterShared/Documents/DocumentLoader.vb @@ -1,4 +1,5 @@ -Imports System.IO +Imports System.Globalization +Imports System.IO Imports DigitalData.Modules.Logging Imports ImporterShared.Schemas Imports ImporterShared.Winline @@ -33,7 +34,6 @@ Namespace Documents Logger.Debug("Found [{0}] files in directory [{1}]", oFiles.Count, oDirectory) For Each oFile In oFiles - ' TODO: Supply currently selected mandator when the mandator selection works Dim oDocument = LoadFile(oFile, pSchema, pMandator) Files.Add(oDocument) Next @@ -129,9 +129,17 @@ Namespace Documents Where(Function(c) c.Name = oSubElement.Name). SingleOrDefault() + Dim oValue = oSubElement.Value + + ' TODO: Needed when we have time for date times + 'If oSchemaField.DataType = Constants.ColumnType.Date Then + ' Dim oDate = Date.ParseExact(oValue, "yyyy-MM-dd", CultureInfo.InvariantCulture) + ' oValue = oDate.ToString("d") + 'End If + oFields.Add(oSubElement.Name.ToString, New DocumentRow.FieldValue With { - .Original = oSubElement.Value, - .Final = oSubElement.Value, + .Original = oValue, + .Final = oValue, .DataType = oSchemaField.DataType }) Next diff --git a/ImporterShared/Documents/DocumentRow.vb b/ImporterShared/Documents/DocumentRow.vb index 04919d5..4d10afb 100644 --- a/ImporterShared/Documents/DocumentRow.vb +++ b/ImporterShared/Documents/DocumentRow.vb @@ -15,7 +15,7 @@ Public Original As String = "" Public External As String = "" Public Final As String = "" - Public DataType As Constants.ColumnType = Constants.ColumnType.String + Public Property DataType As Constants.ColumnType = Constants.ColumnType.String Public Overrides Function ToString() As String Return Final