Added functionality to session viewer for issue #99
This commit is contained in:
@@ -881,7 +881,11 @@ Public Class frmMain
|
|||||||
Private Sub OpenSessions()
|
Private Sub OpenSessions()
|
||||||
Dim frm As New frmSessions
|
Dim frm As New frmSessions
|
||||||
PauseScan()
|
PauseScan()
|
||||||
|
If mgrSessions.CountRows > 0 Then
|
||||||
frm.ShowDialog()
|
frm.ShowDialog()
|
||||||
|
Else
|
||||||
|
mgrCommon.ShowMessage(frmMain_ErrorNoSessions, MsgBoxStyle.Information)
|
||||||
|
End If
|
||||||
ResumeScan()
|
ResumeScan()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Generated
+96
-13
@@ -22,26 +22,33 @@ Partial Class frmSessions
|
|||||||
'Do not modify it using the code editor.
|
'Do not modify it using the code editor.
|
||||||
<System.Diagnostics.DebuggerStepThrough()> _
|
<System.Diagnostics.DebuggerStepThrough()> _
|
||||||
Private Sub InitializeComponent()
|
Private Sub InitializeComponent()
|
||||||
Me.lblQuickFilter = New System.Windows.Forms.Label()
|
Me.lblFilter = New System.Windows.Forms.Label()
|
||||||
Me.txtFilter = New System.Windows.Forms.TextBox()
|
Me.txtFilter = New System.Windows.Forms.TextBox()
|
||||||
Me.dgSessions = New System.Windows.Forms.DataGridView()
|
Me.dgSessions = New System.Windows.Forms.DataGridView()
|
||||||
|
Me.dtpStart = New System.Windows.Forms.DateTimePicker()
|
||||||
|
Me.dtpEnd = New System.Windows.Forms.DateTimePicker()
|
||||||
|
Me.lblTo = New System.Windows.Forms.Label()
|
||||||
|
Me.btnReset = New System.Windows.Forms.Button()
|
||||||
|
Me.btnDelete = New System.Windows.Forms.Button()
|
||||||
|
Me.btnClose = New System.Windows.Forms.Button()
|
||||||
|
Me.lblDateRange = New System.Windows.Forms.Label()
|
||||||
CType(Me.dgSessions, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.dgSessions, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
Me.SuspendLayout()
|
Me.SuspendLayout()
|
||||||
'
|
'
|
||||||
'lblQuickFilter
|
'lblFilter
|
||||||
'
|
'
|
||||||
Me.lblQuickFilter.AutoSize = True
|
Me.lblFilter.AutoSize = True
|
||||||
Me.lblQuickFilter.Location = New System.Drawing.Point(12, 9)
|
Me.lblFilter.Location = New System.Drawing.Point(12, 9)
|
||||||
Me.lblQuickFilter.Name = "lblQuickFilter"
|
Me.lblFilter.Name = "lblFilter"
|
||||||
Me.lblQuickFilter.Size = New System.Drawing.Size(63, 13)
|
Me.lblFilter.Size = New System.Drawing.Size(63, 13)
|
||||||
Me.lblQuickFilter.TabIndex = 0
|
Me.lblFilter.TabIndex = 0
|
||||||
Me.lblQuickFilter.Text = "Game Filter:"
|
Me.lblFilter.Text = "Game Filter:"
|
||||||
'
|
'
|
||||||
'txtFilter
|
'txtFilter
|
||||||
'
|
'
|
||||||
Me.txtFilter.Location = New System.Drawing.Point(80, 6)
|
Me.txtFilter.Location = New System.Drawing.Point(80, 6)
|
||||||
Me.txtFilter.Name = "txtFilter"
|
Me.txtFilter.Name = "txtFilter"
|
||||||
Me.txtFilter.Size = New System.Drawing.Size(160, 20)
|
Me.txtFilter.Size = New System.Drawing.Size(190, 20)
|
||||||
Me.txtFilter.TabIndex = 1
|
Me.txtFilter.TabIndex = 1
|
||||||
'
|
'
|
||||||
'dgSessions
|
'dgSessions
|
||||||
@@ -58,16 +65,85 @@ Partial Class frmSessions
|
|||||||
Me.dgSessions.ReadOnly = True
|
Me.dgSessions.ReadOnly = True
|
||||||
Me.dgSessions.RowHeadersVisible = False
|
Me.dgSessions.RowHeadersVisible = False
|
||||||
Me.dgSessions.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
|
Me.dgSessions.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
|
||||||
Me.dgSessions.Size = New System.Drawing.Size(760, 517)
|
Me.dgSessions.Size = New System.Drawing.Size(760, 488)
|
||||||
Me.dgSessions.TabIndex = 2
|
Me.dgSessions.TabIndex = 6
|
||||||
|
'
|
||||||
|
'dtpStart
|
||||||
|
'
|
||||||
|
Me.dtpStart.Location = New System.Drawing.Point(384, 6)
|
||||||
|
Me.dtpStart.Name = "dtpStart"
|
||||||
|
Me.dtpStart.Size = New System.Drawing.Size(175, 20)
|
||||||
|
Me.dtpStart.TabIndex = 3
|
||||||
|
'
|
||||||
|
'dtpEnd
|
||||||
|
'
|
||||||
|
Me.dtpEnd.Location = New System.Drawing.Point(597, 6)
|
||||||
|
Me.dtpEnd.Name = "dtpEnd"
|
||||||
|
Me.dtpEnd.Size = New System.Drawing.Size(175, 20)
|
||||||
|
Me.dtpEnd.TabIndex = 5
|
||||||
|
'
|
||||||
|
'lblTo
|
||||||
|
'
|
||||||
|
Me.lblTo.Location = New System.Drawing.Point(565, 9)
|
||||||
|
Me.lblTo.Name = "lblTo"
|
||||||
|
Me.lblTo.Size = New System.Drawing.Size(26, 17)
|
||||||
|
Me.lblTo.TabIndex = 4
|
||||||
|
Me.lblTo.Text = "to"
|
||||||
|
Me.lblTo.TextAlign = System.Drawing.ContentAlignment.TopCenter
|
||||||
|
'
|
||||||
|
'btnReset
|
||||||
|
'
|
||||||
|
Me.btnReset.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
|
||||||
|
Me.btnReset.Location = New System.Drawing.Point(591, 526)
|
||||||
|
Me.btnReset.Name = "btnReset"
|
||||||
|
Me.btnReset.Size = New System.Drawing.Size(100, 23)
|
||||||
|
Me.btnReset.TabIndex = 2
|
||||||
|
Me.btnReset.Text = "&Reset Filters"
|
||||||
|
Me.btnReset.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'btnDelete
|
||||||
|
'
|
||||||
|
Me.btnDelete.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
|
||||||
|
Me.btnDelete.Location = New System.Drawing.Point(12, 526)
|
||||||
|
Me.btnDelete.Name = "btnDelete"
|
||||||
|
Me.btnDelete.Size = New System.Drawing.Size(100, 23)
|
||||||
|
Me.btnDelete.TabIndex = 7
|
||||||
|
Me.btnDelete.Text = "&Delete Session"
|
||||||
|
Me.btnDelete.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'btnClose
|
||||||
|
'
|
||||||
|
Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
|
||||||
|
Me.btnClose.Location = New System.Drawing.Point(697, 526)
|
||||||
|
Me.btnClose.Name = "btnClose"
|
||||||
|
Me.btnClose.Size = New System.Drawing.Size(75, 23)
|
||||||
|
Me.btnClose.TabIndex = 8
|
||||||
|
Me.btnClose.Text = "&Close"
|
||||||
|
Me.btnClose.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'lblDateRange
|
||||||
|
'
|
||||||
|
Me.lblDateRange.AutoSize = True
|
||||||
|
Me.lblDateRange.Location = New System.Drawing.Point(310, 9)
|
||||||
|
Me.lblDateRange.Name = "lblDateRange"
|
||||||
|
Me.lblDateRange.Size = New System.Drawing.Size(68, 13)
|
||||||
|
Me.lblDateRange.TabIndex = 9
|
||||||
|
Me.lblDateRange.Text = "Date Range:"
|
||||||
'
|
'
|
||||||
'frmSessions
|
'frmSessions
|
||||||
'
|
'
|
||||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
Me.ClientSize = New System.Drawing.Size(784, 561)
|
Me.ClientSize = New System.Drawing.Size(784, 561)
|
||||||
|
Me.Controls.Add(Me.lblDateRange)
|
||||||
|
Me.Controls.Add(Me.btnClose)
|
||||||
|
Me.Controls.Add(Me.btnDelete)
|
||||||
|
Me.Controls.Add(Me.btnReset)
|
||||||
|
Me.Controls.Add(Me.lblTo)
|
||||||
|
Me.Controls.Add(Me.dtpEnd)
|
||||||
|
Me.Controls.Add(Me.dtpStart)
|
||||||
Me.Controls.Add(Me.dgSessions)
|
Me.Controls.Add(Me.dgSessions)
|
||||||
Me.Controls.Add(Me.lblQuickFilter)
|
Me.Controls.Add(Me.lblFilter)
|
||||||
Me.Controls.Add(Me.txtFilter)
|
Me.Controls.Add(Me.txtFilter)
|
||||||
Me.Name = "frmSessions"
|
Me.Name = "frmSessions"
|
||||||
Me.ShowIcon = False
|
Me.ShowIcon = False
|
||||||
@@ -79,7 +155,14 @@ Partial Class frmSessions
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Friend WithEvents lblQuickFilter As Label
|
Friend WithEvents lblFilter As Label
|
||||||
Friend WithEvents txtFilter As TextBox
|
Friend WithEvents txtFilter As TextBox
|
||||||
Friend WithEvents dgSessions As DataGridView
|
Friend WithEvents dgSessions As DataGridView
|
||||||
|
Friend WithEvents dtpStart As DateTimePicker
|
||||||
|
Friend WithEvents dtpEnd As DateTimePicker
|
||||||
|
Friend WithEvents lblTo As Label
|
||||||
|
Friend WithEvents btnReset As Button
|
||||||
|
Friend WithEvents btnDelete As Button
|
||||||
|
Friend WithEvents btnClose As Button
|
||||||
|
Friend WithEvents lblDateRange As Label
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
+98
-11
@@ -1,13 +1,19 @@
|
|||||||
Imports GBM.My.Resources
|
Imports GBM.My.Resources
|
||||||
|
Imports System.Globalization
|
||||||
|
|
||||||
Public Class frmSessions
|
Public Class frmSessions
|
||||||
|
|
||||||
|
Private bInitFinished As Boolean = False
|
||||||
Private WithEvents tmFilterTimer As Timer
|
Private WithEvents tmFilterTimer As Timer
|
||||||
|
|
||||||
Private Sub FormatGrid()
|
Private Sub FormatGrid()
|
||||||
|
dgSessions.Columns.Add("MonitorID", frmSessions_ColumnMonitorID)
|
||||||
dgSessions.Columns.Add("Name", frmSessions_ColumnGameName)
|
dgSessions.Columns.Add("Name", frmSessions_ColumnGameName)
|
||||||
dgSessions.Columns.Add("Start", frmSessions_ColumnStart)
|
dgSessions.Columns.Add("Start", frmSessions_ColumnStart)
|
||||||
dgSessions.Columns.Add("End", frmSessions_ColumnEnd)
|
dgSessions.Columns.Add("End", frmSessions_ColumnEnd)
|
||||||
|
|
||||||
|
'Hide the ID
|
||||||
|
dgSessions.Columns("MonitorID").Visible = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub LoadData()
|
Private Sub LoadData()
|
||||||
@@ -15,16 +21,16 @@ Public Class frmSessions
|
|||||||
Dim sFilter As String
|
Dim sFilter As String
|
||||||
|
|
||||||
If txtFilter.Text = String.Empty Then
|
If txtFilter.Text = String.Empty Then
|
||||||
oData = mgrSessions.GetSessions
|
oData = mgrSessions.GetSessionRange(dtpStart.Value, dtpEnd.Value)
|
||||||
Else
|
Else
|
||||||
sFilter = txtFilter.Text.ToLower
|
sFilter = txtFilter.Text.ToLower
|
||||||
oData = mgrSessions.GetSessionsByGameName(sFilter)
|
oData = mgrSessions.GetSessionsByGameNameAndRange(sFilter, dtpStart.Value, dtpEnd.Value)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
dgSessions.Rows.Clear()
|
dgSessions.Rows.Clear()
|
||||||
|
|
||||||
For Each dr As DataRow In oData.Tables(0).Rows
|
For Each dr As DataRow In oData.Tables(0).Rows
|
||||||
dgSessions.Rows.Add(New Object() {dr("Name"), mgrCommon.UnixToDate(dr("Start")), mgrCommon.UnixToDate(dr("End"))})
|
dgSessions.Rows.Add(New Object() {dr("MonitorID"), dr("Name"), mgrCommon.UnixToDate(dr("Start")), mgrCommon.UnixToDate(dr("End"))})
|
||||||
Next
|
Next
|
||||||
|
|
||||||
dgSessions.AutoResizeColumns()
|
dgSessions.AutoResizeColumns()
|
||||||
@@ -33,10 +39,79 @@ Public Class frmSessions
|
|||||||
Private Sub SetForm()
|
Private Sub SetForm()
|
||||||
Me.Text = frmSessions_Name
|
Me.Text = frmSessions_Name
|
||||||
|
|
||||||
|
'Init Labels
|
||||||
|
lblFilter.Text = frmSessions_lblFilter
|
||||||
|
lblDateRange.Text = frmSessions_lblDateRange
|
||||||
|
btnDelete.Text = frmSessions_btnDelete
|
||||||
|
btnReset.Text = frmSessions_btnReset
|
||||||
|
btnClose.Text = frmSessions_btnClose
|
||||||
|
|
||||||
'Init Filter Timer
|
'Init Filter Timer
|
||||||
tmFilterTimer = New Timer()
|
tmFilterTimer = New Timer()
|
||||||
tmFilterTimer.Interval = 1000
|
tmFilterTimer.Interval = 1000
|
||||||
tmFilterTimer.Enabled = False
|
tmFilterTimer.Enabled = False
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ResetFilterFields()
|
||||||
|
Dim dtMinDate As DateTime = mgrSessions.GetMinimumDateTime
|
||||||
|
Dim dtMaxDate As DateTime = mgrSessions.GetMaximumDateTime
|
||||||
|
Dim sDateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern & " " & CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern
|
||||||
|
|
||||||
|
bInitFinished = False
|
||||||
|
|
||||||
|
'Init Date Fields
|
||||||
|
dtpStart.Format = DateTimePickerFormat.Custom
|
||||||
|
dtpEnd.Format = DateTimePickerFormat.Custom
|
||||||
|
dtpStart.CustomFormat = sDateTimeFormat
|
||||||
|
dtpEnd.CustomFormat = sDateTimeFormat
|
||||||
|
dtpStart.MinDate = dtMinDate
|
||||||
|
dtpStart.MaxDate = dtMaxDate
|
||||||
|
dtpEnd.MinDate = dtMinDate
|
||||||
|
dtpEnd.MaxDate = dtMaxDate
|
||||||
|
dtpStart.Value = dtMinDate
|
||||||
|
dtpEnd.Value = dtMaxDate
|
||||||
|
|
||||||
|
'Init Text Filter
|
||||||
|
txtFilter.Text = String.Empty
|
||||||
|
|
||||||
|
bInitFinished = True
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Reset()
|
||||||
|
ResetFilterFields()
|
||||||
|
LoadData()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub DeleteSession()
|
||||||
|
Dim oSession As clsSession
|
||||||
|
Dim oSessions As New List(Of clsSession)
|
||||||
|
|
||||||
|
For Each dgvRow As DataGridViewRow In dgSessions.SelectedRows
|
||||||
|
oSession = New clsSession
|
||||||
|
oSession.MonitorID = dgvRow.Cells(0).Value
|
||||||
|
oSession.SessionStart = dgvRow.Cells(2).Value
|
||||||
|
oSession.SessionEnd = dgvRow.Cells(3).Value
|
||||||
|
oSessions.Add(oSession)
|
||||||
|
Next
|
||||||
|
|
||||||
|
If oSessions.Count > 0 Then
|
||||||
|
mgrSessions.DeleteSession(oSessions)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub frmSession_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
SetForm()
|
||||||
|
ResetFilterFields()
|
||||||
|
FormatGrid()
|
||||||
|
LoadData()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub tmFilterTimer_Tick(sender As Object, ByVal e As EventArgs) Handles tmFilterTimer.Tick
|
||||||
|
LoadData()
|
||||||
|
tmFilterTimer.Stop()
|
||||||
|
tmFilterTimer.Enabled = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub txtFilter_TextChanged(sender As Object, e As EventArgs) Handles txtFilter.TextChanged
|
Private Sub txtFilter_TextChanged(sender As Object, e As EventArgs) Handles txtFilter.TextChanged
|
||||||
@@ -46,16 +121,28 @@ Public Class frmSessions
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub tmFilterTimer_Tick(sender As Object, ByVal e As EventArgs) Handles tmFilterTimer.Tick
|
Private Sub dtpStart_ValueChanged(sender As Object, e As EventArgs) Handles dtpStart.ValueChanged
|
||||||
LoadData()
|
If bInitFinished Then LoadData()
|
||||||
tmFilterTimer.Stop()
|
|
||||||
tmFilterTimer.Enabled = False
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub frmSession_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub dtpEnd_ValueChanged(sender As Object, e As EventArgs) Handles dtpEnd.ValueChanged
|
||||||
SetForm()
|
If bInitFinished Then LoadData()
|
||||||
FormatGrid()
|
|
||||||
LoadData()
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click
|
||||||
|
Reset()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
|
||||||
|
Me.Close()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
|
||||||
|
If dgSessions.SelectedRows.Count > 0 Then
|
||||||
|
If mgrCommon.ShowMessage(frmSessions_ConfirmDelete, MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
|
||||||
|
DeleteSession()
|
||||||
|
Reset()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
@@ -261,6 +261,27 @@ Public Class mgrSQLite
|
|||||||
Return oData
|
Return oData
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function ReadSingleValue(ByVal sSQL As String, ByVal hshParams As Hashtable) As Object
|
||||||
|
|
||||||
|
Dim command As SqliteCommand
|
||||||
|
Dim oResult As New Object
|
||||||
|
|
||||||
|
Connect()
|
||||||
|
Command = New SqliteCommand(sSQL, db)
|
||||||
|
BuildParams(command, hshParams)
|
||||||
|
|
||||||
|
Try
|
||||||
|
oResult = command.ExecuteScalar()
|
||||||
|
Catch ex As Exception
|
||||||
|
mgrCommon.ShowMessage(mgrSQLite_ErrorQueryFailure, New String() {sSQL, ex.Message}, MsgBoxStyle.Information)
|
||||||
|
Finally
|
||||||
|
command.Dispose()
|
||||||
|
Disconnect()
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return oResult
|
||||||
|
End Function
|
||||||
|
|
||||||
Private Function GetDatabaseVersion() As Integer
|
Private Function GetDatabaseVersion() As Integer
|
||||||
Dim sSQL As String
|
Dim sSQL As String
|
||||||
Dim iVer As Integer
|
Dim iVer As Integer
|
||||||
|
|||||||
@@ -37,21 +37,90 @@
|
|||||||
Dim sSQL As String
|
Dim sSQL As String
|
||||||
Dim hshParams As New Hashtable
|
Dim hshParams As New Hashtable
|
||||||
|
|
||||||
sSQL = "SELECT Name, Start, End FROM sessions NATURAL JOIN monitorlist;"
|
sSQL = "SELECT sessions.MonitorID, monitorlist.Name, Start, End FROM sessions NATURAL JOIN monitorlist;"
|
||||||
|
|
||||||
Return oDatabase.ReadParamData(sSQL, hshParams)
|
Return oDatabase.ReadParamData(sSQL, hshParams)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Shared Function GetSessionsByGameName(ByVal sGameName As String, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As DataSet
|
Public Shared Function GetSessionRange(ByVal dtStart As DateTime, ByVal dtEnd As DateTime, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As DataSet
|
||||||
Dim oDatabase As New mgrSQLite(iSelectDB)
|
Dim oDatabase As New mgrSQLite(iSelectDB)
|
||||||
Dim sSQL As String
|
Dim sSQL As String
|
||||||
Dim hshParams As New Hashtable
|
Dim hshParams As New Hashtable
|
||||||
|
|
||||||
sSQL = "SELECT Name, Start, End FROM sessions NATURAL JOIN monitorlist WHERE monitorlist.Name LIKE @Name;"
|
sSQL = "SELECT sessions.MonitorID, monitorlist.Name, Start, End FROM sessions NATURAL JOIN monitorlist WHERE Start >= @Start AND End <= @End;"
|
||||||
|
|
||||||
hshParams.Add("Name", "%" & sGameName & "%")
|
hshParams.Add("Start", mgrCommon.DateToUnix(dtStart))
|
||||||
|
hshParams.Add("End", mgrCommon.DateToUnix(dtEnd))
|
||||||
|
|
||||||
Return oDatabase.ReadParamData(sSQL, hshParams)
|
Return oDatabase.ReadParamData(sSQL, hshParams)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function GetSessionsByGameNameAndRange(ByVal sGameName As String, ByVal dtStart As DateTime, ByVal dtEnd As DateTime, Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As DataSet
|
||||||
|
Dim oDatabase As New mgrSQLite(iSelectDB)
|
||||||
|
Dim sSQL As String
|
||||||
|
Dim hshParams As New Hashtable
|
||||||
|
|
||||||
|
sSQL = "SELECT sessions.MonitorID, monitorlist.Name, Start, End FROM sessions NATURAL JOIN monitorlist WHERE monitorlist.Name LIKE @Name AND (Start >= @Start AND End <= @End);"
|
||||||
|
|
||||||
|
hshParams.Add("Name", "%" & sGameName & "%")
|
||||||
|
hshParams.Add("Start", mgrCommon.DateToUnix(dtStart))
|
||||||
|
hshParams.Add("End", mgrCommon.DateToUnix(dtEnd))
|
||||||
|
|
||||||
|
Return oDatabase.ReadParamData(sSQL, hshParams)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Shared Sub DeleteSession(ByVal oSessions As List(Of clsSession), Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local)
|
||||||
|
Dim oDatabase As New mgrSQLite(iSelectDB)
|
||||||
|
Dim sSQL As String
|
||||||
|
Dim hshParams As Hashtable
|
||||||
|
Dim oParamList As New List(Of Hashtable)
|
||||||
|
|
||||||
|
sSQL = "DELETE FROM sessions WHERE MonitorID = @MonitorID AND Start = @Start;"
|
||||||
|
|
||||||
|
For Each oSession As clsSession In oSessions
|
||||||
|
hshParams = New Hashtable
|
||||||
|
hshParams.Add("MonitorID", oSession.MonitorID)
|
||||||
|
hshParams.Add("Start", mgrCommon.DateToUnix(oSession.SessionStart))
|
||||||
|
oParamList.Add(hshParams)
|
||||||
|
Next
|
||||||
|
|
||||||
|
oDatabase.RunMassParamQuery(sSQL, oParamList)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Shared Function GetMinimumDateTime(Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As DateTime
|
||||||
|
Dim oDatabase As New mgrSQLite(iSelectDB)
|
||||||
|
Dim sSQL As String
|
||||||
|
Dim hshParams As New Hashtable
|
||||||
|
Dim iUnixDate As Int64
|
||||||
|
|
||||||
|
sSQL = "SELECT Start FROM sessions ORDER BY Start ASC LIMIT 1"
|
||||||
|
|
||||||
|
iUnixDate = CInt(oDatabase.ReadSingleValue(sSQL, hshParams))
|
||||||
|
Return mgrCommon.UnixToDate(iUnixDate)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function GetMaximumDateTime(Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As DateTime
|
||||||
|
Dim oDatabase As New mgrSQLite(iSelectDB)
|
||||||
|
Dim sSQL As String
|
||||||
|
Dim hshParams As New Hashtable
|
||||||
|
Dim iUnixDate As Int64
|
||||||
|
|
||||||
|
sSQL = "SELECT End FROM sessions ORDER BY Start DESC LIMIT 1"
|
||||||
|
|
||||||
|
iUnixDate = CInt(oDatabase.ReadSingleValue(sSQL, hshParams))
|
||||||
|
Return mgrCommon.UnixToDate(iUnixDate)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function CountRows(Optional ByVal iSelectDB As mgrSQLite.Database = mgrSQLite.Database.Local) As Integer
|
||||||
|
Dim oDatabase As New mgrSQLite(iSelectDB)
|
||||||
|
Dim sSQL As String
|
||||||
|
Dim hshParams As New Hashtable
|
||||||
|
Dim iRowCount As Integer
|
||||||
|
|
||||||
|
sSQL = "SELECT COUNT(MonitorID) FROM sessions;"
|
||||||
|
|
||||||
|
iRowCount = CInt(oDatabase.ReadSingleValue(sSQL, hshParams))
|
||||||
|
|
||||||
|
Return iRowCount
|
||||||
|
End Function
|
||||||
End Class
|
End Class
|
||||||
Generated
+72
@@ -2949,6 +2949,15 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to There is currently no session data to display..
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmMain_ErrorNoSessions() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmMain_ErrorNoSessions", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to [PARAM] uses a relative path and has never been detected on this computer..
|
''' Looks up a localized string similar to [PARAM] uses a relative path and has never been detected on this computer..
|
||||||
'''</summary>
|
'''</summary>
|
||||||
@@ -3606,6 +3615,33 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to &Close.
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmSessions_btnClose() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmSessions_btnClose", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to &Delete Session.
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmSessions_btnDelete() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmSessions_btnDelete", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to &Reset Filters.
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmSessions_btnReset() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmSessions_btnReset", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to End.
|
''' Looks up a localized string similar to End.
|
||||||
'''</summary>
|
'''</summary>
|
||||||
@@ -3624,6 +3660,15 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to MonitorID.
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmSessions_ColumnMonitorID() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmSessions_ColumnMonitorID", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to Start.
|
''' Looks up a localized string similar to Start.
|
||||||
'''</summary>
|
'''</summary>
|
||||||
@@ -3633,6 +3678,33 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to Are you sure you want to delete the selected session(s)? This cannot be undone..
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmSessions_ConfirmDelete() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmSessions_ConfirmDelete", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to Date Range:.
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmSessions_lblDateRange() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmSessions_lblDateRange", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Looks up a localized string similar to Game Filter:.
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property frmSessions_lblFilter() As String
|
||||||
|
Get
|
||||||
|
Return ResourceManager.GetString("frmSessions_lblFilter", resourceCulture)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to Session Viewer.
|
''' Looks up a localized string similar to Session Viewer.
|
||||||
'''</summary>
|
'''</summary>
|
||||||
|
|||||||
@@ -1915,4 +1915,28 @@
|
|||||||
<data name="frmSessions_Name" xml:space="preserve">
|
<data name="frmSessions_Name" xml:space="preserve">
|
||||||
<value>Session Viewer</value>
|
<value>Session Viewer</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="frmMain_ErrorNoSessions" xml:space="preserve">
|
||||||
|
<value>There is currently no session data to display.</value>
|
||||||
|
</data>
|
||||||
|
<data name="frmSessions_btnClose" xml:space="preserve">
|
||||||
|
<value>&Close</value>
|
||||||
|
</data>
|
||||||
|
<data name="frmSessions_btnDelete" xml:space="preserve">
|
||||||
|
<value>&Delete Session</value>
|
||||||
|
</data>
|
||||||
|
<data name="frmSessions_btnReset" xml:space="preserve">
|
||||||
|
<value>&Reset Filters</value>
|
||||||
|
</data>
|
||||||
|
<data name="frmSessions_ColumnMonitorID" xml:space="preserve">
|
||||||
|
<value>MonitorID</value>
|
||||||
|
</data>
|
||||||
|
<data name="frmSessions_ConfirmDelete" xml:space="preserve">
|
||||||
|
<value>Are you sure you want to delete the selected session(s)? This cannot be undone.</value>
|
||||||
|
</data>
|
||||||
|
<data name="frmSessions_lblDateRange" xml:space="preserve">
|
||||||
|
<value>Date Range:</value>
|
||||||
|
</data>
|
||||||
|
<data name="frmSessions_lblFilter" xml:space="preserve">
|
||||||
|
<value>Game Filter:</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user