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.Xpo
Imports DevExpress.Data.Filtering

Public Class GLResetVC
    Inherits DevExpress.ExpressApp.ViewController
    Dim _WaitFormClass As New WaitFormClass
    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()
        RegisterActions(components)

    End Sub
    Protected Overrides Sub OnActivated()
        MyBase.OnActivated()
        Frame.GetController(Of GLResetVC).aResetStorageTransactions.Active.SetItemValue("", False)

        If View.Id = "GLReset_DetailView" Then
            Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ModificationsController)().Active.SetItemValue("", False)
            Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
            Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
            Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RefreshController)().Active.SetItemValue("", False)
            Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RecordsNavigationController)().Active.SetItemValue("", False)
        End If
    End Sub
    Private Sub aResetAll_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aResetAll.Execute
        If Not SecuritySystem.CurrentUserName = "SysAdmin" Then Exit Sub

        Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
        Me.ResetAll(_ocur)

    End Sub
    Private Sub aResetObject_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aResetObject.Execute
        Dim _ResetObjects As ResetObjects = TryCast(e.SelectedObjects(0), ResetObjects)
        Dim _ObjectSpace As Xpo.XPObjectSpace = Application.CreateObjectSpace
        Dim _objectsToDelete As ArrayList = New ArrayList()
        Dim _ObjectType As Type = _ResetObjects.ObjectType
        Dim _ConnectionString As String = Application.ConnectionString.ToUpper
        If Not SecuritySystem.CurrentUserName = "SysAdmin" Then Exit Sub
        _objectsToDelete.AddRange(_ObjectSpace.GetObjects(_ObjectType))
        _ObjectSpace.Delete(_objectsToDelete)
        _ObjectSpace.CommitChanges()
        ObjectSpace.Refresh()
    End Sub
    Private Sub aResetStorageTransactions_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aResetStorageTransactions.Execute
        Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
        Dim _uow As UnitOfWork = New UnitOfWork(_ocur.Session.DataLayer)

        Dim _StorageOutRows_Collection As New XPCollection(_uow, GetType(StorageOutRows), CriteriaOperator.Parse("1=1"))
        _uow.Delete(_StorageOutRows_Collection)

        Dim _StorageOutHeader_Collection As New XPCollection(_uow, GetType(StorageOutHeader), CriteriaOperator.Parse("1=1"))
        _uow.Delete(_StorageOutHeader_Collection)

        Dim _StorageInRows_Collection As New XPCollection(_uow, GetType(StorageInRows), CriteriaOperator.Parse("1=1"))
        _uow.Delete(_StorageInRows_Collection)

        Dim _StorageInHeader_Collection As New XPCollection(_uow, GetType(StorageInHeader), CriteriaOperator.Parse("1=1"))
        _uow.Delete(_StorageInHeader_Collection)

        Dim _StorageOutRowsInRows_Collection As New XPCollection(_uow, GetType(StorageOutRowsInRows), CriteriaOperator.Parse("1=1"))
        _uow.Delete(_StorageOutRowsInRows_Collection)

        Dim _StorageComputed_Collection As New XPCollection(_uow, GetType(StorageComputed), CriteriaOperator.Parse("1=1"))
        _uow.Delete(_StorageComputed_Collection)

        _uow.CommitChanges()
        ObjectSpace.Refresh()
    End Sub

    Sub ResetAll(_ocur As Xpo.XPObjectSpace)
        Dim _ObjectsToDelete As ArrayList = New ArrayList()

        '--- Form inicializálása  
        '--- Nem szabad törölni, törzsadat -------------------------------------------------------
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Apartments)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(AssetsHandlingParameter)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(BankImportNameParameters)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ChartOfAccounts)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Contacts)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContactsNG)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Container)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractTemplate)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Controlling)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CostHolder)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CostPlace)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CountryExtend)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRM_FirstMeet)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRM_Opportunities_Contacts_Roles)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRM_Opportunities_Probability)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_FirstMeet)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Offer_Template)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Offer_Template_CustomersFrom)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMResults)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMResultsType)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMTarget)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMTaskType)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CurrencyName)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CurrencyRate)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomerBankAccounts)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomerNameParameters)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Customers)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersAddress)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersFileAttachment)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersFrom)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersGLParameters)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersNG)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersNGCollection)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersNGCollectionWorkSheetType)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersOrder)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersOrderDocuments)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomersOrderPriority)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomReportData)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CustomsTariffs)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DeliveryNoteInType)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DeliveryNoteOutType)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DocumentAttachments)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DocumentAttachmentsType)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DocumentFileData)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DocumentSentBackView)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(EmailSender)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Floors)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Garages)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GeneralStock)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLHeader_RateDiffParameter)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLMixedNG)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Hints)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(HRGroups)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(HRPerson)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Immovables)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesGroups)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Installation)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InstallationDocumentations)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InstallationProductsVariable)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InvoiceType)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(JobNumberObjects)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LateChargesCountMode)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LiquidAssets)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LocalityLists)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LocalityType)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(MoneyRate)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(NumberGenerator)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(NumberGeneratorGroups)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(NumberGeneratorSemafor)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OfferInParameters)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OfferOutParameters)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInParameters)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PaymentOption)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Pricing)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PricingCRM)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PricingFix)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PricingFixStaged)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PricingProductsGroups)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Products)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ProductsGroups)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(QualityOption)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Recipe)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RecipeExecutionSimple)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RecipeExecutionSimpleType)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RecipeFrom)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RecipeFromOther)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RecipeTo)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RecipeToOther)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RecipeType)))

        ' _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryType)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Rule5DforGL)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Rule5DMatrix)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Services)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ShipmentOption)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(SQLImports)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Stairways)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(State)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Storage)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageMoveType)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StoragePDAParameters)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StudentHostel)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Subcontractor)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(SubcontractorCustomers)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(SubcontractorWorksheetType)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(SupportNG)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(UniqueObjects)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Units)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(UrgentOption)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(VAT)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(WEB)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(WorkflowSystem)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(WorkflowSystemSteps)))

        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(WorkSheetType)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(WorkSheetTypeExcelParam)))
        '_ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ZIPHU)))
        '-----------------------------------------------------------------------------------------

        '--- Törlendő táblák ---------------------------------------------------------------------
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ABRQueryCustomersFrom))) '1
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ABRQueryHeader))) '2
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ABRQueryRows))) '3
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ABRQueryRowsDetail))) '4
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Answer))) '5
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(AssetsHandling)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(AssetsHandlingActivity)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(AssetsHandlingPCI)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(AssetsPCIHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(AssetsPCIRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(BallanceHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(BallanceRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(BankImportHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(BankImportHeaderSum)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(BankImportHeaderSumDetail)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(BankInformation)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(BankParameterDEV)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(BookEntryCheck)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CertificateofContractHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CertificateofContractRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractMileStone)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractProductHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractProductLINQ)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractProductRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractProductRowsEvent)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractProductRowsInOut)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractRowsCloneView)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractRowsDividePopup)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractRowsToFinalInvoice)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Contracts)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractsCloneView)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractsFromAcknowledgement_PopUp)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ContractsRowsToInvoice)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Corner)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRM_Leads)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRM_Leads_Activity)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRM_Leads_Activity_Task)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRM_Leads_Actvity_Completed_Popup)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRM_Leads_Qualification)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRM_Opportunities)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Leads)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Leads_Activity)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Leads_Immovables)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Leads_Immovables_Reservation)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Leads_Immovables_Reservation_Popup)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Opportunity)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Opportunity_AdvanceMoney)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Opportunity_Customers)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Opportunity_Immovables)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Opportunity_Payment_Forecast)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMEstate_Opportunity_Rent)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMNote)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(CRMTask)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DeliveryNoteInFromOrderOutRowsHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DeliveryNoteInFromOrderOutRowsRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DeliveryNoteInHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DeliveryNoteInRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DeliveryNoteInToStorageInHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DeliveryNoteOutHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(DeliveryNoteOutRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Events)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLAccounts)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLBank)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLBankDivide)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLCardsHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLCardsRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLCassa)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLCassaOpenClose)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLClosingRecord)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLClosingTime)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLCompensation)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLDetails)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLFileData)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLMixed)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLRegister)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLReport)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLReportRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLResetAll)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLRowsCheck)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLRowsDivide)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLRowsDivideH)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(GLRowsDivideR)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesCostRecord)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesCostRecordEvents)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesCostRecordExcel)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesCostRecordGroup)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesPriceListHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesPriceListRowsA)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesPriceListRowsC)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesPriceListRowsG)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovablesPriceListRowsO)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ImmovableStatus)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InstallmentPayment)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InventoryDifferent)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InventoryHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InventoryPDA)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InventorySC)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InventorySIR)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InvoiceChoiceNextStep)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InvoiceHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InvoiceNameParameters)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InvoiceRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InvoiceRowsFIFO)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(InvoiceVATRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LateCharges)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LiquidAssetsBallanceHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LiquidAssetsBallanceRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LiquidAssetsReturnDenomination)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LiquidAssetsReturnHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(LiquidAssetsReturnRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ModifyProductsParameters)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(MySceduleFileData)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(MySchedule)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(MyTasks)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OfferInHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OfferInheaderFileAttachment)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OfferInRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OfferOutCostRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OfferOutHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OfferOutRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OfferOutVATRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Offices)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInAcknowledgementHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInAcknowledgementRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInAcknowledgementVAT)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInHeaderFromOfferOutRowsHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInHeaderFromOfferOutRowsRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInHeaderVAT)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInRowsOther)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInTo)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderInToDispose)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderOutHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OrderOutRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OutlookEMail)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OutlookEMailAttachments)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OutlookEMailIn)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(OutlookReminder)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PartnerAccountConnectionInfoQueryHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PartnerAccountConnectionInfoQueryPartner)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PartnerAccountConnectionInfoQueryRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PartnerAccountConnectionInfoQuerySelectedCustomers)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PartnerAccountConnectionInfoQuerySelectedCustomersFrom)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PartnerConnectionInfoCleanUp_PopupWindow)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PartnerConnectionInfoCleanUp_PopupWindow_SelectedItem)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PartnerConnectionInfoDetailView)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PartnerConnectionInfoSpecTran_PopupWindow)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PCIDetail)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PCIGroup)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(PermissionMatrix)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ProjectPlan)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(ProjectPlanRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Question)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryBankTransfer)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryChoiceNextStep)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryFileData)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryRowsDeliveryNoteIn)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryRowsFinancial)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryRowsFinancialControlling)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryRowsFinancialControlling_ReInvoicePopupWindow)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryRowsFinancialControllingPopupWindow)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RegistryTasks)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Reply)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RRFCQueryHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(RRFCQueryRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(SIS_Top10_Customers)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(SpecTranRevaluation)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(SpecTranRevaluationRowsAccounts)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageComputed)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageInfromDeliveryNoteInRowsHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageInfromDeliveryNoteInRowsRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageInHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageInRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageMoveEvents)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageOutCirculation)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageOutHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageOutRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StorageOutRowsInRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StoragePDACollectionHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(StoragePDACollectionRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(TakeoverProtocolHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(TakeoverProtocolRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(TrialBalance)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(TrialBalanceHeader)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(TrialBalanceOpenClose)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(TrialBalanceSum)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(VATReport)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(VATReportDetail)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(VATReportFileAttachment)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(VATReportGroup)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(VATReportNoPayDetail)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Vivaldi)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Worksheet_CostRows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(Worksheet_Documets)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(WorkSheet_Header)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(WorkSheet_Rows)))
        _ObjectsToDelete.AddRange(_ocur.GetObjects(GetType(XLSImports)))

        '-- Nullázandó táblák ---------------------------------------------------
        Dim _NumberGeneratorSemafor_Collection As New XPCollection(Of NumberGeneratorSemafor)(_ocur.Session, CriteriaOperator.Parse("Oid=Oid"))
        Dim _NumberGeneratorSemafor As NumberGeneratorSemafor

        For Each _NumberGeneratorSemafor In _NumberGeneratorSemafor_Collection
            _NumberGeneratorSemafor.SerialNumber = 0
        Next

        _ocur.Delete(_ObjectsToDelete)
        _ocur.CommitChanges()


    End Sub
End Class
