Add Monitoring tab with configurable email history grid
Introduced a new "Monitoring" tab to the main form, featuring a configuration panel for specifying the number of emails to display and a DevExpress grid to show recent email history from TBEMLP_HISTORY. Added logic to validate the configuration input and dynamically reload the grid. Updated designer and code-behind to support new controls and event handlers. Made minor layout adjustments to accommodate the new UI elements.
This commit is contained in:
@@ -93,6 +93,11 @@ Public Class frmMain
|
||||
|
||||
|
||||
_Encryption = New clsEncryption("!35452didalog=", LogConfig)
|
||||
|
||||
If String.IsNullOrWhiteSpace(txtMonitoringConfig.Text) OrElse Not IsNumeric(txtMonitoringConfig.Text) OrElse CInt(txtMonitoringConfig.Text) <= 0 Then
|
||||
txtMonitoringConfig.Text = "500"
|
||||
End If
|
||||
LoadMonitoringIntoGrid()
|
||||
End Sub
|
||||
|
||||
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
@@ -1044,4 +1049,39 @@ Public Class frmMain
|
||||
Private Sub COMMENT_PROFILESTextBox_TextChanged(sender As Object, e As EventArgs) Handles COMMENT_PROFILESTextBox.TextChanged
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LoadMonitoringIntoGrid()
|
||||
Try
|
||||
|
||||
Dim emailAmount As Integer
|
||||
If txtMonitoringConfig.Text = Nothing OrElse Not IsNumeric(txtMonitoringConfig.Text) Then
|
||||
emailAmount = 500
|
||||
Else
|
||||
emailAmount = Convert.ToInt32(txtMonitoringConfig.Text)
|
||||
End If
|
||||
|
||||
Dim oSQL = $"SELECT TOP ({emailAmount}) GUID, PROFILE_ID, EMAIL_MSGID, EMAIL_FROM, EMAIL_SUBJECT, EMAIL_DATE, ADDED_WHEN, STATUS FROM [dbo].[TBEMLP_HISTORY] (nolock) order by GUID DESC"
|
||||
Dim oDT As DataTable = _database.GetDatatable(oSQL)
|
||||
|
||||
Me.gridMonitoring.DataSource = oDT
|
||||
|
||||
Dim gridView = TryCast(Me.GridView5, DevExpress.XtraGrid.Views.Grid.GridView)
|
||||
If gridView IsNot Nothing Then
|
||||
gridView.OptionsView.ColumnAutoWidth = False
|
||||
gridView.BestFitColumns()
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
If Logger IsNot Nothing Then Logger.Error(ex) Else Debug.WriteLine(ex.ToString())
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub txtMonitoringConfig_LostFocus(sender As Object, e As EventArgs) Handles txtMonitoringConfig.LostFocus
|
||||
If Not IsNumeric(txtMonitoringConfig.Text) OrElse CInt(txtMonitoringConfig.Text) <= 0 Then
|
||||
txtMonitoringConfig.Text = "500"
|
||||
End If
|
||||
LoadMonitoringIntoGrid()
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user