VersionRelease

This commit is contained in:
Digital Data - Marlon Schreiber
2019-08-26 11:41:24 +02:00
parent a4086de11b
commit c7731cbb6d
35 changed files with 8126 additions and 4491 deletions

View File

@@ -6,10 +6,10 @@ Imports DevExpress.XtraGrid.Views.Grid
Imports DigitalData.Controls.RegexEditor
Public Class ctrlApplicationAssignment
Public AppSelectionString As String
Private Current_ProfileId As Integer
Private Current_WindowId As Integer
Private Current_ProcessName As String
Private Current_ProcessGUID As Integer
Private Sub ctrlApplicationAssignment_Load(sender As Object, e As EventArgs) Handles Me.Load
TBCW_PROFILE_PROCESSTableAdapter.Connection.ConnectionString = MyConnectionString
@@ -20,9 +20,18 @@ Public Class ctrlApplicationAssignment
AddHandler RepositoryItemButtonEdit1.ButtonClick, AddressOf RepositoryItemRegexEdit_Click
End Sub
Public Function Process_Load(ProfileId As Integer) As Boolean
Public Function AssignProfileID(ProfileId As Integer) As Boolean
Try
Current_ProfileId = ProfileId
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Public Function Process_Load(ProfileId As Integer) As Boolean
Try
TBCW_PROFILE_PROCESSTableAdapter.Fill(MyDataset.TBCW_PROFILE_PROCESS, ProfileId)
Return True
@@ -46,7 +55,7 @@ Public Class ctrlApplicationAssignment
If Database.ExecuteNonQuery(oSQL) = False Then
Return False
Else
oSQL = String.Format("INSERT INTO TBCW_PROF_REL_WINDOW (PROFILE_ID, DESCRIPTION, PROCESS_NAME, REGEX, ADDED_WHO) VALUES ({0}, '{1}', '{2}','^{3}$','{4}')", ProfileId, oProcessName, oProcessName, oWindowTitle, Environment.UserName)
oSQL = String.Format("INSERT INTO TBCW_PROF_REL_WINDOW (DESCRIPTION, REGEX, ADDED_WHO,PROCESS_ID) VALUES ('{0}', '^{1}$','{3}',{4})", oWindowTitle, oWindowTitle, Environment.UserName, CURRENT_PROCESSID)
If Database.ExecuteNonQuery(oSQL) = False Then
Return False
End If
@@ -65,7 +74,7 @@ Public Class ctrlApplicationAssignment
Public Function Process_DeleteAssignment() As Boolean
Try
Dim oProcessId = GridViewProcessProfile.GetFocusedRowCellValue(GridViewProcessProfile.Columns("GUID"))
Dim oSQL = String.Format("EXEC PRCW_DELETE_PROCESS {0}", oProcessId)
Dim oSQL = String.Format("EXEC PRCW_DELETE_PROCESS {0},{1}", oProcessId, Current_ProfileId)
If Database.ExecuteNonQuery(oSQL) Then
Process_Load(Current_ProfileId)
Return True
@@ -80,7 +89,7 @@ Public Class ctrlApplicationAssignment
Public Function Window_Load() As Boolean
Try
TBCW_PROF_REL_WINDOWTableAdapter.Fill(MyDataset.TBCW_PROF_REL_WINDOW, Current_ProcessName, Current_ProfileId)
TBCW_PROF_REL_WINDOWTableAdapter.Fill(MyDataset.TBCW_PROF_REL_WINDOW, CURRENT_PROCESSID)
Return True
Catch ex As Exception
@@ -112,7 +121,7 @@ Public Class ctrlApplicationAssignment
Dim oProcessName As String = oForm.ProcessName
If oWindowTitle <> "" Then
Dim insert = String.Format("INSERT INTO TBCW_PROF_REL_WINDOW (PROFILE_ID, DESCRIPTION, PROCESS_NAME, REGEX, ADDED_WHO) VALUES ({0}, '{1}', '{2}','^{3}$','{4}')", ProfileId, oProcessName, oProcessName, oWindowTitle, Environment.UserName)
Dim insert = String.Format("INSERT INTO TBCW_PROF_REL_WINDOW (DESCRIPTION, REGEX, ADDED_WHO,PROCESS_ID) VALUES ('{0}', '^{1}$','{2}',{3})", oWindowTitle, oWindowTitle, Environment.UserName, CURRENT_PROCESSID)
If Database.ExecuteNonQuery(insert) = False Then
Return False
End If
@@ -130,7 +139,7 @@ Public Class ctrlApplicationAssignment
Public Function Window_DeleteAssignment() As Boolean
Try
Dim oGuid = GridView_Window.GetFocusedRowCellValue(GridView_Window.Columns("GUID"))
Dim oSQL = String.Format("DELETE FROM TBCW_PROF_REL_WINDOW WHERE GUID = {0}", oGuid)
Dim oSQL = String.Format("EXEC PRCW_DELETE_WINDOW {0}", oGuid)
If Database.ExecuteNonQuery(oSQL) Then
Process_Load(Current_ProfileId)
Return True
@@ -145,14 +154,15 @@ Public Class ctrlApplicationAssignment
Public Function Window_SaveAssignment() As Boolean
Try
GridView_Window.CloseEditor()
TBCW_PROF_REL_WINDOWBindingSource.EndEdit()
GridView_Window.CloseEditor()
If Not IsNothing(MyDataset.TBCW_PROF_REL_WINDOW.GetChanges) Then
TBCW_PROF_REL_WINDOWBindingSource.EndEdit()
TBCW_PROF_REL_WINDOWTableAdapter.Update(MyDataset.TBCW_PROF_REL_WINDOW)
Return True
End If
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
@@ -161,7 +171,7 @@ Public Class ctrlApplicationAssignment
Public Function Control_Load() As Boolean
Try
TBCW_PROF_REL_CONTROLTableAdapter.Fill(MyDataset.TBCW_PROF_REL_CONTROL, Current_ProcessName, Current_WindowId, Current_ProfileId)
TBCW_PROF_REL_CONTROLTableAdapter.Fill(MyDataset.TBCW_PROF_REL_CONTROL, Current_WindowId)
Return True
Catch ex As Exception
@@ -170,7 +180,7 @@ Public Class ctrlApplicationAssignment
End Try
End Function
Public Function Control_CreateAssignment(ProfileId As Integer) As Boolean
Public Function Control_CreateAssignment() As Boolean
Dim oForm As New frmControlCapture()
Dim oResult = oForm.ShowDialog()
@@ -183,7 +193,8 @@ Public Class ctrlApplicationAssignment
Dim oDefaultRegex As String = "\.+"
If oControlTitle <> "" Or oAutomationId <> "" Then
Dim insert = String.Format("INSERT INTO TBCW_PROF_REL_CONTROL (PROFILE_ID, DESCRIPTION, AUTOMATION_ID, FRAMEWORK_ID, PROCESS_NAME, REGEX, WINDOW_ID, ADDED_WHO) VALUES ({0}, '{1}', '{2}', '{3}', '{4}','^{5}$',{6},'{7}')", ProfileId, oControlTitle, oAutomationId, oFrameworkId, Current_ProcessName, oDefaultRegex, Current_WindowId, Environment.UserName)
Dim insert = String.Format("INSERT INTO TBCW_PROF_REL_CONTROL (WINDOW_ID, DESCRIPTION, AUTOMATION_ID, FRAMEWORK_ID, REGEX, ADDED_WHO) VALUES ({0}, '{1}', '{2}', '{3}', '^{4}$','{5}')",
Current_WindowId, oControlTitle, oAutomationId, oFrameworkId, oDefaultRegex, Environment.UserName)
If Database.ExecuteNonQuery(insert) = False Then
Return False
End If
@@ -202,14 +213,15 @@ Public Class ctrlApplicationAssignment
Public Function Control_SaveAssignment() As Boolean
Try
GridView_Control.CloseEditor()
TBCW_PROF_REL_CONTROLBindingSource.EndEdit()
GridView_Control.CloseEditor()
If Not IsNothing(MyDataset.TBCW_PROF_REL_CONTROL.GetChanges) Then
TBCW_PROF_REL_CONTROLBindingSource.EndEdit()
TBCW_PROF_REL_CONTROLTableAdapter.Update(MyDataset.TBCW_PROF_REL_CONTROL)
Return True
End If
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
@@ -239,7 +251,12 @@ Public Class ctrlApplicationAssignment
Dim oSelectedRow As DataRow = GridViewProcessProfile.GetDataRow(e.FocusedRowHandle)
Dim oProcessName As String = oSelectedRow.Item("PROC_NAME")
Current_ProcessName = oProcessName
Dim oPRocessGUID = oSelectedRow.Item("GUID")
AppSelectionString = $"Selected Profile: {oPRocessGUID}-{oProcessName}"
CURRENT_PROCESSID = oPRocessGUID
CURRENT_PROCESSNAME = oProcessName
MyDataset.TBCW_PROF_REL_CONTROL.Clear()
MyDataset.TBCW_PROF_REL_WINDOW.Clear()
If Window_Load() = False Then
MsgBox($"Error while loading windows for process {oProcessName}", vbCritical, "")
@@ -253,16 +270,32 @@ Public Class ctrlApplicationAssignment
End Function
Private Sub GridView_Window_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridView_Window.FocusedRowChanged
Try
If e.FocusedRowHandle < 0 Then
Exit Sub
End If
Dim oSelectedRow As DataRow = GridView_Window.GetDataRow(e.FocusedRowHandle)
Dim oWindowId As String = oSelectedRow.Item("GUID")
Current_WindowId = oWindowId
AppSelectionString = AppSelectionString & $" / WindowID: {oWindowId}"
If Control_Load() = False Then
MsgBox($"Error while loading controls for window {oWindowId}", vbCritical, "")
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub GridView_Control_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridView_Control.FocusedRowChanged
If e.FocusedRowHandle < 0 Then
Exit Sub
End If
Dim oSelectedRow As DataRow = GridViewProcessProfile.GetDataRow(e.FocusedRowHandle)
Dim oWindowId As String = oSelectedRow.Item("GUID")
Current_WindowId = oWindowId
If Control_Load() = False Then
MsgBox($"Error while loading controls for window {oWindowId}", vbCritical, "")
End If
Dim oSelectedRow As DataRow = GridView_Control.GetDataRow(e.FocusedRowHandle)
Dim oControlGUID = oSelectedRow.Item("GUID")
AppSelectionString = AppSelectionString & $" - Selected ControlGUID: {oControlGUID}"
End Sub
End Class