Imports IntraSell_DLL

Public Class Archivierung

    Private Sub Archivierung_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            LabelStatus.Text = PruefeArchivierung()
        Catch ex As Exception
            HandleAppError(ex)
        End Try
    End Sub

    ''' <summary>
    ''' 
    ''' Daten archivieren
    ''' 
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub ButtonDatenArchivieren_Click(sender As Object, e As EventArgs) Handles ButtonDatenArchivieren.Click
        Try
            ButtonDatenArchivieren.Enabled = False
            ShowLogWindow()
            Cursor = Cursors.WaitCursor
            ArchiviereAlteRechnungen()
            LabelStatus.Text = PruefeArchivierung()
        Catch ex As Exception
            HandleAppError(ex)
        Finally
            ButtonDatenArchivieren.Enabled = True
            Cursor = Cursors.Default
        End Try
    End Sub

    'Archivierte Daten wieder aktivieren
    Private Sub ButtonDatenDeArchivieren_Click(sender As Object, e As EventArgs) Handles ButtonDatenDeArchivieren.Click
        Try
            ButtonDatenDeArchivieren.Enabled = False
            ShowLogWindow()
            Cursor = Cursors.WaitCursor
            DeArchiviereAlteRechnungen()
            LabelStatus.Text = PruefeArchivierung()
        Catch ex As Exception
            HandleAppError(ex)
        Finally
            ButtonDatenDeArchivieren.Enabled = True
            Cursor = Cursors.Default
        End Try
    End Sub

    Private Sub ShowLogWindow()
        Try
            Log.Show()
        Catch ex As Exception
            HandleAppError(ex, Silent:=True)
        End Try
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles ButtonAbbrechen.Click
        Close()
    End Sub
End Class