130 lines
3.9 KiB
VB.net
130 lines
3.9 KiB
VB.net
Imports iText.Forms.Xfdf
|
|
Imports iText.Kernel.Pdf
|
|
Imports System.Web.UI
|
|
|
|
Public Class frmAvisoAnhangsarten
|
|
|
|
|
|
Dim SPRACHENBind 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 frmSprachen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
loadDGV()
|
|
' btnOK.Visible = True
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub loadDGV(Optional sqlwhere As String = "")
|
|
|
|
Try
|
|
SPRACHENBind = New cEasyBinding(BIND_DB)
|
|
|
|
|
|
If sqlwhere = "" Then
|
|
|
|
SPRACHENBind.initBinding("SELECT * FROM " & table, table)
|
|
Else
|
|
|
|
SPRACHENBind.initBinding("SELECT * FROM " & table & " WHERE " & sqlwhere, table)
|
|
|
|
End If
|
|
|
|
DataGridView.DataSource = SPRACHENBind.bindingdataTable
|
|
|
|
With DataGridView
|
|
|
|
If .Columns.Count > 0 Then
|
|
.Columns("aa_id").Visible = False
|
|
.Columns("aa_name").HeaderText = "Name"
|
|
.Columns("aa_name").Width = 150
|
|
.Columns("aa_sort").HeaderText = "Sort."
|
|
.Columns("aa_sort").Width = 40
|
|
.Columns("aa_isBrexti").HeaderText = "Brexit"
|
|
.Columns("aa_isBrexti").Width = 40
|
|
.Columns("aa_aktiv").HeaderText = "Aktiv"
|
|
.Columns("aa_aktiv").Width = 40
|
|
.Columns("aa_bezeichnung").HeaderText = "Bezeichnung"
|
|
.Columns("aa_bezeichnung").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
|
.Columns("aa_firma").HeaderText = "nur für Firma"
|
|
.Columns("aa_firma").Width = 100
|
|
.Columns("aa_filiale").HeaderText = "nur für Filiale"
|
|
.Columns("aa_filiale").Width = 100
|
|
End If
|
|
|
|
End With
|
|
|
|
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox1_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles txtSuche.PreviewKeyDown
|
|
|
|
Dim sqladdon As String = ""
|
|
|
|
If e.KeyCode = Keys.Enter Then
|
|
If txtSuche.Text <> "" Then
|
|
sqladdon &= " [aa_name] like '%" & txtSuche.Text & "%' or [aa_bezeichnung] like '%" & txtSuche.Text & "%'"
|
|
End If
|
|
loadDGV(sqladdon)
|
|
End If
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub DataGridView_DefaultValuesNeeded(sender As Object, e As DataGridViewRowEventArgs) Handles DataGridView.DefaultValuesNeeded
|
|
Try
|
|
|
|
e.Row.Cells("aa_aktiv").Value = True
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
|
|
|
|
If DataGridView.Columns.Count = 0 Or DataGridView.SelectedRows.Count = 0 Then 'alles gelöscht oder markierte Zeile gelöscht
|
|
SPRACHENBind.updateBinding()
|
|
Exit Sub
|
|
End If
|
|
|
|
If DataGridView.CurrentRow.Cells("aa_name").ToString <> "" AndAlso DataGridView.CurrentRow.Cells("aa_sort").ToString <> "" AndAlso DataGridView.CurrentRow.Cells("aa_bezeichnung").ToString <> "" AndAlso EditRow >= 0 Then
|
|
SPRACHENBind.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 |