Imports IntraSell_DLL
Public Class StatistikAustria
    Dim _ArtNr As Integer
    Property ArtNr As Integer
        Get
            Return _ArtNr
        End Get
        Set(value As Integer)
            If value > 0 Then
                If _ArtNr <> value Then
                    _ArtNr = value
                    LadeDatenFuerArtNr(value)
                End If
            End If
        End Set
    End Property

    Sub LadeDatenFuerArtNr(ArtNr As Integer)
        Try
            TextBoxArtNr.Text = ArtNr
            Statistik_austria_warengruppenTableAdapter.Fill(DsStatAustria.statistik_austria_warengruppen, ArtNr)
            If StatistikaustriawarengruppenBindingSource.Current Is Nothing Then
                StatistikaustriawarengruppenBindingSource.AddNew()
                Dim row As dsStatAustria.statistik_austria_warengruppenRow = StatistikaustriawarengruppenBindingSource.Current.row
                row.ArtNr = ArtNr
            End If
        Catch ex As Exception

        End Try
    End Sub

    Private Sub StatistikAustria_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            Statistik_austria_warengruppenTableAdapter.Connection = CurrentDB
            FillComboBox(ComboBoxWarennr, "select warennr, bezeichnung from statistik_austria_warengruppen_uebersicht order by warennr", "bezeichnung", "warennr")
            FillComboBox(ComboBoxUrsprungsland, "select idnr, name from grLand order by name", "name", "idnr")
        Catch ex As Exception

        End Try
    End Sub

    Private Sub ButtonWarengruppen_Click(sender As Object, e As EventArgs) Handles ButtonWarengruppen.Click
        Try
            StatistikAustriaWarengruppen.Show()
        Catch ex As Exception
            HandleAppError(ex)
        End Try
    End Sub

    Private Sub ComboBoxWarennr_Validated(sender As Object, e As EventArgs) Handles ComboBoxWarennr.Validated
        Save()
    End Sub

    Private Sub TextBoxGewicht_Validated(sender As Object, e As EventArgs) Handles TextBoxGewicht.Validated
        Save()
    End Sub

    Private Sub ComboBoxUrsprungsland_Validated(sender As Object, e As EventArgs) Handles ComboBoxUrsprungsland.Validated
        Save()
    End Sub

    Public Sub Save()
        Try
            StatistikaustriawarengruppenBindingSource.EndEdit()
            Statistik_austria_warengruppenTableAdapter.Update(DsStatAustria.statistik_austria_warengruppen)
        Catch ex As Exception
            HandleAppError(ex)
        End Try
    End Sub


End Class
