107 lines
3.9 KiB
VB.net
107 lines
3.9 KiB
VB.net
Public Class Form1
|
|
Public maxDipendenti = 15
|
|
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Gestionale.Database = New DatabaseManager()
|
|
Gestionale.gestioneDipendenti = New GestioneDipendenti(Gestionale.Database)
|
|
Gestionale.gestioneRuoli = New GestioneRuoli(Gestionale.Database)
|
|
Gestionale.gestioneDipendentiRuoli = New GestioneDipendenteRuoli(Gestionale.Database)
|
|
Gestionale.gestioneFasce = New GestioneFasceLavoro(Gestionale.Database)
|
|
Gestionale.gestioneOrariFasce = New GestioneOrari_FasceLavoro(Gestionale.Database)
|
|
Gestionale.gestioneTipiAssenze = New GestioneTipiAssenza(Gestionale.Database)
|
|
Gestionale.gestioneAssenze = New GestioneAssenze(Gestionale.Database)
|
|
Gestionale.gestioneTurni = New GestioneTurni(Gestionale.Database)
|
|
|
|
Dim i As Integer = Gestionale.gestioneDipendenti.CountDipendenti(True)
|
|
If i < maxDipendenti Then
|
|
Dim agg = maxDipendenti - i
|
|
Gestionale.gestioneDipendenti.GeneraBagniniDiTest(agg)
|
|
|
|
End If
|
|
Gestionale.PopolaCheckedListBox_T(Of Ruolo)(CheckedRuoli, Gestionale.gestioneRuoli.GetRuoli)
|
|
PopolaGrigliaDipendenti()
|
|
End Sub
|
|
|
|
Public Sub PopolaGrigliaDipendenti()
|
|
Dim testoRicerca As String = TextBox1.Text.Trim()
|
|
|
|
' ⚠️ CHIAMA LA FUNZIONE CON RUOLI + NOME
|
|
Dim listaFiltrata = Gestionale.gestioneDipendenti.GetDipendenti(
|
|
CheckedRuoli,
|
|
testoRicerca,
|
|
attivo:=True ' Solo attivi
|
|
)
|
|
|
|
' ⚠️ AGGIORNA LA UI
|
|
'DataGridViewDipendenti.DataSource = Nothing
|
|
'DataGridViewDipendenti.DataSource = listaFiltrata
|
|
|
|
lblRisultati.Text = $"Dipendenti trovati: {listaFiltrata.Count}"
|
|
Gestionale.PopolaGriglia(gridDipendenti, listaFiltrata)
|
|
End Sub
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
FormDipendente.Show()
|
|
|
|
End Sub
|
|
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|
FormFascia.Show()
|
|
|
|
End Sub
|
|
|
|
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
|
Dim dip = DipendenteSelezionato()
|
|
|
|
'If dip Is Nothing Then
|
|
' MsgBox("selezionare un dipendende dalla griglia")
|
|
' Return
|
|
'End If
|
|
|
|
FormDipendente.ModificaDipendente(dip)
|
|
'FormDipendente.Show()
|
|
|
|
End Sub
|
|
|
|
Public Function DipendenteSelezionato() As Dipendente
|
|
|
|
If gridDipendenti.CurrentRow Is Nothing Then Return Nothing
|
|
|
|
Return CType(gridDipendenti.CurrentRow.DataBoundItem, Dipendente)
|
|
|
|
End Function
|
|
|
|
Private Sub gridDipendenti_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles gridDipendenti.CellContentClick
|
|
|
|
End Sub
|
|
|
|
Private Sub gridDipendenti_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles gridDipendenti.CellClick
|
|
Dim d = DipendenteSelezionato()
|
|
Dim lista = Gestionale.gestioneRuoli.GetRuoliDipendente(d.ID)
|
|
Gestionale.ChecklistBox_Spunta(CheckedRuoli, lista)
|
|
End Sub
|
|
|
|
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
|
|
|
Dim dip = DipendenteSelezionato()
|
|
If dip IsNot Nothing Then
|
|
Gestionale.gestioneDipendenti.EliminaDipendente(dip.ID)
|
|
PopolaGrigliaDipendenti()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
|
|
FormTurni.Show()
|
|
End Sub
|
|
|
|
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
|
|
PopolaGrigliaDipendenti()
|
|
End Sub
|
|
|
|
Private Sub CheckedRuoli_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CheckedRuoli.SelectedIndexChanged
|
|
Me.BeginInvoke(Sub() PopolaGrigliaDipendenti())
|
|
End Sub
|
|
End Class
|