diff --git a/GBM/Forms/frmSessions.Designer.vb b/GBM/Forms/frmSessions.Designer.vb index 9c758f3..4b8e6dc 100644 --- a/GBM/Forms/frmSessions.Designer.vb +++ b/GBM/Forms/frmSessions.Designer.vb @@ -32,6 +32,7 @@ Partial Class frmSessions Me.btnDelete = New System.Windows.Forms.Button() Me.btnClose = New System.Windows.Forms.Button() Me.lblDateRange = New System.Windows.Forms.Label() + Me.lblTotalHours = New System.Windows.Forms.Label() CType(Me.dgSessions, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' @@ -134,11 +135,23 @@ Partial Class frmSessions Me.lblDateRange.TabIndex = 9 Me.lblDateRange.Text = "Date Range:" ' + 'lblTotalHours + ' + Me.lblTotalHours.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.lblTotalHours.Location = New System.Drawing.Point(118, 531) + Me.lblTotalHours.Name = "lblTotalHours" + Me.lblTotalHours.Size = New System.Drawing.Size(467, 13) + Me.lblTotalHours.TabIndex = 0 + Me.lblTotalHours.Text = "Total Hours:" + Me.lblTotalHours.TextAlign = System.Drawing.ContentAlignment.TopCenter + ' 'frmSessions ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(784, 561) + Me.Controls.Add(Me.lblTotalHours) Me.Controls.Add(Me.lblDateRange) Me.Controls.Add(Me.btnClose) Me.Controls.Add(Me.btnDelete) @@ -170,4 +183,5 @@ Partial Class frmSessions Friend WithEvents btnDelete As Button Friend WithEvents btnClose As Button Friend WithEvents lblDateRange As Label + Friend WithEvents lblTotalHours As Label End Class diff --git a/GBM/Forms/frmSessions.vb b/GBM/Forms/frmSessions.vb index acbaea7..8d04e6a 100644 --- a/GBM/Forms/frmSessions.vb +++ b/GBM/Forms/frmSessions.vb @@ -21,6 +21,7 @@ Public Class frmSessions dgSessions.Columns.Add("Start", frmSessions_ColumnStart) dgSessions.Columns.Add("EndUnix", frmSessions_ColumnEnd) dgSessions.Columns.Add("End", frmSessions_ColumnEnd) + dgSessions.Columns.Add("Hours", frmSessions_ColumnHours) 'Get Column Indexes iStartDataCol = dgSessions.Columns.IndexOf(dgSessions.Columns("StartUnix")) @@ -41,6 +42,10 @@ Public Class frmSessions Private Sub LoadData() Dim oData As DataSet Dim sFilter As String + Dim dStart As DateTime + Dim dEnd As DateTime + Dim iHours As Double + Dim iTotalHours As Double If txtFilter.Text = String.Empty Then oData = mgrSessions.GetSessionRange(dtpStart.Value, dtpEnd.Value) @@ -52,9 +57,15 @@ Public Class frmSessions dgSessions.Rows.Clear() For Each dr As DataRow In oData.Tables(0).Rows - dgSessions.Rows.Add(New Object() {dr("MonitorID"), dr("Name"), dr("Start"), mgrCommon.UnixToDate(dr("Start")), dr("End"), mgrCommon.UnixToDate(dr("End"))}) + dStart = mgrCommon.UnixToDate(dr("Start")) + dEnd = mgrCommon.UnixToDate(dr("End")) + iHours = Math.Round(dEnd.Subtract(dStart).TotalHours, 2) + iTotalHours += iHours + dgSessions.Rows.Add(New Object() {dr("MonitorID"), dr("Name"), dr("Start"), dStart, dr("End"), dEnd, iHours}) Next + lblTotalHours.Text = mgrCommon.FormatString(frmSessions_lblTotalHours, iTotalHours) + dgSessions.AutoResizeColumns() End Sub diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 39f1b9d..a5ad239 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -3669,6 +3669,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Hours. + ''' + Friend ReadOnly Property frmSessions_ColumnHours() As String + Get + Return ResourceManager.GetString("frmSessions_ColumnHours", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to MonitorID. ''' @@ -3714,6 +3723,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Total Hours: [PARAM]. + ''' + Friend ReadOnly Property frmSessions_lblTotalHours() As String + Get + Return ResourceManager.GetString("frmSessions_lblTotalHours", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Session Viewer. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 3f436d0..888e0db 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -1948,4 +1948,10 @@ Please note that GBM will not "Start with Windows" as Administrator.[BR][BR]See the Online Manual in the Help menu for details. + + Hours + + + Total Hours: [PARAM] + \ No newline at end of file