Imports IntraSell_DLL

Public Class ucZahlungsmethoden

    Property Zahlungsmethode As String
    Public Event ZahlungsmethodeAusgewaehlt(Methode As String)

    Public Sub Lade() Handles MyBase.Load
        Try
            Dim sonstigeZM = OpenRecordsetInMemory("select Methode from grZahlungsmethode where AktivInKasse<>0 order by Methode")
            Dim Cnt = 1
            For Each r In sonstigeZM.Rows
                Dim b = New RadioButton With {
                    .Text = r("Methode"),
                    .Tag = r("Methode"),
                    .Width = 120,
                    .Height = 20,
                    .Top = 20 * Cnt
                }
                AddHandler b.Click, AddressOf sonstigeZahlungsMethode_Click
                GroupBoxZahlungsmethoden.Controls.Add(b)
                Cnt += 1
            Next
            sonstigeZM = Nothing
        Catch ex As Exception
            HandleAppError(ex, Silent:=True)
        End Try
    End Sub

    Private Sub sonstigeZahlungsMethode_Click(sender As Object, e As EventArgs)
        Try
            Dim methode = CType(sender, RadioButton).Tag
            Zahlungsmethode = methode
            RaiseEvent ZahlungsmethodeAusgewaehlt(methode)
        Catch ex As Exception
            HandleAppError(ex, Silent:=True)
        End Try
    End Sub
End Class
