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

    Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        MyMsg_Box.Presentation("Officine ?", "Confirmez la modification des alias.", True, "OUI", True, "NON", False, "")
        If MyMsg_Box.ShowDialog = Windows.Forms.DialogResult.Yes Then
            BDD.Produits_AliasTableAdapter.DeleteQuery(DesignationTextBox.Text, CIP_TextBox.Text, EAN13TextBox.Text, CABTextBox.Text, "")
            For r = 0 To DataGridView1.Rows.Count - 1
                If DataGridView1.Item(Alias_.Index, r).Value <> "" Then
                        BDD.Produits_AliasTableAdapter.Insert(DesignationTextBox.Text, CIP_TextBox.Text, EAN13TextBox.Text, CABTextBox.Text, DataGridView1.Item(Alias_.Index, r).Value)
                End If
            Next
            Me.Close()
        End If
    End Sub
End Class