Imports IntraSell_DLL
Imports IntraSell_Net_Base

Public Class Translation
    Inherits AbstractForm

    Property TableName As String
    Property FieldName As String
    Property Key As String
    Property TextToTranslate As String

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub Translation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            ParentBindingNavigator.BindingSource = TranslationsBindingSource
            ds = DsEinstellungen
            LanguageTableAdapter.Fill(DsEinstellungen.language)
            'Me.TranslationsTableAdapter.Fill(Me.DsEinstellungen.translations)

            AddHandler DsEinstellungen.translations.TableNewRow, AddressOf NewTranslation
        Catch ex As Exception
            HandleAppError(ex)
        End Try
    End Sub


    Private Sub NewTranslation(sender As Object, e As DataTableNewRowEventArgs)
        Try
            Dim newRow As dsEinstellungen.translationsRow = e.Row
            newRow.FieldName = FieldName
            newRow.TableName = TableName
            newRow.LandId = 0
            newRow.Key = Key
        Catch ex As Exception

        End Try
    End Sub



    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub OfvarsBindingNavigatorSaveItem_Click(sender As Object, e As System.EventArgs) Handles MyBase.Save
        Try
            Validate()
            TranslationsBindingSource.EndEdit()
            TranslationsTableAdapter.Update(DsEinstellungen)
        Catch ex As Exception
            HandleAppError(ex)
        End Try
    End Sub

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Sub Filter()
        Try
            LabelText.Text = TextToTranslate
            DsEinstellungen.translations.Clear()
            TranslationsTableAdapter.FillBy(DsEinstellungen.translations, Feldname:=FieldName, TableName:=TableName, Key:=Key)
        Catch ex As Exception
            HandleAppError(ex)
        End Try
    End Sub


End Class