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 Imports DevExpress.ExpressApp.Utils Public Class TextCollection_VC Inherits DevExpress.ExpressApp.ViewController Public Sub New() MyBase.New() InitializeComponent() RegisterActions(components) End Sub Private Sub aTextCollection_CreateCollection_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aTextCollection_CreateCollection_RW1.CustomizePopupWindowParams Try Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _TextCollection_CollectionSource As New CollectionSource(_onew, GetType(TextCollection)) Dim _TextArray As New ArrayList Select Case View.Tag Case "aCRM_LeadsDocumentation_ChangeGroup" Dim _CRM_LeadsDocumentation_Collection As New XPCollection(Of CRM_LeadsDocumentation)(_onew.Session) For Each _CRM_LeadsDocumentation As CRM_LeadsDocumentation In _CRM_LeadsDocumentation_Collection If _TextArray.Count = 0 And Not String.IsNullOrEmpty(_CRM_LeadsDocumentation.RowGroup1) Then _TextArray.Add(_CRM_LeadsDocumentation.RowGroup1) Else If Not _TextArray.Contains(_CRM_LeadsDocumentation.RowGroup1) And Not String.IsNullOrEmpty(_CRM_LeadsDocumentation.RowGroup1) _ Then _TextArray.Add(_CRM_LeadsDocumentation.RowGroup1) End If Next Case "aCustomersFileAttachment_ChangeGroup" Dim _CustomersFileAttachment_Collection As New XPCollection(Of CustomersFileAttachment)(_onew.Session) For Each _CustomersFileAttachment As CustomersFileAttachment In _CustomersFileAttachment_Collection If _TextArray.Count = 0 And Not String.IsNullOrEmpty(_CustomersFileAttachment.RowGroup1) Then _TextArray.Add(_CustomersFileAttachment.RowGroup1) Else If Not _TextArray.Contains(_CustomersFileAttachment.RowGroup1) And Not String.IsNullOrEmpty(_CustomersFileAttachment.RowGroup1) _ Then _TextArray.Add(_CustomersFileAttachment.RowGroup1) End If Next Case "aProductsDocumentations_ChangeGroup" Dim _ProductsDocumentations_Collection As New XPCollection(Of ProductsDocumentations)(_onew.Session) For Each _ProductsDocumentations As ProductsDocumentations In _ProductsDocumentations_Collection If _TextArray.Count = 0 And Not String.IsNullOrEmpty(_ProductsDocumentations.RowGroup1) Then _TextArray.Add(_ProductsDocumentations.RowGroup1) Else If Not _TextArray.Contains(_ProductsDocumentations.RowGroup1) And Not String.IsNullOrEmpty(_ProductsDocumentations.RowGroup1) _ Then _TextArray.Add(_ProductsDocumentations.RowGroup1) End If Next Case "aCustomersDocFileAttachment_ChangeGroup" Dim _CustomersFileAttachment_Collection As New XPCollection(Of CustomersFileAttachment)(_onew.Session) For Each _CustomersFileAttachment As CustomersFileAttachment In _CustomersFileAttachment_Collection If _TextArray.Count = 0 And Not String.IsNullOrEmpty(_CustomersFileAttachment.RowGroup1) Then _TextArray.Add(_CustomersFileAttachment.RowGroup1) Else If Not _TextArray.Contains(_CustomersFileAttachment.RowGroup1) And Not String.IsNullOrEmpty(_CustomersFileAttachment.RowGroup1) _ Then _TextArray.Add(_CustomersFileAttachment.RowGroup1) End If Next Case Else _TextArray = Nothing End Select If _TextArray IsNot Nothing Then For Each _RowGroup1Text As String In _TextArray Dim _TextCollection As New TextCollection(_onew.Session) _TextCollection.RowGroup = _RowGroup1Text _TextCollection_CollectionSource.Add(_TextCollection) Next End If e.View = Application.CreateListView("TextCollection_ListView", _TextCollection_CollectionSource, True) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain"))) End Try End Sub Private Sub aTextCollection_CreateCollection_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aTextCollection_CreateCollection_RW1.Execute Try Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = TryCast(View.SelectedObjects(0), ChangeFileAttachment_PopUp) _ChangeFileAttachment_PopUp.ChangeRowGroup1 = True _ChangeFileAttachment_PopUp.RowGroup1 = TryCast(e.PopupWindow.View.SelectedObjects(0), TextCollection).RowGroup Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain"))) End Try End Sub Private Sub aTextCollection_CreateCollection_RW2_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aTextCollection_CreateCollection_RW2.CustomizePopupWindowParams Try Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _TextCollection_CollectionSource As New CollectionSource(_onew, GetType(TextCollection)) Dim _TextArray As New ArrayList Select Case View.Tag Case "aCRM_LeadsDocumentation_ChangeGroup" Dim _CRM_LeadsDocumentation_Collection As New XPCollection(Of CRM_LeadsDocumentation)(_onew.Session) For Each _CRM_LeadsDocumentation As CRM_LeadsDocumentation In _CRM_LeadsDocumentation_Collection If _TextArray.Count = 0 And Not String.IsNullOrEmpty(_CRM_LeadsDocumentation.RowGroup2) Then _TextArray.Add(_CRM_LeadsDocumentation.RowGroup2) Else If Not _TextArray.Contains(_CRM_LeadsDocumentation.RowGroup2) And Not String.IsNullOrEmpty(_CRM_LeadsDocumentation.RowGroup2) _ Then _TextArray.Add(_CRM_LeadsDocumentation.RowGroup2) End If Next Case "aCustomersFileAttachment_ChangeGroup" Dim _CustomersFileAttachment_Collection As New XPCollection(Of CustomersFileAttachment)(_onew.Session) For Each _CustomersFileAttachment As CustomersFileAttachment In _CustomersFileAttachment_Collection If _TextArray.Count = 0 And Not String.IsNullOrEmpty(_CustomersFileAttachment.RowGroup2) Then _TextArray.Add(_CustomersFileAttachment.RowGroup2) Else If Not _TextArray.Contains(_CustomersFileAttachment.RowGroup2) And Not String.IsNullOrEmpty(_CustomersFileAttachment.RowGroup2) _ Then _TextArray.Add(_CustomersFileAttachment.RowGroup2) End If Next Case "aProductsDocumentations_ChangeGroup" Dim _ProductsDocumentations_Collection As New XPCollection(Of ProductsDocumentations)(_onew.Session) For Each _ProductsDocumentations As ProductsDocumentations In _ProductsDocumentations_Collection If _TextArray.Count = 0 And Not String.IsNullOrEmpty(_ProductsDocumentations.RowGroup2) Then _TextArray.Add(_ProductsDocumentations.RowGroup2) Else If Not _TextArray.Contains(_ProductsDocumentations.RowGroup2) And Not String.IsNullOrEmpty(_ProductsDocumentations.RowGroup2) _ Then _TextArray.Add(_ProductsDocumentations.RowGroup2) End If Next Case "aCustomersDocFileAttachment_ChangeGroup" Dim _CustomersFileAttachment_Collection As New XPCollection(Of CustomersFileAttachment)(_onew.Session) For Each _CustomersFileAttachment As CustomersFileAttachment In _CustomersFileAttachment_Collection If _TextArray.Count = 0 And Not String.IsNullOrEmpty(_CustomersFileAttachment.RowGroup2) Then _TextArray.Add(_CustomersFileAttachment.RowGroup2) Else If Not _TextArray.Contains(_CustomersFileAttachment.RowGroup2) And Not String.IsNullOrEmpty(_CustomersFileAttachment.RowGroup2) _ Then _TextArray.Add(_CustomersFileAttachment.RowGroup2) End If Next Case Else _TextArray = Nothing End Select If _TextArray IsNot Nothing Then For Each _RowGroup2Text As String In _TextArray Dim _TextCollection As New TextCollection(_onew.Session) _TextCollection.RowGroup = _RowGroup2Text _TextCollection_CollectionSource.Add(_TextCollection) Next End If e.View = Application.CreateListView("TextCollection_ListView", _TextCollection_CollectionSource, True) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain"))) End Try End Sub Private Sub aTextCollection_CreateCollection_RW2_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aTextCollection_CreateCollection_RW2.Execute Try Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = TryCast(View.SelectedObjects(0), ChangeFileAttachment_PopUp) _ChangeFileAttachment_PopUp.ChangeRowGroup2 = True _ChangeFileAttachment_PopUp.RowGroup2 = TryCast(e.PopupWindow.View.SelectedObjects(0), TextCollection).RowGroup Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain"))) End Try End Sub Private Sub aInvoiceHeader_Description_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aInvoiceHeader_Description.CustomizePopupWindowParams Try Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _ORI_Invoice_Popup As ORI_Invoice_Popup = TryCast(View.SelectedObjects(0), ORI_Invoice_Popup) If _ORI_Invoice_Popup Is Nothing Then Throw New Exception("*Váratlan hiba történt, a folyamat megszakadt!") Dim _TextCollection_CollectionSource As New CollectionSource(_onew, GetType(TextCollection)) Dim _TextArray As New ArrayList Dim _InvoiceHeader_Collection As New XPCollection(Of InvoiceHeader)(_onew.Session, CriteriaOperator.Parse("CustomersFrom=?", _onew.GetObject(_ORI_Invoice_Popup.CustomersFrom))) For Each _InvoiceHeader As InvoiceHeader In _InvoiceHeader_Collection If Not String.IsNullOrEmpty(_InvoiceHeader.Description) Then If _TextArray.Count = 0 Then _TextArray.Add(_InvoiceHeader.Description) Else If Not _TextArray.Contains(_InvoiceHeader.Description) Then _TextArray.Add(_InvoiceHeader.Description) End If End If Next For Each _Description As String In _TextArray Dim _TextCollection As New TextCollection(_onew.Session) _TextCollection.RowGroup = _Description _TextCollection_CollectionSource.Add(_TextCollection) Next e.View = Application.CreateListView("TextCollection_ListView", _TextCollection_CollectionSource, True) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain"))) End Try End Sub Private Sub aInvoiceHeader_Description_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aInvoiceHeader_Description.Execute Try Dim _ORI_Invoice_Popup As ORI_Invoice_Popup = TryCast(View.SelectedObjects(0), ORI_Invoice_Popup) If e.PopupWindow.View.SelectedObjects.Count = 0 Then Throw New Exception("*Nem lett kiválasztva egyetlen sor sem!") For Each _TextCollection As TextCollection In e.PopupWindow.View.SelectedObjects If String.IsNullOrEmpty(_ORI_Invoice_Popup.Description) Then _ORI_Invoice_Popup.Description = _TextCollection.RowGroup Else _ORI_Invoice_Popup.Description += vbNewLine + _TextCollection.RowGroup End If Next Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain"))) End Try End Sub Private Sub aDeliveryNoteOutHeader_Note_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aDeliveryNoteOutHeader_Note.CustomizePopupWindowParams Try Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _DeliveryNoteOutfromStorageOutrowsInRowsPopup As DeliveryNoteOutfromStorageOutrowsInRowsPopup = TryCast(View.SelectedObjects(0), DeliveryNoteOutfromStorageOutrowsInRowsPopup) If _DeliveryNoteOutfromStorageOutrowsInRowsPopup Is Nothing Then Throw New Exception("*Váratlan hiba történt, a folyamat megszakadt!") Dim _TextCollection_CollectionSource As New CollectionSource(_onew, GetType(TextCollection)) Dim _TextArray As New ArrayList Dim _DeliveryNoteOutHeaderr_Collection As New XPCollection(Of DeliveryNoteOutHeader)(_onew.Session, CriteriaOperator.Parse("CustomersFrom=?", _onew.GetObject(_DeliveryNoteOutfromStorageOutrowsInRowsPopup.CustomersFrom))) For Each _DeliveryNoteOutHeader As DeliveryNoteOutHeader In _DeliveryNoteOutHeaderr_Collection If Not String.IsNullOrEmpty(_DeliveryNoteOutHeader.Note) Then If _TextArray.Count = 0 Then _TextArray.Add(_DeliveryNoteOutHeader.Note) Else If Not _TextArray.Contains(_DeliveryNoteOutHeader.Note) Then _TextArray.Add(_DeliveryNoteOutHeader.Note) End If End If Next For Each _Description As String In _TextArray Dim _TextCollection As New TextCollection(_onew.Session) _TextCollection.RowGroup = _Description _TextCollection_CollectionSource.Add(_TextCollection) Next e.View = Application.CreateListView("TextCollection_ListView", _TextCollection_CollectionSource, True) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain"))) End Try End Sub Private Sub aDeliveryNoteOutHeader_Note_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aDeliveryNoteOutHeader_Note.Execute Try Dim _DeliveryNoteOutfromStorageOutrowsInRowsPopup As DeliveryNoteOutfromStorageOutrowsInRowsPopup = TryCast(View.SelectedObjects(0), DeliveryNoteOutfromStorageOutrowsInRowsPopup) If e.PopupWindow.View.SelectedObjects.Count = 0 Then Throw New Exception("*Nem lett kiválasztva egyetlen sor sem!") For Each _TextCollection As TextCollection In e.PopupWindow.View.SelectedObjects If String.IsNullOrEmpty(_DeliveryNoteOutfromStorageOutrowsInRowsPopup.Note) Then _DeliveryNoteOutfromStorageOutrowsInRowsPopup.Note = _TextCollection.RowGroup Else _DeliveryNoteOutfromStorageOutrowsInRowsPopup.Note += vbNewLine + _TextCollection.RowGroup End If Next Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain"))) End Try End Sub End Class