202 lines
6.8 KiB
VB.net
202 lines
6.8 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports System.Windows.Documents
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
|
|
Public Class usrCntlDatenarchiv
|
|
|
|
|
|
Dim DatenarchivBind As cEasyBinding
|
|
Public table
|
|
Public BIND_DB
|
|
Private EditRow As Integer = -1
|
|
Sub New(table, BIND_DB)
|
|
Me.table = table
|
|
Me.BIND_DB = BIND_DB
|
|
InitializeComponent()
|
|
End Sub
|
|
|
|
|
|
Private Sub usrCntlDatenarchiv_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
loaddgv()
|
|
|
|
'cboPartnersystem.Items.Clear()
|
|
Dim distinctDT As DataTable = DatenarchivBind.bindingdataTable.DefaultView.ToTable(True, "Param_system")
|
|
|
|
For Each d As DataRow In distinctDT.Rows
|
|
If Not cboPartnersystem.Items.Contains(d.Item(0)) Then cboPartnersystem.Items.Add(d.Item(0))
|
|
Next
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub btnSuche_Click(sender As Object, e As EventArgs) Handles btnSuche.Click
|
|
Me.Cursor = Cursors.WaitCursor
|
|
|
|
loaddgv()
|
|
|
|
Me.Cursor = Cursors.Default
|
|
End Sub
|
|
|
|
Function getAPIList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
|
|
|
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
|
|
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Param_system", cboPartnersystem._value))
|
|
|
|
Return list
|
|
|
|
End Function
|
|
|
|
Function getDatenarchivwhere() As String
|
|
|
|
Dim sqlstr = ""
|
|
If cboPartnersystem._value <> "" Then sqlstr &= " AND [Param_system] = '" & cboPartnersystem._value & "'"
|
|
|
|
Return sqlstr
|
|
End Function
|
|
|
|
|
|
Private Sub DataGridView_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView.CellDoubleClick
|
|
Me.Cursor = Cursors.WaitCursor
|
|
Dim tmprowindex As Integer = e.RowIndex
|
|
If DataGridView.Columns(e.ColumnIndex).Name = "open" Then
|
|
|
|
If DataGridView.CurrentRow.Cells("Param_value").Value IsNot DBNull.Value AndAlso DataGridView.CurrentRow.Cells("Param_value").Value.ToString.StartsWith("\\") Then
|
|
Process.Start(DataGridView.CurrentRow.Cells("Param_value").Value)
|
|
End If
|
|
Else
|
|
|
|
End If
|
|
Me.Cursor = Cursors.Default
|
|
End Sub
|
|
|
|
Private Sub cbxProduktivsystem_CheckedChanged(sender As Object, e As EventArgs) Handles cbxTestsystem.CheckedChanged
|
|
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = cbxTestsystem.Checked
|
|
|
|
DatenarchivBind = New cEasyBinding(BIND_DB)
|
|
|
|
|
|
Dim sqlstr As String = ""
|
|
Dim TopMax = If(IsNumeric(txtMaxSrch.Text), " TOP " & txtMaxSrch.Text, "")
|
|
|
|
|
|
DatenarchivBind.initBinding("SELECT " & TopMax & " [Param_name],[Param_value], [Param_system] FROM " & table & " WHERE 1 = 1 " & getDatenarchivwhere(), table)
|
|
|
|
DataGridView.DataSource = DatenarchivBind.bindingdataTable
|
|
|
|
Dim distinctDT As DataTable = DatenarchivBind.bindingdataTable.DefaultView.ToTable(True, "Param_system")
|
|
|
|
For Each d As DataRow In distinctDT.Rows
|
|
If Not cboPartnersystem.Items.Contains(d.Item(0)) Then cboPartnersystem.Items.Add(d.Item(0))
|
|
Next
|
|
|
|
Me.usrCntlDatenarchiv_Load(sender, e)
|
|
|
|
End Sub
|
|
|
|
Private Sub cboPartnersystem_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPartnersystem.SelectedIndexChanged
|
|
btnSuche_Click(sender, e)
|
|
End Sub
|
|
|
|
|
|
Public Sub loaddgv()
|
|
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = cbxTestsystem.Checked
|
|
|
|
Try
|
|
DatenarchivBind = New cEasyBinding(BIND_DB)
|
|
|
|
|
|
Dim sqlstr As String = ""
|
|
Dim TopMax = If(IsNumeric(txtMaxSrch.Text), " TOP " & txtMaxSrch.Text, "")
|
|
|
|
|
|
DatenarchivBind.initBinding("SELECT " & TopMax & " [Param_name],[Param_value], [Param_system] FROM " & table & " WHERE 1 = 1 " & getDatenarchivwhere(), table)
|
|
|
|
DataGridView.DataSource = DatenarchivBind.bindingdataTable
|
|
|
|
|
|
With DataGridView
|
|
|
|
If .RowCount = 0 Then Me.Cursor = Cursors.Default : Exit Sub
|
|
.RowHeadersVisible = False
|
|
.ReadOnly = False
|
|
'.SelectionMode = DataGridViewSelectionMode.FullRowSelect
|
|
.MultiSelect = False
|
|
|
|
|
|
For Each cc As DataGridViewColumn In .Columns
|
|
If cc.Name.ToLower.Contains("param_") Then
|
|
cc.HeaderText = cc.Name.Replace("Param_", "")
|
|
If cc.Name.ToLower.Contains("value") Then
|
|
cc.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
|
Else
|
|
cc.Width = 200
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
|
|
lblErgebnis.Text = "Ergebnisse: " & .RowCount
|
|
|
|
|
|
If .Columns("open") Is Nothing Then
|
|
|
|
Dim c As New DataGridViewImageColumn
|
|
c.Name = "open" : c.HeaderText = "open"
|
|
c.Image = New Bitmap(1, 1)
|
|
c.Width = 40 : c.DefaultCellStyle.Padding = New Padding(2) : c.DefaultCellStyle.BackColor = Color.White
|
|
c.DefaultCellStyle.Tag = "open"
|
|
.Columns.Add(c)
|
|
|
|
End If
|
|
|
|
For Each r As DataGridViewRow In .Rows
|
|
|
|
If r.Cells("Param_value").Value IsNot DBNull.Value AndAlso r.Cells("Param_value").Value.ToString.StartsWith("\\") Then
|
|
DirectCast(r.Cells("open"), DataGridViewImageCell).Value = My.Resources.search
|
|
|
|
End If
|
|
Next
|
|
|
|
|
|
End With
|
|
|
|
Catch ex As Exception
|
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnSave.Click
|
|
|
|
If DataGridView.Columns.Count = 0 Or DataGridView.SelectedRows.Count = 0 Then 'alles gelöscht oder markierte Zeile gelöscht
|
|
DatenarchivBind.updateBinding()
|
|
Exit Sub
|
|
End If
|
|
|
|
If DataGridView.CurrentRow.Cells("Param_name").ToString <> "" AndAlso DataGridView.CurrentRow.Cells("Param_value").ToString <> "" AndAlso DataGridView.CurrentRow.Cells("Param_system").ToString <> "" AndAlso EditRow >= 0 Then
|
|
DatenarchivBind.updateBinding()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub DataGridView_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles DataGridView.EditingControlShowing
|
|
EditRow = DataGridView.CurrentRow.Index
|
|
End Sub
|
|
|
|
Private Sub DataGridView_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView.SelectionChanged
|
|
If EditRow >= 0 Then
|
|
Dim new_row As Integer = EditRow
|
|
EditRow = -1
|
|
DataGridView.CurrentCell = DataGridView.Rows(new_row).Cells(
|
|
DataGridView.CurrentCell.ColumnIndex)
|
|
End If
|
|
End Sub
|
|
|
|
End Class
|