This commit is contained in:
Jonathan Jenne
2019-09-20 16:20:09 +02:00
parent a765fe4cce
commit 54598ab3d4
11 changed files with 611 additions and 1051 deletions

View File

@@ -10,6 +10,7 @@ Public Class ctrlApplicationAssignment
Private Current_ProfileId As Integer
Private Current_WindowId As Integer
Private Current_ProcessGUID As Integer
Private Current_ControlId As Integer
Private Sub ctrlApplicationAssignment_Load(sender As Object, e As EventArgs) Handles Me.Load
TBCW_PROFILE_PROCESSTableAdapter.Connection.ConnectionString = MyConnectionString
@@ -181,23 +182,20 @@ Public Class ctrlApplicationAssignment
End Function
Public Function Control_CreateAssignment() As Boolean
Dim oForm As New frmControlCapture()
Dim oForm As New frmControlCapture(EditMode:=False)
Dim oResult = oForm.ShowDialog()
If oResult = DialogResult.OK Then
Try
Dim oDefaultRegex As String = "\.+"
Dim oSql = $"INSERT INTO TBCW_PROF_REL_CONTROL
(
WINDOW_ID, DESCRIPTION, REGEX, ADDED_WHO
WINDOW_ID, DESCRIPTION, CONTROL_NAME, ADDED_WHO
,[TOPLEFT_TOP],[TOPLEFT_LEFT],[TOPLEFT_RIGHT],[TOPLEFT_BOTTOM]
,[TOPRIGHT_TOP],[TOPRIGHT_LEFT],[TOPRIGHT_RIGHT],[TOPRIGHT_BOTTOM]
,[BOTTOMLEFT_TOP],[BOTTOMLEFT_LEFT],[BOTTOMLEFT_RIGHT],[BOTTOMLEFT_BOTTOM]
,[BOTTOMRIGHT_TOP],[BOTTOMRIGHT_LEFT],[BOTTOMRIGHT_RIGHT],[BOTTOMRIGHT_BOTTOM]
) VALUES (
{Current_WindowId}, 'Control', '^{oDefaultRegex}$', '{Environment.UserName}',
{Current_WindowId}, 'Beispiel Beschreibung', '{oForm.ControlName}', '{Environment.UserName}',
{oForm.TopLeft.Top}, {oForm.TopLeft.Left}, {oForm.TopLeft.Right}, {oForm.TopLeft.Bottom},
{oForm.TopRight.Top}, {oForm.TopRight.Left}, {oForm.TopRight.Right}, {oForm.TopRight.Bottom},
{oForm.TopLeft.Top}, {oForm.TopLeft.Left}, {oForm.TopLeft.Right}, {oForm.TopLeft.Bottom},
@@ -220,6 +218,51 @@ Public Class ctrlApplicationAssignment
End If
End Function
Public Function Control_EditAssignment() As Boolean
Dim oForm As New frmControlCapture(EditMode:=True)
Dim oResult = oForm.ShowDialog()
Dim oControlId As Integer() = GridView_Control.GetSelectedRows()
If oResult = DialogResult.OK Then
Try
Dim oSql = $"UPDATE TBCW_PROF_REL_CONTROL SET
CONTROL_NAME = '{oForm.ControlName}',
CHANGED_WHO = '{Environment.UserName}',
[TOPLEFT_TOP] = {oForm.TopLeft.Top},
[TOPLEFT_BOTTOM] = {oForm.TopLeft.Bottom},
[TOPLEFT_LEFT] = {oForm.TopLeft.Left},
[TOPLEFT_RIGHT] = {oForm.TopLeft.Right},
[TOPRIGHT_TOP] = {oForm.TopRight.Top},
[TOPRIGHT_BOTTOM] = {oForm.TopRight.Bottom},
[TOPRIGHT_LEFT] = {oForm.TopRight.Left},
[TOPRIGHT_RIGHT] = {oForm.TopRight.Right},
[BOTTOMLEFT_TOP] = {oForm.BottomLeft.Top},
[BOTTOMLEFT_BOTTOM] = {oForm.BottomLeft.Bottom},
[BOTTOMLEFT_LEFT] = {oForm.BottomLeft.Left},
[BOTTOMLEFT_RIGHT] = {oForm.BottomLeft.Right},
[BOTTOMRIGHT_TOP] = {oForm.BottomRight.Top},
[BOTTOMRIGHT_BOTTOM] = {oForm.BottomRight.Bottom},
[BOTTOMRIGHT_LEFT] = {oForm.BottomRight.Left},
[BOTTOMRIGHT_RIGHT] = {oForm.BottomRight.Right}
WHERE GUID = {Current_ControlId}
"
If Database.ExecuteNonQuery(oSql) = False Then
Return False
End If
Control_Load()
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
Else
Return True
End If
End Function
Public Function Control_SaveAssignment() As Boolean
Try
TBCW_PROF_REL_CONTROLBindingSource.EndEdit()
@@ -299,11 +342,13 @@ Public Class ctrlApplicationAssignment
Private Sub GridView_Control_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridView_Control.FocusedRowChanged
If e.FocusedRowHandle < 0 Then
Current_ControlId = Nothing
Exit Sub
End If
Dim oSelectedRow As DataRow = GridView_Control.GetDataRow(e.FocusedRowHandle)
Dim oControlGUID = oSelectedRow.Item("GUID")
Current_ControlId = oSelectedRow.Item("GUID")
AppSelectionString = AppSelectionString & $" - Selected ControlGUID: {oControlGUID}"
End Sub
End Class