Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text

Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base
Imports DevExpress.Data.Filtering
Imports DevExpress.Persistent.BaseImpl

Public Class APCSheetReview_VC
    Inherits DevExpress.ExpressApp.ViewController

    Public Sub New()
        MyBase.New()
        InitializeComponent()
        RegisterActions(components)
    End Sub

    Public Overridable Sub aAPCSheetReviewHeader_Print_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aAPCSheetReviewHeader_Print.Execute
        Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
        Dim _APCSheetReviewHeader As APCSheetReviewHeader = TryCast(View.SelectedObjects(0), APCSheetReviewHeader)
        Try
            If _APCSheetReviewHeader.ReportData Is Nothing Then Throw New Exception("*Nincs beállítva nyomtatvány!")
            Dim _ReportData As ReportData = _ocur.FindObject(Of ReportData)(CriteriaOperator.Parse("Oid=?", _APCSheetReviewHeader.ReportData.Oid), True)
            If _APCSheetReviewHeader IsNot Nothing Then
                If _APCSheetReviewHeader.ReportData IsNot Nothing Then
                    Frame.GetController(Of Reports.ReportServiceController).ShowPreview(_ReportData, DevExpress.Data.Filtering.CriteriaOperator.Parse("APCSheetReviewHeader.Oid =?", _APCSheetReviewHeader.Oid), True)
                End If
            End If
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(DevExpress.ExpressApp.Utils.CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
        End Try

    End Sub
End Class
