Final fixes before vacation \o/

This commit is contained in:
Jonathan Jenne
2019-08-08 16:24:31 +02:00
parent aa84e977b9
commit eeb38b5849
21 changed files with 1180 additions and 777 deletions

View File

@@ -8,13 +8,16 @@ Imports DigitalData.Controls.RegexEditor
Public Class ctrlApplicationAssignment
Private Current_ProfileId As Integer
Private Current_WindowId As Integer
Private Current_ProcessName As String
Private Sub ctrlApplicationAssignment_Load(sender As Object, e As EventArgs) Handles Me.Load
TBCW_PROFILE_PROCESSTableAdapter.Connection.ConnectionString = MyConnectionString
TBCW_PROF_REL_WINDOWTableAdapter.Connection.ConnectionString = MyConnectionString
TBCW_PROF_REL_CONTROLTableAdapter.Connection.ConnectionString = MyConnectionString
AddHandler RepositoryItemRegexEdit.ButtonClick, AddressOf RepositoryItemRegexEdit_Click
AddHandler RepositoryItemButtonEdit1.ButtonClick, AddressOf RepositoryItemRegexEdit_Click
End Sub
Public Function Process_Load(ProfileId As Integer) As Boolean
@@ -156,7 +159,18 @@ Public Class ctrlApplicationAssignment
End Try
End Function
Public Function Control_CreateAssignment(ProfileId As Integer, WindowId As Integer)
Public Function Control_Load() As Boolean
Try
TBCW_PROF_REL_CONTROLTableAdapter.Fill(MyDataset.TBCW_PROF_REL_CONTROL, Current_ProcessName, Current_WindowId, Current_ProfileId)
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Public Function Control_CreateAssignment(ProfileId As Integer) As Boolean
Dim oForm As New frmControlCapture()
Dim oResult = oForm.ShowDialog()
@@ -166,21 +180,55 @@ Public Class ctrlApplicationAssignment
Dim oProcessName As String = oForm.ProcessName
If oControlTitle <> "" Then
Dim insert = String.Format("INSERT INTO TBCW_PROF_REL_CONTROL (PROFILE_ID, DESCRIPTION, PROCESS_NAME, REGEX, ADDED_WHO) VALUES ({0}, '{1}', '{2}','^{3}$','{4}')", ProfileId, oProcessName, oProcessName, oControlTitle, Environment.UserName)
Dim insert = String.Format("INSERT INTO TBCW_PROF_REL_CONTROL (PROFILE_ID, DESCRIPTION, PROCESS_NAME, REGEX, WINDOW_ID, ADDED_WHO) VALUES ({0}, '{1}', '{2}','^{3}$',{4},'{5}')", ProfileId, Current_ProcessName, Current_ProcessName, oControlTitle, Current_WindowId, Environment.UserName)
If Database.ExecuteNonQuery(insert) = False Then
Return False
End If
End If
Window_Load()
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
GridView_Control.CloseEditor()
TBCW_PROF_REL_CONTROLBindingSource.EndEdit()
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)
End If
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Public Function Control_DeleteAssignment() As Boolean
Try
Dim oGuid = GridView_Control.GetFocusedRowCellValue(GridView_Control.Columns("GUID"))
Dim oSQL = String.Format("DELETE FROM TBCW_PROF_REL_CONTROL WHERE GUID = {0}", oGuid)
If Database.ExecuteNonQuery(oSQL) Then
Window_Load()
Return True
End If
Return False
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Private Sub GridViewProcessProfile_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridViewProcessProfile.FocusedRowChanged
If e.FocusedRowHandle < 0 Then
Exit Sub
@@ -201,6 +249,17 @@ Public Class ctrlApplicationAssignment
Replace(vbNullChar, "")
End Function
Private Sub GridView_Window_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridView_Window.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
End Sub
End Class