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.Xpo
Imports DevExpress.ExpressApp.SystemModule
Imports System.Linq
Imports System.IO
Imports DevExpress.ExpressApp.Editors
Public Module ViewPDCI
    'Public Sub ViewPDCI(_onew As Xpo.XPObjectSpace, _
    '                    _Application As DevExpress.ExpressApp.XafApplication, _
    '                    _e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs, _
    '                    _CustomersFrom As CustomersFrom, _
    '                    _Customers As Customers, _
    '                    _PartnerType As ePartnerType, _
    '                    _ConnectInfo As String)
    '    Dim _CS As New CollectionSource(_onew, GetType(PCIDetail))

    '    _CS.BeginUpdateCriteria()
    '    _CS.Criteria.Clear()
    '    _CS.Criteria("First") = CriteriaOperator.Parse("CustomersFrom.Oid=? and PartnerType=? and Customers.Oid=? and ConnectInfo=?", _
    '                                                   _CustomersFrom.Oid, _
    '                                                   _PartnerType, _
    '                                                   _Customers.Oid, _
    '                                                   _ConnectInfo)
    '    _CS.EndUpdateCriteria()

    '    _e.ShowViewParameters.CreatedView = _Application.CreateListView("PCIDetail_ListView", _CS, False)
    '    _e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow
    'End Sub
    Public Sub ViewPDCIDetail(_onew As Xpo.XPObjectSpace, _
                        _Application As DevExpress.ExpressApp.XafApplication, _
                        _e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs, _
                        _CustomersFrom As CustomersFrom, _
                        _Customers As Customers, _
                        _PartnerType As ePartnerType, _
                        _ConnectInfo As String)
        Dim _CS As New CollectionSource(_onew, GetType(PCIDetail))

        _CS.BeginUpdateCriteria()
        _CS.Criteria.Clear()
        _CS.Criteria("First") = CriteriaOperator.Parse("CustomersFrom.Oid=? and PartnerType=? and Customers.Oid=? and ConnectInfo=?", _
                                                       _CustomersFrom.Oid, _
                                                       _PartnerType, _
                                                       _Customers.Oid, _
                                                       _ConnectInfo)
        _CS.EndUpdateCriteria()

        _e.ShowViewParameters.CreatedView = _Application.CreateListView("PCIDetail_ListView_View", _CS, False)
        _e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow
    End Sub
    Public Sub ViewGLDetails(_onew As Xpo.XPObjectSpace, _
                        _Application As DevExpress.ExpressApp.XafApplication, _
                        _e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs, _
                        _CustomersFrom As CustomersFrom, _
                        _Customers As Customers, _
                        _PartnerType As ePartnerType, _
                        _ConnectInfo As String)
        Dim _CS As New CollectionSource(_onew, GetType(GLDetails))

        _CS.BeginUpdateCriteria()
        _CS.Criteria.Clear()
        _CS.Criteria("First") = CriteriaOperator.Parse("IsNull(GLRows.GCRecord)=True and IsNull(GLRows.GLHeader.GCRecord)=True and GLRows.GLHeader.IsEditable=False and GLRows.GLHeader.CustomersFrom.Oid=? and GLRows.PartnerType=? and GLRows.Customer.Oid=? and GLRows.ConnectInfo=?", _
                                                       _CustomersFrom.Oid, _
                                                       _PartnerType, _
                                                       _Customers.Oid, _
                                                       _ConnectInfo)
        _CS.EndUpdateCriteria()

        _e.ShowViewParameters.CreatedView = _Application.CreateListView("GLDetails_ListView_PCIDetail", _CS, False)
        _e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow

    End Sub
    Public Sub ViewPDCIDetail_Customers(_onew As Xpo.XPObjectSpace, _
                        _Application As DevExpress.ExpressApp.XafApplication, _
                        _e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs, _
                        _CustomersFrom As CustomersFrom, _
                        _Customers As Customers)
        Dim _CS As New CollectionSource(_onew, GetType(PCIDetail))

        _CS.BeginUpdateCriteria()
        _CS.Criteria.Clear()
        _CS.Criteria("First") = CriteriaOperator.Parse("CustomersFrom.Oid=? and Customers.Oid=? ", _
                                                       _CustomersFrom.Oid, _
                                                       _Customers.Oid)
        _CS.EndUpdateCriteria()

        _e.ShowViewParameters.CreatedView = _Application.CreateListView("PCIDetail_ListView", _CS, False)
        _e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow
    End Sub
End Module
