' Copyright (C) 2025  P4pillon.org
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU Affero General Public License as
' published by the Free Software Foundation, either version 3 of the
' License, or (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU Affero General Public License for more details.
'
' You should have received a copy of the GNU Affero General Public License
' along with this program.  If not, see <https://www.gnu.org/licenses/>.
Public Class Choix_AMC_TypeContrat

    Private Sub Choix_AMC_TypeContrat_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        affiche_Contrats()
    End Sub

    Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        CurrentBenéficiaire.AMC_TypeContrat = DataGridView1.Item(Id.Index, DataGridView1.CurrentRow.Index).Value
        Me.Close()
    End Sub
    Private Sub affiche_Contrats()
        DataGridView1.Rows.Clear()
        Dim mydatatable As DataTable
        mydatatable = Me.AmC_Contrat_TypeTableAdapter1.GetData
        For r = 0 To mydatatable.Rows.Count - 1
            DataGridView1.Rows.Add()
            For c = 0 To mydatatable.Columns.Count - 1
                Select Case mydatatable.Columns.Item(c).ColumnName
                    Case "Id"
                        DataGridView1.Item(Id.Index, r).Value = mydatatable(r).Item(c)
                    Case "Intitulé"
                        DataGridView1.Item(Intitulé.Index, r).Value = mydatatable(r).Item(c)
                    Case "PH2"
                        DataGridView1.Item(PH2.Index, r).Value = mydatatable(r).Item(c)
                    Case "PH4"
                        DataGridView1.Item(PH4.Index, r).Value = mydatatable(r).Item(c)
                    Case "PH7"
                        DataGridView1.Item(PH7.Index, r).Value = mydatatable(r).Item(c)
                    Case "PH1"
                        DataGridView1.Item(PH1.Index, r).Value = mydatatable(r).Item(c)
                    Case "PA"
                        DataGridView1.Item(LPP.Index, r).Value = mydatatable(r).Item(c)
                End Select
            Next
        Next
    End Sub

   

    Private Sub Créer_LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles Créer_LinkLabel1.LinkClicked
        Me.WindowState = FormWindowState.Minimized
        Création_TypeContrat.ShowDialog()
        affiche_Contrats()
        Me.WindowState = FormWindowState.Normal
    End Sub

    Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

    End Sub
End Class