' 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 Contraceptif_Urg_saisie_date_naissance


    Private Sub Contraceptif_Urg_saisie_date_naissance_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        For i = 1 To 31
            ComboBoxjour.Items.Add(i)
        Next
        For i = 1 To 12
            ComboBoxmois.Items.Add(i)
        Next
        Dim année_courante As Integer = Now.Year
        For i = année_courante - 19 To année_courante
            ComboBoxannée.Items.Add(i)
        Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ComboBoxjour.Text = "" Or ComboBoxmois.Text = "" Or ComboBoxannée.Text = "" Then
            MsgBox("Selectionnez Date de Naissance")
            Exit Sub
        End If
        Select Case MsgBox("Confirmer le " + ComboBoxjour.Text + "/" + ComboBoxmois.Text + "/" + ComboBoxannée.Text, 35)
            Case MsgBoxResult.Yes
                CurrentBenéficiaire.G104C12 = ComboBoxannée.Text.ToString + ComboBoxmois.Text.ToString + ComboBoxjour.Text.ToString + "0000"
                COMPTOIR_MAIN.Enabled = True
                Me.Close()
            Case MsgBoxResult.Cancel
                MsgBox("Date par defaut selectionnée", MsgBoxStyle.Information)
                COMPTOIR_MAIN.Enabled = True
                Me.Close()
        End Select
     

    End Sub


End Class