diff --git a/app/DD_PM_WINDREAM/ClassControlCreator.vb b/app/DD_PM_WINDREAM/ClassControlCreator.vb index 7f4a73d..c26c8b3 100644 --- a/app/DD_PM_WINDREAM/ClassControlCreator.vb +++ b/app/DD_PM_WINDREAM/ClassControlCreator.vb @@ -1,4 +1,5 @@ Imports System.ComponentModel +Imports System.Text.RegularExpressions Imports DD_LIB_Standards Imports DevExpress.Utils Imports DevExpress.XtraEditors @@ -584,10 +585,30 @@ Public Class ClassControlCreator Dim oIsRequired = oColumn.Item("VALIDATION") Dim oValue = NotNull(oView.GetRowCellValue(e.RowHandle, oCol.ColumnName), "") + Try + Dim oRegex = NotNull(oColumn.Item("REGEX_MATCH"), String.Empty) + Dim oRegexMessage = NotNull(oColumn.Item("REGEX_MESSAGE_DE"), String.Empty) + If oRegex <> String.Empty Then + Dim oMatch = New Regex(oRegex).IsMatch(oValue) + Dim oDefaultMessage = "Wert entspricht nicht dem gefordertem Format!" + Dim oMessage = IIf(oRegexMessage <> String.Empty, oRegexMessage, oDefaultMessage) + + If oMatch = False Then + oView.SetColumnError(oGridColumn, oMessage) + e.Valid = False + Exit For + + End If + End If + Catch ex As Exception + LOGGER.Error(ex) + End Try + If oIsRequired And oValue = "" Then oView.SetColumnError(oGridColumn, "Spalte muss ausgefüllt werden!") e.Valid = False Exit For + End If Next End Sub diff --git a/app/DD_PM_WINDREAM/frmControl_Detail.Designer.vb b/app/DD_PM_WINDREAM/frmControl_Detail.Designer.vb index 323a015..aefae30 100644 --- a/app/DD_PM_WINDREAM/frmControl_Detail.Designer.vb +++ b/app/DD_PM_WINDREAM/frmControl_Detail.Designer.vb @@ -279,7 +279,6 @@ Partial Class frmControl_Detail resources.ApplyResources(Me.REGEX_MATCHTextBox, "REGEX_MATCHTextBox") Me.REGEX_MATCHTextBox.MenuManager = Me.RibbonControl1 Me.REGEX_MATCHTextBox.Name = "REGEX_MATCHTextBox" - Me.REGEX_MATCHTextBox.Properties.ReadOnly = True Me.REGEX_MATCHTextBox.StyleController = Me.LayoutControl1 ' 'SimpleButton1 @@ -294,7 +293,6 @@ Partial Class frmControl_Detail resources.ApplyResources(Me.REGEX_MESSAGE_DETextBox, "REGEX_MESSAGE_DETextBox") Me.REGEX_MESSAGE_DETextBox.MenuManager = Me.RibbonControl1 Me.REGEX_MESSAGE_DETextBox.Name = "REGEX_MESSAGE_DETextBox" - Me.REGEX_MESSAGE_DETextBox.Properties.ReadOnly = True Me.REGEX_MESSAGE_DETextBox.StyleController = Me.LayoutControl1 ' 'SQL_COMMANDTextBox diff --git a/app/DD_PM_WINDREAM/frmControl_Detail.vb b/app/DD_PM_WINDREAM/frmControl_Detail.vb index 9ff11df..d39009b 100644 --- a/app/DD_PM_WINDREAM/frmControl_Detail.vb +++ b/app/DD_PM_WINDREAM/frmControl_Detail.vb @@ -119,14 +119,13 @@ Public Class frmControl_Detail End Sub Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click - 'TODO: Enable when regexes are implemented - 'Dim oForm As New frmRegexEditor() - 'oForm.RegexString = REGEX_MATCHTextBox.Text + Dim oForm As New frmRegexEditor() + oForm.RegexString = REGEX_MATCHTextBox.Text - 'Dim oResult = oForm.ShowDialog() - 'If oResult = DialogResult.OK Then - ' REGEX_MATCHTextBox.Text = oForm.RegexString - 'End If + Dim oResult = oForm.ShowDialog() + If oResult = DialogResult.OK Then + REGEX_MATCHTextBox.Text = oForm.RegexString + End If End Sub Private Sub SimpleButton2_Click(sender As Object, e As EventArgs) Handles SimpleButton2.Click