Files
Nuvolar/Nuvolar.Module/BusinessObjects/Business/CRM/Classical/CRM_OpportunitiesVC.vb
T
2017-03-08 11:21:27 +01:00

605 lines
46 KiB
VB.net

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.ExpressApp.Editors
Imports DevExpress.Data.Filtering
Public Class CRM_OpportunitiesVC
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
Frame.GetController(Of CRM_OpportunitiesVC)().aCRM_O_Set_Registry.Active.SetItemValue("", False)
Frame.GetController(Of CRM_OpportunitiesVC)().aCRM_O_UnSet_Registry.Active.SetItemValue("", False)
If View.Id = "CRM_Opportunities_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of CRM_LeadsVC)().aCRMCreateTaskwithActivity.Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_DetailView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of CRM_LeadsVC)().aCRMCreateTaskwithActivity.Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_Contracts_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_CRM_Opportunities_Contacts_Roles_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_DeliveryNoteOutHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_InvoiceHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of InvoiceVC)().aPrintSelectedInvoices.Active.SetItemValue("", True)
Frame.GetController(Of InvoiceVC)().aFinalizeInvoice.Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_PCIDetail_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_OfferOutHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_OfferInHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of OffersInVC).aOfferIn_ChangeState.Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_OrderInHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_CRM_Leads_Activity_ListView" Then
Frame.GetController(Of CRM_LeadsVC)().aEdit_CRM_Leads_Activity.Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_CRM_Leads_Activity_Task_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ObjectMethodActionsViewController).Actions("Task.MarkCompleted").Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_RegistryTask_ListView_NotSet" Then
Frame.GetController(Of CRM_OpportunitiesVC)().aCRM_O_Set_Registry.Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
Dim _ListView As ListView = TryCast(View, ListView)
Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(_PropertyCollectionSource.MasterObject, CRM_Opportunities)
_ListView.CollectionSource.Criteria("ByUser") = CriteriaOperator.Parse("HRPerson.User.UserName=?", SecuritySystem.CurrentUserName)
End If
If View.Id = "CRM_Opportunities_RegistryTask_ListView_Set" Then
Frame.GetController(Of CRM_OpportunitiesVC)().aCRM_O_UnSet_Registry.Active.SetItemValue("", True)
Frame.GetController(Of RegistryVC)().aRegistryTaskGotoNextStep.Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
'// Csak az aktuális CRM ügyhöz tartozó tételek kellenek
Dim _ListView As ListView = TryCast(View, ListView)
Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(_PropertyCollectionSource.MasterObject, CRM_Opportunities)
_ListView.CollectionSource.BeginUpdateCriteria()
_ListView.CollectionSource.Criteria("Current") = CriteriaOperator.Parse("RegistryHeader.CRM_Opportunities.Oid=?", _CRM_Opportunities.Oid)
_ListView.CollectionSource.EndUpdateCriteria()
End If
If View.Id = "CRM_Opportunities_CRM_Opportunities_BusinessDirectory_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_CRM_Opportunities_Customers_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_CRM_Opportunities_CustomersContacts_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", True)
If View.Id = "CRM_Opportunities_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of CRM_LeadsVC)().aCRMCreateTaskwithActivity.Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_DetailView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_DeliveryNoteOutHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_CRM_Opportunities_Contacts_Roles_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_InvoiceHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of InvoiceVC)().aPrintSelectedInvoices.Active.SetItemValue("", False)
Frame.GetController(Of InvoiceVC)().aFinalizeInvoice.Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_PCIDetail_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_OfferInHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of OffersInVC).aOfferIn_ChangeState.Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_OfferOutHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_OrderInHeader_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_CRM_Leads_Activity_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_RegistryTask_ListView_NotSet" Then
Frame.GetController(Of CRM_OpportunitiesVC)().aCRM_O_Set_Registry.Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_RegistryTask_ListView_Set" Then
Frame.GetController(Of CRM_OpportunitiesVC)().aCRM_O_UnSet_Registry.Active.SetItemValue("", False)
Frame.GetController(Of RegistryVC)().aRegistryTaskGotoNextStep.Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_CRM_Opportunities_BusinessDirectory_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_CRM_Opportunities_CustomersOrder_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_CRM_Opportunities_CustomersOrderContacts_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", True)
End If
End Sub
Private Sub aCRM_O_CreateOfferOut_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCRM_O_CreateOfferOut.Execute
Dim _ListView As ListView = CType(View, ListView)
Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(_PropertyCollectionSource.MasterObject, CRM_Opportunities)
If _CRM_Opportunities.CustomersFrom IsNot Nothing Then
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _OfferOutHeader As OfferOutHeader = _onew.CreateObject(Of OfferOutHeader)()
_OfferOutHeader.CustomersFrom = _onew.GetObject(_CRM_Opportunities.CustomersFrom)
_OfferOutHeader.Contact = _onew.GetObject(_CRM_Opportunities.Contacts)
_OfferOutHeader.Customers = _onew.GetObject(_CRM_Opportunities.Customers)
_OfferOutHeader.IsEditable = True
_OfferOutHeader.CRM_Opportunities = _onew.GetObject(_CRM_Opportunities)
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "OfferOutHeader_DetailView", True, _OfferOutHeader)
' e.ShowViewParameters.TargetWindow = TargetWindow.NewWindow
'e.ShowViewParameters.Context = TemplateContext.ApplicationWindow
'e.ShowViewParameters.CreateAllControllers = True
Else
Throw New UserFriendlyException("Nincs beállítva saját cég!")
End If
View.Refresh()
End Sub
Private Sub aCRM_O_CreateOrderIn_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCRM_O_CreateOrderIn.Execute
Dim _ListView As ListView = CType(View, ListView)
Dim _PropertyCollectionSource As PropertyCollectionSource = TryCast(_ListView.CollectionSource, PropertyCollectionSource)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(_PropertyCollectionSource.MasterObject, CRM_Opportunities)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _OrderInHeader As OrderInHeader = _onew.CreateObject(Of OrderInHeader)()
If _CRM_Opportunities.CustomersFrom IsNot Nothing Then
_OrderInHeader.Contacts = _onew.GetObject(_CRM_Opportunities.Contacts)
_OrderInHeader.Customers = _onew.GetObjectByKey(Of Customers)(_CRM_Opportunities.Customers.Oid)
_OrderInHeader.CustomersFrom = _onew.GetObject(_CRM_Opportunities.CustomersFrom)
_OrderInHeader.CRM_Opportunities = _onew.GetObject(_CRM_Opportunities)
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "OrderInHeader_DetailView", True, _OrderInHeader)
' e.ShowViewParameters.CreatedView = Application.CreateDetailView(_ocur, "OrderInHeader_DetailView", False, _OrderInHeader)
'e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow
Else
Throw New UserFriendlyException("Nincs beállítva saját cég!")
End If
View.Refresh()
End Sub
Private Sub aCRM_O_ViewLeads_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCRM_O_ViewLeads.Execute
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(View.SelectedObjects(0), CRM_Opportunities)
Dim _CRM_Leads As CRM_Leads = _CRM_Opportunities.CRM_Leads
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "CRM_Leads_DetailView", True, _onew.GetObject(_CRM_Leads))
End Sub
Private Sub aCRM_O_CreateActivity_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCRM_O_CreateActivity.Execute
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _ListView As ListView = TryCast(View, ListView)
Dim _PropertyCollectionSource As PropertyCollectionSource = TryCast(_ListView.CollectionSource, PropertyCollectionSource)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(_PropertyCollectionSource.MasterObject, CRM_Opportunities)
Dim _CRM_Leads_Activity As CRM_Leads_Activity = _onew.CreateObject(Of CRM_Leads_Activity)()
_CRM_Leads_Activity.CRM_Leads = _onew.GetObject(_CRM_Opportunities.CRM_Leads)
_CRM_Leads_Activity.CRM_Opportunities = _onew.GetObject(_CRM_Opportunities)
_CRM_Leads_Activity.HRPerson = _onew.GetObject(_CRM_Opportunities.HRPerson)
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "CRM_Leads_Activity_DetailView", True, _CRM_Leads_Activity)
' e.ShowViewParameters.TargetWindow = TargetWindow.NewWindow
End Sub
Private Sub aCRM_O_CreateOfferIn_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCRM_O_CreateOfferIn.Execute
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _ListView As ListView = TryCast(View, ListView)
Dim _PropertyCollectionSource As PropertyCollectionSource = TryCast(_ListView.CollectionSource, PropertyCollectionSource)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(_PropertyCollectionSource.MasterObject, CRM_Opportunities)
If _CRM_Opportunities IsNot Nothing Then
Dim _OfferInHeader As OfferInHeader = _onew.CreateObject(Of OfferInHeader)()
_OfferInHeader.CRM_Opportunities = _onew.GetObjectByKey(Of CRM_Opportunities)(_CRM_Opportunities.Oid)
_OfferInHeader.CustomersFrom = _onew.GetObjectByKey(Of CustomersFrom)(_CRM_Opportunities.CustomersFrom.Oid)
'_OfferInHeader.Customers = _onew.GetObjectByKey(Of Customers)(_CRM_Opportunities.Customers.Oid)
'_OfferInHeader.Contact = _onew.GetObjectByKey(Of Contacts)(_CRM_Opportunities.Contacts.Oid)
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "OfferInHeader_DetailView", True, _OfferInHeader)
'e.ShowViewParameters.TargetWindow = TargetWindow.NewWindow
'e.ShowViewParameters.Context = TemplateContext.View
'e.ShowViewParameters.CreateAllControllers = True
End If
End Sub
Private Sub aCRM_O_CreateContracts_CustomizePopupWindowParams(sender As System.Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aCRM_O_CreateContracts.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _ListView As ListView = TryCast(View, ListView)
Dim _PropertyCollectionSource As PropertyCollectionSource = TryCast(_ListView.CollectionSource, PropertyCollectionSource)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(_PropertyCollectionSource.MasterObject, CRM_Opportunities)
If _CRM_Opportunities IsNot Nothing Then
Dim _CreateContracts_CustomizePupUp As CreateContracts_CustomizePupUp = _onew.CreateObject(Of CreateContracts_CustomizePupUp)()
_CreateContracts_CustomizePupUp.CRM_Opportunities = _onew.GetObjectByKey(Of CRM_Opportunities)(_CRM_Opportunities.Oid)
e.View = Application.CreateDetailView(_onew, "CreateContracts_CustomizePupUp_DetailView", False, _CreateContracts_CustomizePupUp)
Else
Throw New Exception("*Nincs CRM ügy!")
End If
End Sub
Private Sub aCRM_O_CreateContracts_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aCRM_O_CreateContracts.Execute
Try
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CreateContracts_CustomizePupUp As CreateContracts_CustomizePupUp = _ocur.GetObject(TryCast(e.PopupWindow.View.SelectedObjects(0), CreateContracts_CustomizePupUp))
Dim _ContractTemplate As ContractTemplate = _ocur.GetObjectByKey(Of ContractTemplate)(_CreateContracts_CustomizePupUp.ContractTemplate.Oid)
If _ContractTemplate Is Nothing Then Throw New Exception("*Nem lett beállítva szerzõdés sablon, a folyamat megszakadt!")
If _CreateContracts_CustomizePupUp.Controlling Is Nothing Then Throw New Exception("*Nem lett beállítva contollszám, a folyamat megszakadt!")
Dim _Contracts As Contracts = _onew.CreateObject(Of Contracts)()
_Contracts.CRM_Opportunities = _onew.GetObject(_CreateContracts_CustomizePupUp.CRM_Opportunities)
_Contracts.ContractTemplate = _onew.GetObject(_ContractTemplate)
_Contracts.CustomersFrom = _onew.GetObject(_CreateContracts_CustomizePupUp.CRM_Opportunities.CustomersFrom)
_Contracts.Customers = _onew.GetObject(_CreateContracts_CustomizePupUp.CRM_Opportunities.Customers)
_Contracts.DateCreated = GetSQLTime(_ocur.Session)
_Contracts.State = State.Preparation
Select Case _CreateContracts_CustomizePupUp.CreateContractsFrom
Case eCreateContractsFrom.eOrderInAcknowledgement
_Contracts.OrderInAcknowledgementHeader = _ocur.GetObject(TryCast(TryCast(e.PopupWindow.View.SelectedObjects(0), CreateContracts_CustomizePupUp).OrderInAcknowledgementHeader, OrderInAcknowledgementHeader))
_Contracts.CurrencyName = _Contracts.OrderInAcknowledgementHeader.OrderInHeader.OrderInParameters.CurrencyName
If _CreateContracts_CustomizePupUp.WithOfferInRows Then
For Each _OrderInAcknowledgementRows As OrderInAcknowledgementRows In _Contracts.OrderInAcknowledgementHeader.OrderInAcknowledgementRows
Dim _ContractRows As ContractRows = _onew.CreateObject(Of ContractRows)()
_ContractRows.Contracts = _Contracts
_ContractRows.ContractRowsType = eContractRowsType.eFix
_ContractRows.CurrencyName = _onew.GetObject(_OrderInAcknowledgementRows.OrderInAcknowledgementHeader.OrderInHeader.OrderInParameters.CurrencyName)
_ContractRows.Description = _OrderInAcknowledgementRows.Description
_ContractRows.NettoPriceDEV = _OrderInAcknowledgementRows.SumPriceDEV
_ContractRows.NettoPriceHUF = _OrderInAcknowledgementRows.SumPriceHUF
_ContractRows.PaymentOption = _ocur.GetObject(_OrderInAcknowledgementRows.OrderInAcknowledgementHeader.PaymentOption)
_ContractRows.QTT = _OrderInAcknowledgementRows.QTT
_ContractRows.QualityOption = _onew.GetObject(_OrderInAcknowledgementRows.QualityOption)
_ContractRows.RowGroup1 = _OrderInAcknowledgementRows.RowGroup1
_ContractRows.RowGroup2 = _OrderInAcknowledgementRows.RowGroup2
_ContractRows.ShipmentOption = _onew.GetObject(_OrderInAcknowledgementRows.OrderInAcknowledgementHeader.ShipmentOption)
_ContractRows.Units = _onew.GetObject(_OrderInAcknowledgementRows.Units)
_ContractRows.VAT = _onew.GetObject(_OrderInAcknowledgementRows.VAT)
_ContractRows.ShortName = _OrderInAcknowledgementRows.ShortName
_ContractRows.Controlling = _onew.GetObject(_CreateContracts_CustomizePupUp.Controlling)
_ContractRows.DateExecution = _OrderInAcknowledgementRows.DateExecution
Next
End If
Case eCreateContractsFrom.eOfferOutHeader
_Contracts.OfferOutHeader = _onew.GetObject(TryCast(e.PopupWindow.View.SelectedObjects(0), CreateContracts_CustomizePupUp).OfferOutHeader)
_Contracts.CurrencyName = _onew.GetObject(_Contracts.OfferOutHeader.CurrencyName)
If _CreateContracts_CustomizePupUp.WithOfferInRows Then
For Each _OfferOutRows As OfferOutRows In _Contracts.OfferOutHeader.OfferOutRows
Dim _ContractRows As ContractRows = _onew.CreateObject(Of ContractRows)()
_ContractRows.Contracts = _Contracts
_ContractRows.ContractRowsType = eContractRowsType.eFix
_ContractRows.CurrencyName = _onew.GetObject(_Contracts.CurrencyName)
_ContractRows.Description = _OfferOutRows.Description
_ContractRows.NettoPriceDEV = _OfferOutRows.SumPriceDEV
_ContractRows.NettoPriceHUF = _OfferOutRows.SumPriceHUF
_ContractRows.PaymentOption = _onew.GetObject(_OfferOutRows.OfferOutHeader.PaymentOption)
_ContractRows.QTT = _OfferOutRows.QTT
_ContractRows.QualityOption = _onew.GetObject(_OfferOutRows.QualityOption)
_ContractRows.RowGroup1 = _OfferOutRows.RowGroup1
_ContractRows.RowGroup2 = _OfferOutRows.RowGroup2
_ContractRows.ShipmentOption = _onew.GetObject(_OfferOutRows.OfferOutHeader.ShipmentOption)
_ContractRows.Units = _onew.GetObject(_OfferOutRows.Units)
_ContractRows.VAT = _onew.GetObject(_OfferOutRows.VAT)
_ContractRows.ShortName = _OfferOutRows.ShortName
_ContractRows.Controlling = _onew.GetObject(_CreateContracts_CustomizePupUp.Controlling)
_ContractRows.DateExecution = _OfferOutRows.OfferOutHeader.DateExecution
Next
End If
End Select
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "Contracts_DetailView", True, _Contracts)
e.ShowViewParameters.TargetWindow = TargetWindow.NewWindow
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Információ")
End Try
End Sub
Private Sub aCRM_O_Set_Registry_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCRM_O_Set_Registry.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject
If _RegistryTasks IsNot Nothing Then
If _RegistryTasks.RegistryHeader.CRM_Opportunities Is Nothing Then
_RegistryTasks.RegistryHeader.CRM_Opportunities = _CRM_Opportunities
End If
End If
_ocur.CommitChanges()
End Sub
Private Sub aCRM_O_UnSet_Registry_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCRM_O_UnSet_Registry.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _RegistryTasks As RegistryTasks = TryCast(View.SelectedObjects(0), RegistryTasks)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject
If _RegistryTasks IsNot Nothing Then
If _RegistryTasks.RegistryHeader.CRM_Opportunities IsNot Nothing Then
_RegistryTasks.RegistryHeader.CRM_Opportunities = Nothing
End If
End If
_ocur.CommitChanges()
End Sub
Private Sub aCRM_O_RecalculateEstimatedRevenue_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCRM_O_RecalculateEstimatedRevenue.Execute
'// A kimenõ ajánlatok alapján újraszámolja a becsült bevétel nagyságát
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _CRM_Opportunities As CRM_Opportunities
Dim _OfferOutHeader As OfferOutHeader
For Each _CRM_Opportunities In View.SelectedObjects
If _CRM_Opportunities.OfferOutHeader.Count > 0 Then
_CRM_Opportunities.EstimatedRevenueHUF = 0
_CRM_Opportunities.EstimatedRevenue = 0
For Each _OfferOutHeader In _CRM_Opportunities.OfferOutHeader
If _OfferOutHeader.OfferOutState = eOfferOutState.eInProgress Or _OfferOutHeader.OfferOutState = eOfferOutState.eInThinkingOf Then
_CRM_Opportunities.EstimatedRevenueHUF += _OfferOutHeader.SumPriceHUF
If _OfferOutHeader.CurrencyName Is _CRM_Opportunities.EstimatedCurrencyName Then
_CRM_Opportunities.EstimatedRevenue += _OfferOutHeader.SumPriceDEV
End If
End If
Next
End If
Next
_ocur.CommitChanges()
End Sub
Private Sub aCRM_O_CreateBusinessDirectoryTask_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aCRM_O_CreateBusinessDirectoryTask.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _BusinessDirectory As BusinessDirectory = TryCast(View.SelectedObjects(0), BusinessDirectory)
Dim _CRM_O_CreateBusinessDirectoryTask_PopUp As New CRM_O_CreateBusinessDirectoryTask_PopUp(_onew.Session)
With _CRM_O_CreateBusinessDirectoryTask_PopUp
.StartDate = GetSQLTime(_onew.Session)
.Status = General.TaskStatus.NotStarted
.Subject = _BusinessDirectory.ShortName
.Description = _BusinessDirectory.TaskDescription
End With
e.View = Application.CreateDetailView(_onew, "CRM_O_CreateBusinessDirectoryTask_PopUp_DetailView", True, _CRM_O_CreateBusinessDirectoryTask_PopUp)
End Sub
Private Sub aCRM_O_CreateBusinessDirectoryTask_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aCRM_O_CreateBusinessDirectoryTask.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, CRM_Opportunities)
If _CRM_Opportunities Is Nothing Then Exit Sub
Dim _CRM_O_CreateBusinessDirectoryTask_PopUp As CRM_O_CreateBusinessDirectoryTask_PopUp = TryCast(e.PopupWindow.View.SelectedObjects(0), CRM_O_CreateBusinessDirectoryTask_PopUp)
Dim _BusinessDirectory As BusinessDirectory = TryCast(View.SelectedObjects(0), BusinessDirectory)
Dim _CRM_Leads_Activity_Task As New CRM_Leads_Activity_Task(_ocur.Session)
With _CRM_Leads_Activity_Task
.CRM_Opportunities = _CRM_Opportunities
.MasterKey = _BusinessDirectory.Oid
.Description = _CRM_O_CreateBusinessDirectoryTask_PopUp.Description
.StartDate = _CRM_O_CreateBusinessDirectoryTask_PopUp.StartDate
.DueDate = _CRM_O_CreateBusinessDirectoryTask_PopUp.DueDate
.Subject = _CRM_O_CreateBusinessDirectoryTask_PopUp.Subject
.Status = _CRM_O_CreateBusinessDirectoryTask_PopUp.Status
.HRPerson = _ocur.GetObjectByKey(Of HRPerson)(_CRM_O_CreateBusinessDirectoryTask_PopUp.HRPerson.Oid)
.AlertPeriod = _ocur.GetObjectByKey(Of AlertPeriod)(_CRM_O_CreateBusinessDirectoryTask_PopUp.AlertPeriod.Oid)
End With
_ocur.CommitChanges()
End Sub
Private Sub aCRM_O_CRM_O_Customers_New_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aCRM_O_CRM_O_Customers_New.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _Customers_CollectionSource As New CollectionSource(_onew, GetType(Customers))
e.View = Application.CreateListView("Customers_ListView", _Customers_CollectionSource, True)
End Sub
Private Sub aCRM_O_CRM_O_Customers_New_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aCRM_O_CRM_O_Customers_New.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, CRM_Opportunities)
If _CRM_Opportunities IsNot Nothing Then
For Each _Customers As Customers In e.PopupWindow.View.SelectedObjects
Dim _CRM_Opportunities_Customers As New CRM_Opportunities_Customers(_ocur.Session)
With _CRM_Opportunities_Customers
.CRM_Opportunities = _CRM_Opportunities
.Customers = _ocur.GetObject(_Customers)
End With
Next
_ocur.CommitChanges()
Dim nestedFrame As NestedFrame = TryCast(Frame, NestedFrame)
If nestedFrame IsNot Nothing Then
Dim parentView As View = nestedFrame.View
If parentView IsNot Nothing Then parentView.ObjectSpace.Refresh()
End If
End If
End Sub
Private Sub aCRM_O_CRM_O_CustomersContacts_New_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aCRM_O_CRM_O_CustomersContacts_New.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, CRM_Opportunities)
Dim _Contacts_CollectionSource As New CollectionSource(_onew, GetType(Contacts))
Dim _Filter As String = "Oid in("
For Each _CRM_Opportunities_Customers As CRM_Opportunities_Customers In _CRM_Opportunities.CRM_Opportunities_Customers
For Each _Contacts As Contacts In _CRM_Opportunities_Customers.Customers.Contacts
_Filter += "'" + _Contacts.Oid.ToString + "', "
Next
Next
If _Filter.Length > 7 Then
_Filter = _Filter.Remove(_Filter.Length - 2, 2)
_Filter += ")"
Else
_Filter = "1=2"
End If
_Contacts_CollectionSource.BeginUpdateCriteria()
_Contacts_CollectionSource.Criteria.Add("First", CriteriaOperator.Parse(_Filter))
_Contacts_CollectionSource.EndUpdateCriteria()
e.View = Application.CreateListView("Contacts_ListView", _Contacts_CollectionSource, True)
End Sub
Private Sub aCRM_O_CRM_O_CustomersContacts_New_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aCRM_O_CRM_O_CustomersContacts_New.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, CRM_Opportunities)
If _CRM_Opportunities IsNot Nothing Then
For Each _Contacts As Contacts In e.PopupWindow.View.SelectedObjects
Dim _CRM_Opportunities_CustomersContacts As New CRM_Opportunities_CustomersContacts(_ocur.Session)
With _CRM_Opportunities_CustomersContacts
.CRM_Opportunities = _CRM_Opportunities
.Contacts = _ocur.GetObject(_Contacts)
End With
Next
_ocur.CommitChanges()
End If
End Sub
Private Sub aCRM_O_CRM_O_CustomersContacts_Delete_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aCRM_O_CRM_O_CustomersContacts_Delete.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
_ocur.Delete(View.SelectedObjects)
_ocur.CommitChanges()
End Sub
Private Sub aCRM_O_CRM_O_Customers_Delete_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aCRM_O_CRM_O_Customers_Delete.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, CRM_Opportunities)
For Each _CRM_Opportunities_Customers As CRM_Opportunities_Customers In View.SelectedObjects
Dim _CRM_Opportunities_CustomersContacts_Collection As New DevExpress.Xpo.XPCollection(Of CRM_Opportunities_CustomersContacts) _
(_ocur.Session, CriteriaOperator.Parse("CRM_Opportunities=? AND Contacts.Customers=?", _CRM_Opportunities, _CRM_Opportunities_Customers.Customers))
If _CRM_Opportunities_CustomersContacts_Collection.Count > 0 Then _ocur.Delete(_CRM_Opportunities_CustomersContacts_Collection)
_ocur.Delete(_CRM_Opportunities_Customers)
Next
_ocur.CommitChanges()
End Sub
End Class