diff --git a/GBM/Classes/clsSession.vb b/GBM/Classes/clsSession.vb index cec5e2b..9aadd7f 100644 --- a/GBM/Classes/clsSession.vb +++ b/GBM/Classes/clsSession.vb @@ -1,9 +1,8 @@ Public Class clsSession Private sMonitorID As String - Private dStart As DateTime - Private dEnd As DateTime - Private sComputerName As String = My.Computer.Name + Private iStart As Int64 + Private iEnd As Int64 Public Property MonitorID As String Set(value As String) @@ -14,31 +13,45 @@ End Get End Property - Public Property SessionStart As DateTime + Public Property SessionStart As Int64 + Set(value As Int64) + iStart = value + End Set + Get + Return iStart + End Get + End Property + + Public WriteOnly Property SessionStartFromDate As DateTime Set(value As DateTime) - dStart = value + iStart = mgrCommon.DateToUnix(value) End Set + End Property + + Public ReadOnly Property SessionStartFormatted As DateTime Get - Return dStart + Return mgrCommon.UnixToDate(iStart) End Get End Property - Public Property SessionEnd As DateTime + Public Property SessionEnd As Int64 + Set(value As Int64) + iEnd = value + End Set + Get + Return iEnd + End Get + End Property + + Public WriteOnly Property SessionEndFromDate As DateTime Set(value As DateTime) - dEnd = value + iEnd = mgrCommon.DateToUnix(value) End Set - Get - Return dEnd - End Get End Property - Public Property ComputerName As String - Set(value As String) - sComputerName = value - End Set + Public ReadOnly Property SessionEndFormatted As DateTime Get - Return sComputerName + Return mgrCommon.UnixToDate(iEnd) End Get End Property - End Class diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index bd87007..0be064a 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -722,8 +722,8 @@ Public Class frmMain 'Record Session oSession = New clsSession oSession.MonitorID = oProcess.GameInfo.ID - oSession.SessionStart = oProcess.StartTime - oSession.SessionEnd = oProcess.EndTime + oSession.SessionStartFromDate = oProcess.StartTime + oSession.SessionEndFromDate = oProcess.EndTime mgrSessions.AddSession(oSession) End If diff --git a/GBM/Forms/frmSessions.vb b/GBM/Forms/frmSessions.vb index f7a76a2..b7371dc 100644 --- a/GBM/Forms/frmSessions.vb +++ b/GBM/Forms/frmSessions.vb @@ -7,13 +7,14 @@ Public Class frmSessions Private bInitFinished As Boolean = False Private WithEvents tmFilterTimer As Timer Private bStartSortAsc As Boolean = True - Private iStartSortCol As Integer = 2 - Private iStartDisplayCol As Integer = 3 + Private iStartDataCol As Integer + Private iStartDisplayCol As Integer Private bEndSortAsc As Boolean = True - Private iEndSortCol As Integer = 4 - Private iEndDisplayCol As Integer = 5 + Private iEndDataCol As Integer + Private iEndDisplayCol As Integer Private Sub FormatGrid() + 'Build Columns dgSessions.Columns.Add("MonitorID", frmSessions_ColumnMonitorID) dgSessions.Columns.Add("Name", frmSessions_ColumnGameName) dgSessions.Columns.Add("StartUnix", frmSessions_ColumnStart) @@ -21,6 +22,12 @@ Public Class frmSessions dgSessions.Columns.Add("EndUnix", frmSessions_ColumnEnd) dgSessions.Columns.Add("End", frmSessions_ColumnEnd) + 'Get Column Indexes + iStartDataCol = dgSessions.Columns.IndexOf(dgSessions.Columns("StartUnix")) + iStartDisplayCol = dgSessions.Columns.IndexOf(dgSessions.Columns("Start")) + iEndDataCol = dgSessions.Columns.IndexOf(dgSessions.Columns("EndUnix")) + iEndDisplayCol = dgSessions.Columns.IndexOf(dgSessions.Columns("End")) + 'Set Sorting dgSessions.Columns("Start").SortMode = DataGridViewColumnSortMode.Programmatic dgSessions.Columns("End").SortMode = DataGridViewColumnSortMode.Programmatic @@ -116,8 +123,8 @@ Public Class frmSessions For Each dgvRow As DataGridViewRow In dgSessions.SelectedRows oSession = New clsSession oSession.MonitorID = dgvRow.Cells(0).Value - oSession.SessionStart = dgvRow.Cells(iStartDisplayCol).Value - oSession.SessionEnd = dgvRow.Cells(iEndDisplayCol).Value + oSession.SessionStart = CInt(dgvRow.Cells(iStartDataCol).Value) + oSession.SessionEnd = CInt(dgvRow.Cells(iEndDataCol).Value) oSessions.Add(oSession) Next @@ -151,10 +158,10 @@ Public Class frmSessions Select Case iCol Case iStartDisplayCol bStartSortAsc = Not bStartSortAsc - dgSessions.Sort(dgSessions.Columns(iStartSortCol), GetSortOrder(bStartSortAsc, iCol)) + dgSessions.Sort(dgSessions.Columns(iCol), GetSortOrder(bStartSortAsc, iCol)) Case iEndDisplayCol bEndSortAsc = Not bEndSortAsc - dgSessions.Sort(dgSessions.Columns(iEndSortCol), GetSortOrder(bEndSortAsc, iCol)) + dgSessions.Sort(dgSessions.Columns(iCol), GetSortOrder(bEndSortAsc, iCol)) End Select End Sub diff --git a/GBM/Managers/mgrSessions.vb b/GBM/Managers/mgrSessions.vb index ab68b43..95d487d 100644 --- a/GBM/Managers/mgrSessions.vb +++ b/GBM/Managers/mgrSessions.vb @@ -4,8 +4,8 @@ Dim oSession As New clsSession oSession.MonitorID = CStr(dr("MonitorID")) - oSession.SessionStart = mgrCommon.UnixToDate(CInt(dr("Start"))) - oSession.SessionEnd = mgrCommon.UnixToDate(CInt(dr("End"))) + oSession.SessionStart = CInt(dr("Start")) + oSession.SessionEnd = CInt(dr("End")) Return oSession End Function @@ -14,8 +14,8 @@ Dim hshParams As New Hashtable hshParams.Add("MonitorID", oSession.MonitorID) - hshParams.Add("Start", mgrCommon.DateToUnix(oSession.SessionStart)) - hshParams.Add("End", mgrCommon.DateToUnix(oSession.SessionEnd)) + hshParams.Add("Start", oSession.SessionStart) + hshParams.Add("End", oSession.SessionEnd) Return hshParams End Function @@ -80,7 +80,7 @@ For Each oSession As clsSession In oSessions hshParams = New Hashtable hshParams.Add("MonitorID", oSession.MonitorID) - hshParams.Add("Start", mgrCommon.DateToUnix(oSession.SessionStart)) + hshParams.Add("Start", oSession.SessionStart) oParamList.Add(hshParams) Next