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


    Private Sub Type_Paiement_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: cette ligne de code charge les données dans la table 'PharmaDataSet.Type_Paiement'. Vous pouvez la déplacer ou la supprimer selon vos besoins.
        Me.Type_PaiementTableAdapter.Fill(Me.PharmaDataSet.Type_Paiement)

    End Sub



    Private Sub add_Button1_Click(sender As Object, e As EventArgs) Handles add_Button1.Click
        Dim newtype = InputBox("Nouveau type paiement:", "Officine")
        If newtype <> "" Then
            BDD.Type_PaiementTableAdapter.Insert(newtype)
            Me.Type_PaiementTableAdapter.Fill(Me.PharmaDataSet.Type_Paiement)
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If Type_PaiementDataGridView.CurrentRow Is Nothing Then Exit Sub
        If Type_PaiementDataGridView.CurrentRow.Index < 0 Then Exit Sub
        MyMsg_Box.Presentation("Officine ?", "Voulez-vous supprimmer le type de paiement " & vbCrLf & Type_PaiementDataGridView.Item(DataGridViewTextBoxColumn1.Index, Type_PaiementDataGridView.CurrentRow.Index).Value & " ?", True, "OUI", True, "NON", False, "")
        If MyMsg_Box.ShowDialog = Windows.Forms.DialogResult.Yes Then
            BDD.Type_PaiementTableAdapter.Delete_by_Type(Type_PaiementDataGridView.Item(DataGridViewTextBoxColumn1.Index, Type_PaiementDataGridView.CurrentRow.Index).Value)
            Me.Type_PaiementTableAdapter.Fill(Me.PharmaDataSet.Type_Paiement)
        End If
    End Sub
End Class