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 StorageLocation_VC
    Inherits DevExpress.ExpressApp.ViewController

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

    Private Sub aStorageLocationsPrint_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aStorageLocationsPrint.Execute
        Try
            Dim _ocur As Xpo.XPObjectSpace = View.ObjectSpace
            Dim _ReportData As ReportData = _ocur.FindObject(Of ReportData)(CriteriaOperator.Parse("Name=?", "Raktári lokációk"))
            If _ReportData Is Nothing Then Throw New Exception("*Nincs beállítva nyomtatvány!")
            If View.SelectedObjects.Count = 0 Then Throw New Exception("*Egy sort ki kell jelölni, hogy a raktár azonosítható legyen!")

            Dim _OidArray As New ArrayList

            For Each _StorageLocation As StorageLocation In View.SelectedObjects
                _OidArray.Add(_StorageLocation.Oid)
            Next

            Dim _InOperator As InOperator = New InOperator("Oid", _OidArray)

            Frame.GetController(Of Reports.ReportServiceController).ShowPreview(_ReportData, _InOperator, True)
        Catch ext As Exception
            MsgBox(ext.Message, MsgBoxStyle.OkOnly)
        End Try
    End Sub
End Class
