Ma Suche verbessert

This commit is contained in:
2024-10-09 16:23:25 +02:00
parent 380f248996
commit 05815eff9e

View File

@@ -28,6 +28,7 @@ Public Class usrCntlMitarbeiter
Try Try
' Me.Size = My.Settings.frmMainSize ' Me.Size = My.Settings.frmMainSize
' Me.Location = My.Settings.frmMainPosition ' Me.Location = My.Settings.frmMainPosition
Catch ex As Exception
Catch ex As Exception Catch ex As Exception
'nix tun - Standardgröße wird somit automatisch gesetzt 'nix tun - Standardgröße wird somit automatisch gesetzt
End Try End Try
@@ -37,58 +38,57 @@ Public Class usrCntlMitarbeiter
txtSuche.Focus() txtSuche.Focus()
End Sub End Sub
Public Sub Tabelle_anzeigen() Public Sub Tabelle_anzeigen()
Dim startIndex As Integer = TabControl1.SelectedIndex Dim startIndex As Integer = TabControl1.SelectedIndex
Dim firmaGefunden As Boolean = False Dim firmaGefunden As Boolean = False
Dim tabCount As Integer = TabControl1.TabCount Dim tabCount As Integer = TabControl1.TabCount
If TabControl1.SelectedIndex <> 7 Then
For offset As Integer = 0 To tabCount - 1
Dim i As Integer = (startIndex + offset) Mod tabCount
Dim firma As String = ""
Dim checkedTabs As Integer = 0 Select Case i
Dim i As Integer = startIndex Case 0
firma = "VERAG"
Case 1
firma = "ATILLA"
Case 2
firma = "IMEX"
Case 3
firma = "UNISPED"
Case 4
firma = "AMBAR"
Case 5
firma = "FRONTOFFICE"
Case 6
firma = "VERIMEX"
End Select
Do While checkedTabs < tabCount
Dim firma As String = "" If firma <> "" Then
Select Case i If showVERAGATILLA(firma) Then
Case 0 ' Wechsel zum Tab der gefundenen Firma
firma = "VERAG" TabControl1.SelectedIndex = i
Case 1
firma = "ATILLA"
Case 2
firma = "IMEX"
Case 3
firma = "UNISPED"
Case 4
firma = "AMBAR"
Case 5
firma = "FRONTOFFICE"
Case 6
firma = "VERIMEX"
Case 7
If dgvTimasNew IsNot Nothing Then
showTIMAS(False)
firmaGefunden = True firmaGefunden = True
Exit Do Exit For
End If End If
End Select
If firma <> "" Then
If showVERAGATILLA(firma) Then
' Wechsel zum Tab der gefundenen Firma
TabControl1.SelectedIndex = i
firmaGefunden = True
Exit Do
End If End If
End If
checkedTabs += 1 Next
i = (i + 1) Mod tabCount ' Modulo-Operation für zyklisches Durchlaufen
Loop
If Not firmaGefunden Then
MsgBox("Keine Daten für die ausgewählten Kriterien gefunden.", MsgBoxStyle.Information)
End If End If
If TabControl1.SelectedIndex = 7 Then
If dgvTimasNew IsNot Nothing Then
showTIMAS(False)
End If
End If
If txtSuche.Text <> "" AndAlso TabControl1.SelectedIndex <> 7 Then
If Not firmaGefunden Then
MsgBox("Keine Daten für die ausgewählten Kriterien gefunden.", MsgBoxStyle.Information)
End If
End If
End Sub End Sub
@@ -97,10 +97,14 @@ Public Class usrCntlMitarbeiter
locZeilen = -1 locZeilen = -1
If Not Grid_aktiv Then Return False If Not Grid_aktiv Then Return False
' Ihre ursprüngliche SQL-Abfrage hier, angepasst für die aktuelle Firma ' SQL-Abfrage erstellen
Dim sql As String = "SELECT mit_id, mit_username, mit_vname, mit_nname, mit_niederlassung, mit_abteilung, mit_email, cast(case when mit_timasId is null then 0 else 1 end as bit) mit_ze, cast(case when isnull([mit_DAKOSY_SB],'')<> '' and isnull([mit_DAKOSY_SBFull],'')<>'' then 1 else 0 end as bit) mit_DAKOSY, mit_durchwahl, mit_gekuendigt, isnull(mit_foto_DocId,'') as mit_foto_DocId FROM tblMitarbeiter WHERE (mit_firma='" & firma & "' OR (mit_firma='ALL' AND mit_FirmaHaupt='" & firma & "'))" Dim sql As String = "SELECT mit_id, mit_username, mit_vname, mit_nname, mit_niederlassung, mit_abteilung, mit_email, " &
"CAST(CASE WHEN mit_timasId IS NULL THEN 0 ELSE 1 END AS BIT) mit_ze, " &
"CAST(CASE WHEN ISNULL([mit_DAKOSY_SB],'')<> '' AND ISNULL([mit_DAKOSY_SBFull],'')<>'' THEN 1 ELSE 0 END AS BIT) mit_DAKOSY, " &
"mit_durchwahl, mit_gekuendigt, ISNULL(mit_foto_DocId,'') AS mit_foto_DocId " &
"FROM tblMitarbeiter WHERE (mit_firma='" & firma & "' OR (mit_firma='ALL' AND mit_FirmaHaupt='" & firma & "'))"
' Rest Ihrer Filterbedingungen... ' Filter hinzufügen
If txtSuche.Text <> "" Then If txtSuche.Text <> "" Then
sql &= " AND (mit_username LIKE '%" & txtSuche.Text & "%' OR mit_nname LIKE '%" & txtSuche.Text & "%' OR mit_vname LIKE '%" & txtSuche.Text & "%')" sql &= " AND (mit_username LIKE '%" & txtSuche.Text & "%' OR mit_nname LIKE '%" & txtSuche.Text & "%' OR mit_vname LIKE '%" & txtSuche.Text & "%')"
End If End If
@@ -110,11 +114,11 @@ Public Class usrCntlMitarbeiter
End If End If
If cbxZE.CheckState <> CheckState.Indeterminate Then If cbxZE.CheckState <> CheckState.Indeterminate Then
sql &= If(cbxZE.Checked, " AND mit_timasId is not null", " AND mit_timasId is null") sql &= If(cbxZE.Checked, " AND mit_timasId IS NOT NULL", " AND mit_timasId IS NULL")
End If End If
If cbxDakosy.CheckState <> CheckState.Indeterminate Then If cbxDakosy.CheckState <> CheckState.Indeterminate Then
sql &= If(cbxDakosy.Checked, " AND (isnull([mit_DAKOSY_SB],'')<> '' AND isnull([mit_DAKOSY_SBFull],'')<>'')", " AND (isnull([mit_DAKOSY_SB],'')= '' OR isnull([mit_DAKOSY_SBFull],'')='')") sql &= If(cbxDakosy.Checked, " AND (ISNULL([mit_DAKOSY_SB],'')<> '' AND ISNULL([mit_DAKOSY_SBFull],'')<>'')", " AND (ISNULL([mit_DAKOSY_SB],'')= '' OR ISNULL([mit_DAKOSY_SBFull],'')='')")
End If End If
' Daten laden und prüfen ' Daten laden und prüfen
@@ -175,7 +179,6 @@ Public Class usrCntlMitarbeiter
dgvVERIMEX.Sort(dgvVERIMEX.Columns(3), ListSortDirection.Ascending) dgvVERIMEX.Sort(dgvVERIMEX.Columns(3), ListSortDirection.Ascending)
Return True Return True
End If End If
' Fügen Sie weitere Fälle hinzu, falls erforderlich
End Select End Select
Return False Return False
@@ -183,9 +186,6 @@ Public Class usrCntlMitarbeiter
Public Sub showTIMAS(refresh As Boolean) Public Sub showTIMAS(refresh As Boolean)
locZeilen = -1 locZeilen = -1
If Not Grid_aktiv Then Exit Sub If Not Grid_aktiv Then Exit Sub