295 lines
12 KiB
VB.net
295 lines
12 KiB
VB.net
Imports System.Windows.Forms
|
|
|
|
Public Class BaseQueryForm
|
|
Inherits Windows.Forms.Form
|
|
|
|
Private mintCurrentQueryBySortColumn As Integer
|
|
Private mintCurrentReportSortColumn As Integer
|
|
Private mobjQueryFormQueryByItemColumnSortRules() As clsGridColumnSortRule
|
|
Private mobjQueryFormReportItemColumnSortRules() As clsGridColumnSortRule
|
|
|
|
#Region " Windows Form Designer generated code "
|
|
|
|
Public Sub New()
|
|
MyBase.New()
|
|
|
|
'This call is required by the Windows Form Designer.
|
|
InitializeComponent()
|
|
|
|
'Add any initialization after the InitializeComponent() call
|
|
|
|
End Sub
|
|
|
|
'Form overrides dispose to clean up the component list.
|
|
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
|
|
If disposing Then
|
|
If Not (components Is Nothing) Then
|
|
components.Dispose()
|
|
End If
|
|
End If
|
|
MyBase.Dispose(disposing)
|
|
End Sub
|
|
|
|
'Required by the Windows Form Designer
|
|
Private components As System.ComponentModel.IContainer
|
|
|
|
'NOTE: The following procedure is required by the Windows Form Designer
|
|
'It can be modified using the Windows Form Designer.
|
|
'Do not modify it using the code editor.
|
|
Private WithEvents btnExit As Windows.Forms.Button
|
|
Protected WithEvents fraReport As Windows.Forms.GroupBox
|
|
Private WithEvents lvwReportItemsList As Windows.Forms.ListView
|
|
Friend WithEvents fraQueryBy As Windows.Forms.GroupBox
|
|
Private WithEvents lvwQueryByItemsList As Windows.Forms.ListView
|
|
Friend WithEvents fraOtherQueryParms As Windows.Forms.GroupBox
|
|
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
|
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(BaseQueryForm))
|
|
Me.btnExit = New Windows.Forms.Button
|
|
Me.fraReport = New Windows.Forms.GroupBox
|
|
Me.lvwReportItemsList = New Windows.Forms.ListView
|
|
Me.fraQueryBy = New Windows.Forms.GroupBox
|
|
Me.lvwQueryByItemsList = New Windows.Forms.ListView
|
|
Me.fraOtherQueryParms = New Windows.Forms.GroupBox
|
|
Me.fraReport.SuspendLayout()
|
|
Me.fraQueryBy.SuspendLayout()
|
|
Me.SuspendLayout()
|
|
'
|
|
'btnExit
|
|
'
|
|
Me.btnExit.Anchor = CType((Windows.Forms.AnchorStyles.Top Or Windows.Forms.AnchorStyles.Right), Windows.Forms.AnchorStyles)
|
|
Me.btnExit.Location = New System.Drawing.Point(976, 16)
|
|
Me.btnExit.Name = "btnExit"
|
|
Me.btnExit.Size = New System.Drawing.Size(96, 24)
|
|
Me.btnExit.TabIndex = 2
|
|
Me.btnExit.Text = "E&xit"
|
|
'
|
|
'fraReport
|
|
'
|
|
Me.fraReport.Anchor = CType(((Windows.Forms.AnchorStyles.Bottom Or Windows.Forms.AnchorStyles.Left) _
|
|
Or Windows.Forms.AnchorStyles.Right), Windows.Forms.AnchorStyles)
|
|
Me.fraReport.Controls.Add(Me.lvwReportItemsList)
|
|
Me.fraReport.Location = New System.Drawing.Point(10, 320)
|
|
Me.fraReport.Name = "fraReport"
|
|
Me.fraReport.Size = New System.Drawing.Size(1064, 272)
|
|
Me.fraReport.TabIndex = 1
|
|
Me.fraReport.TabStop = False
|
|
Me.fraReport.Text = "Add..."
|
|
'
|
|
'lvwReportItemsList
|
|
'
|
|
Me.lvwReportItemsList.Anchor = CType((((Windows.Forms.AnchorStyles.Top Or Windows.Forms.AnchorStyles.Bottom) _
|
|
Or Windows.Forms.AnchorStyles.Left) _
|
|
Or Windows.Forms.AnchorStyles.Right), Windows.Forms.AnchorStyles)
|
|
Me.lvwReportItemsList.FullRowSelect = True
|
|
Me.lvwReportItemsList.GridLines = True
|
|
Me.lvwReportItemsList.HideSelection = False
|
|
Me.lvwReportItemsList.Location = New System.Drawing.Point(8, 16)
|
|
Me.lvwReportItemsList.MultiSelect = False
|
|
Me.lvwReportItemsList.Name = "lvwReportItemsList"
|
|
Me.lvwReportItemsList.Size = New System.Drawing.Size(960, 312)
|
|
Me.lvwReportItemsList.TabIndex = 0
|
|
Me.lvwReportItemsList.UseCompatibleStateImageBehavior = False
|
|
Me.lvwReportItemsList.View = Windows.Forms.View.Details
|
|
'
|
|
'fraQueryBy
|
|
'
|
|
Me.fraQueryBy.Anchor = CType(((Windows.Forms.AnchorStyles.Bottom Or Windows.Forms.AnchorStyles.Left) _
|
|
Or Windows.Forms.AnchorStyles.Right), Windows.Forms.AnchorStyles)
|
|
Me.fraQueryBy.Controls.Add(Me.lvwQueryByItemsList)
|
|
Me.fraQueryBy.Controls.Add(Me.fraOtherQueryParms)
|
|
Me.fraQueryBy.Location = New System.Drawing.Point(10, 10)
|
|
Me.fraQueryBy.Name = "fraQueryBy"
|
|
Me.fraQueryBy.Size = New System.Drawing.Size(958, 302)
|
|
Me.fraQueryBy.TabIndex = 0
|
|
Me.fraQueryBy.TabStop = False
|
|
Me.fraQueryBy.Text = "Query By"
|
|
'
|
|
'lvwQueryByItemsList
|
|
'
|
|
Me.lvwQueryByItemsList.Anchor = CType((((Windows.Forms.AnchorStyles.Top Or Windows.Forms.AnchorStyles.Bottom) _
|
|
Or Windows.Forms.AnchorStyles.Left) _
|
|
Or Windows.Forms.AnchorStyles.Right), Windows.Forms.AnchorStyles)
|
|
Me.lvwQueryByItemsList.FullRowSelect = True
|
|
Me.lvwQueryByItemsList.GridLines = True
|
|
Me.lvwQueryByItemsList.HideSelection = False
|
|
Me.lvwQueryByItemsList.Location = New System.Drawing.Point(8, 16)
|
|
Me.lvwQueryByItemsList.MultiSelect = False
|
|
Me.lvwQueryByItemsList.Name = "lvwQueryByItemsList"
|
|
Me.lvwQueryByItemsList.Size = New System.Drawing.Size(944, 200)
|
|
Me.lvwQueryByItemsList.TabIndex = 0
|
|
Me.lvwQueryByItemsList.UseCompatibleStateImageBehavior = False
|
|
Me.lvwQueryByItemsList.View = Windows.Forms.View.Details
|
|
'
|
|
'fraOtherQueryParms
|
|
'
|
|
Me.fraOtherQueryParms.Anchor = CType(((Windows.Forms.AnchorStyles.Bottom Or Windows.Forms.AnchorStyles.Left) _
|
|
Or Windows.Forms.AnchorStyles.Right), Windows.Forms.AnchorStyles)
|
|
Me.fraOtherQueryParms.Location = New System.Drawing.Point(8, 216)
|
|
Me.fraOtherQueryParms.Name = "fraOtherQueryParms"
|
|
Me.fraOtherQueryParms.Size = New System.Drawing.Size(944, 75)
|
|
Me.fraOtherQueryParms.TabIndex = 1
|
|
Me.fraOtherQueryParms.TabStop = False
|
|
'
|
|
'BaseQueryForm
|
|
'
|
|
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
|
|
Me.ClientSize = New System.Drawing.Size(1080, 598)
|
|
Me.Controls.Add(Me.fraQueryBy)
|
|
Me.Controls.Add(Me.fraReport)
|
|
Me.Controls.Add(Me.btnExit)
|
|
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
|
Me.MinimumSize = New System.Drawing.Size(848, 568)
|
|
Me.Name = "BaseQueryForm"
|
|
Me.Text = "BaseQueryForm"
|
|
Me.fraReport.ResumeLayout(False)
|
|
Me.fraQueryBy.ResumeLayout(False)
|
|
Me.ResumeLayout(False)
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
Private Sub BaseQueryForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|
If Me.DesignMode Then
|
|
MessageBox.Show("The BaseQueryForm class must be inherited, and contains methods that must be overridden." + vbCrLf + "They have been declared in the base class and will throw NotImplementedException at runtime if not overridden.")
|
|
End If
|
|
lvwQueryByItemsList.Sorting = SortOrder.None
|
|
lvwReportItemsList.Sorting = SortOrder.None
|
|
LoadQueryByItemsList()
|
|
InitializeReportControls()
|
|
Dim lobjQueryByColumnClickEventArgs As New Windows.Forms.ColumnClickEventArgs(0)
|
|
lvwQueryByItemsList_ColumnClick(Me, lobjQueryByColumnClickEventArgs)
|
|
Dim lobjReportColumnClickEventArgs As New Windows.Forms.ColumnClickEventArgs(0)
|
|
lvwReportItemsList_ColumnClick(Me, lobjReportColumnClickEventArgs)
|
|
fraQueryBy.Height() = fraReport.Top - fraQueryBy.Top - 10
|
|
If fraOtherQueryParms.Controls.Count > 0 Then
|
|
fraOtherQueryParms.Visible = False
|
|
lvwQueryByItemsList.Height = fraQueryBy.Height - 10
|
|
Else
|
|
lvwQueryByItemsList.Height = fraOtherQueryParms.Top - 10
|
|
End If
|
|
lvwReportItemsList.Height = fraReport.Height - 10
|
|
End Sub
|
|
|
|
Protected Overridable Sub LoadQueryByItemsList()
|
|
If Not Me.DesignMode Then
|
|
Throw New NotImplementedException
|
|
End If
|
|
End Sub
|
|
|
|
Protected Overridable Sub InitializeReportControls()
|
|
If Not Me.DesignMode Then
|
|
Throw New NotImplementedException
|
|
End If
|
|
End Sub
|
|
|
|
Protected Overridable Function ReportOnQueryByItem(ByVal lstvwQueryByItem As ListViewItem) As Boolean
|
|
If Not Me.DesignMode Then
|
|
Throw New NotImplementedException
|
|
End If
|
|
End Function
|
|
|
|
Protected Overridable Function UserWantsDetailOnResult(ByVal lstvwResultItem As ListViewItem) As Boolean
|
|
If Not Me.DesignMode Then
|
|
Throw New NotImplementedException
|
|
End If
|
|
End Function
|
|
|
|
Protected Overridable Sub UserRequestedToExit()
|
|
If Not Me.DesignMode Then
|
|
Throw New NotImplementedException
|
|
End If
|
|
End Sub
|
|
|
|
Protected ReadOnly Property QueryByListItems() As ListView.ListViewItemCollection
|
|
Get
|
|
Return lvwQueryByItemsList.Items
|
|
End Get
|
|
End Property
|
|
|
|
Protected ReadOnly Property QueryByListColumns() As ListView.ColumnHeaderCollection
|
|
Get
|
|
Return lvwQueryByItemsList.Columns
|
|
End Get
|
|
End Property
|
|
|
|
Protected Property MyBaseQueryFormQueryByColumnSortRules() As clsGridColumnSortRule()
|
|
Get
|
|
Return mobjQueryFormQueryByItemColumnSortRules
|
|
End Get
|
|
Set(ByVal iValue As clsGridColumnSortRule())
|
|
mobjQueryFormQueryByItemColumnSortRules = iValue
|
|
End Set
|
|
End Property
|
|
|
|
Protected ReadOnly Property ReportListItems() As ListView.ListViewItemCollection
|
|
Get
|
|
Return lvwReportItemsList.Items
|
|
End Get
|
|
End Property
|
|
|
|
Protected ReadOnly Property ReportListColumns() As ListView.ColumnHeaderCollection
|
|
Get
|
|
Return lvwReportItemsList.Columns
|
|
End Get
|
|
End Property
|
|
|
|
Protected Property MyBaseQueryFormReportColumnSortRules() As clsGridColumnSortRule()
|
|
Get
|
|
Return mobjQueryFormReportItemColumnSortRules
|
|
End Get
|
|
Set(ByVal iValue As clsGridColumnSortRule())
|
|
mobjQueryFormReportItemColumnSortRules = iValue
|
|
End Set
|
|
End Property
|
|
|
|
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
|
|
UserRequestedToExit()
|
|
End Sub
|
|
|
|
Private Sub lvwQueryByItemsList_ColumnClick(ByVal sender As System.Object, ByVal e As Windows.Forms.ColumnClickEventArgs)
|
|
mintCurrentQueryBySortColumn = e.Column
|
|
lvwQueryByItemsList.ListViewItemSorter = New clsGridSorter(e.Column, mobjQueryFormQueryByItemColumnSortRules)
|
|
End Sub
|
|
|
|
Private Sub lvwQueryByItemsList_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
|
DoReportClick()
|
|
End Sub
|
|
|
|
Private Sub lvwReportItemsList_ColumnClick(ByVal sender As System.Object, ByVal e As Windows.Forms.ColumnClickEventArgs) Handles lvwReportItemsList.ColumnClick
|
|
mintCurrentReportSortColumn = e.Column
|
|
lvwReportItemsList.ListViewItemSorter = New clsGridSorter(e.Column, mobjQueryFormReportItemColumnSortRules)
|
|
End Sub
|
|
|
|
Private Sub lvwReportItemsList_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvwReportItemsList.DoubleClick
|
|
DoUserWantsDetailOnResult()
|
|
End Sub
|
|
|
|
Private Sub DoReportClick()
|
|
If lvwQueryByItemsList.SelectedItems.Count = 0 Then
|
|
MessageBox.Show("Must select an item to query by", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Exit Sub
|
|
End If
|
|
|
|
ReportOnQueryByItem(lvwQueryByItemsList.SelectedItems(0))
|
|
'Check if there are results - if so show them
|
|
' - if not hide them
|
|
If lvwReportItemsList.Items.Count = 0 Then
|
|
lvwReportItemsList.Visible = False
|
|
Else
|
|
lvwReportItemsList.Visible = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub DoUserWantsDetailOnResult()
|
|
If lvwReportItemsList.SelectedItems.Count = 0 Then
|
|
MessageBox.Show("Must select an item to show details results for", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Exit Sub
|
|
End If
|
|
|
|
UserWantsDetailOnResult(lvwReportItemsList.SelectedItems(0))
|
|
End Sub
|
|
|
|
End Class
|
|
|