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

    Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        If CurrentBenéficiaire.Num <> 0 Then
            BDD.PDA_InfoComplTableAdapter.Delete_By_VitaleNum(CurrentBenéficiaire.Num)
            BDD.PDA_InfoComplTableAdapter.Insert(CurrentBenéficiaire.Num, EtageTextBox.Text, ChambreTextBox.Text, LitTextBox.Text)
            Me.Close()
        End If
    End Sub

    Private Sub PDA_VItaleNum_InfoCompl_Load(sender As Object, e As EventArgs) Handles Me.Load
        EtageTextBox.Text = ""
        ChambreTextBox.Text = ""
        LitTextBox.Text = ""

        If CurrentBenéficiaire.Num <> 0 Then
            Dim data = BDD.PDA_InfoComplTableAdapter.GetDataBy_VitaleNum(CurrentBenéficiaire.Num)
            If data.Rows.Count > 0 Then
                EtageTextBox.Text = data(0).Etage
                ChambreTextBox.Text = data(0).Chambre
                LitTextBox.Text = data(0).Lit
            End If
  
        End If
    End Sub
End Class