Projektdateien hinzufügen.
This commit is contained in:
121
Aviso/frmTabelleStandorte.vb
Normal file
121
Aviso/frmTabelleStandorte.vb
Normal file
@@ -0,0 +1,121 @@
|
||||
Imports VERAG_PROG_ALLGEMEIN
|
||||
Imports VERAG_PROG_ALLGEMEIN.cMeineFunktionenAVISO
|
||||
|
||||
Public Class frmTabelleStandorte
|
||||
|
||||
Public Aktive_Zeile As Integer
|
||||
Private StandorteDAL As New cStandorteDAL
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
Icon = GetProgrammIcon()
|
||||
End Sub
|
||||
|
||||
Private Sub frmTabelleStandorte_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
|
||||
Me.CenterToParent()
|
||||
|
||||
btnLöschen.Enabled = VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("Avisodaten_verwalten", Me)
|
||||
|
||||
|
||||
'Alle Datensätze anzeigen
|
||||
Daten_anzeigen()
|
||||
|
||||
'Layout für Grid anpassen
|
||||
With gridTabelle
|
||||
.Columns(0).Visible = False 'ID wird nicht angezeigt
|
||||
|
||||
.Columns(1).Width = 80
|
||||
.Columns(1).HeaderText = "Standort"
|
||||
|
||||
.Columns(2).Width = 100
|
||||
.Columns(2).HeaderText = "Standort Beschreibung"
|
||||
|
||||
.Columns(3).Width = 400
|
||||
.Columns(3).HeaderText = "Info"
|
||||
|
||||
End With
|
||||
Try
|
||||
If gridTabelle.RowCount > 0 Then gridTabelle.CurrentRow.Selected = True
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub Daten_anzeigen()
|
||||
|
||||
Dim hSelect As String = "SELECT * FROM Standorte "
|
||||
|
||||
|
||||
If txtSuche.Text.Trim <> "" Then
|
||||
hSelect += "WHERE (Standort LIKE '%" & txtSuche.Text & "%' OR " & _
|
||||
"Standort_Text LIKE '%" & txtSuche.Text & "%' OR Info LIKE '%" & txtSuche.Text & "%')"
|
||||
End If
|
||||
|
||||
hSelect += " ORDER BY Standort"
|
||||
|
||||
gridTabelle.DataSource = StandorteDAL.Anzeigen_Standorte(hSelect)
|
||||
|
||||
'Anzeige der Anzahl gewählter Datensätze
|
||||
cGlobal.AnzahlAuswahl = gridTabelle.RowCount
|
||||
lblAnzahl.Text = "Einträge: " & Format(cGlobal.AnzahlAuswahl, "#,##0") & " ausgewählt"
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnAlleAnzeigen_Click(sender As System.Object, e As System.EventArgs) Handles btnAlleAnzeigen.Click
|
||||
txtSuche.Text = ""
|
||||
|
||||
Daten_anzeigen()
|
||||
End Sub
|
||||
|
||||
Private Sub txtSuche_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSuche.TextChanged
|
||||
Daten_anzeigen()
|
||||
End Sub
|
||||
|
||||
Private Sub gridTabelle_DoubleClick(sender As Object, e As System.EventArgs) Handles btnÄndern.Click, gridTabelle.DoubleClick
|
||||
If IsNothing(gridTabelle.CurrentRow) Then Exit Sub
|
||||
|
||||
Dim f As New frmEintragStandort
|
||||
cGlobal.Aktive_ID = CInt(gridTabelle.Rows(gridTabelle.CurrentRow.Index).Cells("StandortID").Value)
|
||||
Aktive_Zeile = gridTabelle.CurrentRow.Index
|
||||
f.frmHilf = Me
|
||||
f.ShowDialog(Me)
|
||||
|
||||
'falls Änderung, dann die neuen Werte in Grid anzeigen
|
||||
If Aktive_Zeile >= 0 Then
|
||||
Dim Standort As cStandort = StandorteDAL.LesenStandort(cGlobal.Aktive_ID, "", "")
|
||||
If Not IsNothing(Standort) Then
|
||||
gridTabelle.Rows(Aktive_Zeile).Cells(1).Value = Standort.Standort
|
||||
gridTabelle.Rows(Aktive_Zeile).Cells(2).Value = Standort.Standort_Text
|
||||
gridTabelle.Rows(Aktive_Zeile).Cells(3).Value = Standort.Info
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnNeu_Click(sender As System.Object, e As System.EventArgs) Handles btnNeu.Click
|
||||
Dim f As New frmEintragStandort
|
||||
cGlobal.Aktive_ID = 0
|
||||
f.frmHilf = Me
|
||||
f.ShowDialog(Me)
|
||||
Daten_anzeigen()
|
||||
End Sub
|
||||
|
||||
Private Sub btnLöschen_Click(sender As System.Object, e As System.EventArgs) Handles btnLöschen.Click
|
||||
If IsNothing(gridTabelle.CurrentRow) Then Exit Sub
|
||||
cGlobal.Aktive_ID = CInt(gridTabelle.Rows(gridTabelle.CurrentRow.Index).Cells("StandortID").Value)
|
||||
|
||||
Dim antwort As MsgBoxResult = MsgBox("Wollen Sie den Standort '" & CStr(gridTabelle.Rows(gridTabelle.CurrentRow.Index).Cells("Standort").Value) &
|
||||
"' wirklich löschen?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, MsgBoxStyle),
|
||||
"Eintrag löschen")
|
||||
If antwort = vbNo Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
StandorteDAL.LöschenStandort(cGlobal.Aktive_ID)
|
||||
|
||||
Daten_anzeigen()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user