125 lines
4.9 KiB
VB.net
125 lines
4.9 KiB
VB.net
Imports DigitalData.Modules.Logging
|
|
Imports DevExpress.XtraTab
|
|
Public Class frmSearchStart
|
|
Private Logger As Logger
|
|
Private DTSearchProfiles As DataTable
|
|
Private TabSelected As XtraTabPage
|
|
Private PSEARCH_ID As Integer = 0
|
|
Public FormLoaded As Boolean = False
|
|
Private Const DEFAULT_X As Integer = 10
|
|
Private Const DEFAULT_Y As Integer = 10
|
|
|
|
Public Sub New(pDTSearchProfiles As DataTable)
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
DTSearchProfiles = pDTSearchProfiles
|
|
Logger = My.LogConfig.GetLogger()
|
|
End Sub
|
|
|
|
Private Sub WindowsUIButtonPanel1_Click(sender As Object, e As EventArgs) Handles WindowsUIButtonPanel1.Click
|
|
|
|
End Sub
|
|
|
|
Private Sub frmSearchStart_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
Try
|
|
Me.Panel1.Visible = False
|
|
For Each oTab As XtraTabPage In XtraTabControl1.TabPages
|
|
oTab.PageVisible = False
|
|
Next
|
|
If DTSearchProfiles.Rows.Count > 1 Then
|
|
cmbProfile.DataSource = DTSearchProfiles
|
|
cmbProfile.ValueMember = DTSearchProfiles.Columns("SEARCH_PROFILE_ID").ColumnName
|
|
cmbProfile.DisplayMember = DTSearchProfiles.Columns("TITLE").ColumnName
|
|
cmbProfile.AutoCompleteMode = AutoCompleteMode.Suggest
|
|
cmbProfile.AutoCompleteSource = AutoCompleteSource.ListItems
|
|
cmbProfile.SelectedIndex = -1
|
|
Me.Panel1.Visible = True
|
|
Else
|
|
TabSelected = XtraTabControl1.TabPages(0)
|
|
TabSelected.PageVisible = True
|
|
PSEARCH_ID = DTSearchProfiles.Rows(0).Item("SEARCH_PROFILE_ID")
|
|
TabSelected.Text = DTSearchProfiles.Rows(0).Item("TITLE")
|
|
Load_Search_Attributes()
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Logger.Error(ex.Message)
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error while loading ProfileSearches:")
|
|
End Try
|
|
FormLoaded = True
|
|
End Sub
|
|
Sub Load_Search_Attributes()
|
|
Dim oSQL = $"SELECT * FROM VWIDB_SEARCH_PROFILE_ATTRIBUTES WHERE SEARCH_PROFIL_ID = {PSEARCH_ID} ORDER BY [SEQUENCE]"
|
|
Dim oDT As DataTable = My.Database_IDB.GetDatatable(oSQL)
|
|
Dim oXPosition As Integer = 10
|
|
Dim oYPosition As Integer = 10
|
|
Dim oControlXPosition As Integer = 33
|
|
Dim oControlCount As Integer = 1
|
|
Dim oControlRow As Integer = 0
|
|
Dim oControls As New ClassControlCreator(TabSelected, Me)
|
|
For Each oAttributeRow As DataRow In oDT.Rows
|
|
Dim oAttriName As String = oAttributeRow.Item("ATTRIBUTE_TITLE").ToString
|
|
Dim oAttriID As String = oAttributeRow.Item("ATTRIBUTE_ID").ToString
|
|
Dim oAttriTYPE As String = oAttributeRow.Item("ATTRIBUTE_TYPE").ToString
|
|
If oControlCount = 1 Or oControlCount = 3 Or oControlCount = 5 Then
|
|
'linke Spalte
|
|
oControlRow += 1
|
|
End If
|
|
Select Case oControlCount
|
|
Case 2
|
|
oXPosition = oXPosition + 150 + 20
|
|
End Select
|
|
Select Case oControlRow
|
|
Case 1
|
|
oYPosition = DEFAULT_Y
|
|
If oControlCount > 1 Then
|
|
oXPosition = DEFAULT_X + 170
|
|
End If
|
|
Case 2
|
|
oYPosition = DEFAULT_Y + 150 + 20
|
|
If oControlCount = 4 Then
|
|
oXPosition = DEFAULT_X + 170
|
|
End If
|
|
|
|
End Select
|
|
|
|
addLabel(oAttriName, oXPosition, oYPosition)
|
|
|
|
|
|
|
|
|
|
Dim oMyControl As Control
|
|
Select Case oAttriTYPE
|
|
Case "VARCHAR"
|
|
oMyControl = oControls.CreateExistingGridControl(oAttributeRow, oXPosition, oYPosition + 25)
|
|
Case "DATE"
|
|
End Select
|
|
TabSelected.Controls.Add(oMyControl)
|
|
|
|
|
|
oControlCount += 1
|
|
Next
|
|
End Sub
|
|
Sub addLabel(pAttrName As String, pXPos As Integer, ylbl As Integer)
|
|
Dim lbl As New Label With {
|
|
.Name = "lbl" & pAttrName,
|
|
.AutoSize = True,
|
|
.Text = pAttrName,
|
|
.Location = New Point(pXPos, ylbl)
|
|
}
|
|
|
|
TabSelected.Controls.Add(lbl)
|
|
End Sub
|
|
Private Sub WindowsUIButtonPanel1_ButtonClick(sender As Object, e As DevExpress.XtraBars.Docking2010.ButtonEventArgs) Handles WindowsUIButtonPanel1.ButtonClick
|
|
Select Case e.Button.Properties.Tag.ToString
|
|
Case "Run"
|
|
MsgBox("Start Search")
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub XtraTabControl1_SelectedPageChanged(sender As Object, e As DevExpress.XtraTab.TabPageChangedEventArgs) Handles XtraTabControl1.SelectedPageChanged
|
|
TabSelected = XtraTabControl1.SelectedTabPage
|
|
End Sub
|
|
End Class |