130 lines
6.5 KiB
VB.net
130 lines
6.5 KiB
VB.net
Imports System.Diagnostics
|
|
Imports System.Text
|
|
|
|
Imports DevExpress.ExpressApp
|
|
Imports DevExpress.ExpressApp.Actions
|
|
Imports DevExpress.Persistent.Base
|
|
Imports DevExpress.ExpressApp.Win.SystemModule
|
|
Imports DevExpress.XtraGrid.Views.Grid
|
|
Imports DevExpress.ExpressApp.Editors
|
|
Imports DevExpress.ExpressApp.Win.Editors
|
|
Imports DevExpress.XtraGrid.Columns
|
|
|
|
Public Class GLMixedVC
|
|
Inherits DevExpress.ExpressApp.ViewController
|
|
Private _GridListEditor As GridListEditor
|
|
Public Sub New()
|
|
MyBase.New()
|
|
|
|
'This call is required by the Component Designer.
|
|
InitializeComponent()
|
|
RegisterActions(components)
|
|
|
|
End Sub
|
|
Protected Overrides Sub OnActivated()
|
|
MyBase.OnActivated()
|
|
If View.Id = "GLMixed_DetailView" Or View.Id = "GLMixed_GLRows_ListView" Then
|
|
Frame.GetController(Of WinModificationsController).ModificationsHandlingMode = SystemModule.ModificationsHandlingMode.AutoCommit
|
|
End If
|
|
|
|
End Sub
|
|
Protected Overrides Sub OnDeactivated()
|
|
MyBase.OnDeactivated()
|
|
|
|
End Sub
|
|
Protected Overrides Sub OnViewControlsCreated()
|
|
MyBase.OnViewControlsCreated()
|
|
If View.Id = "GLMixed_ListView" Then
|
|
Dim editor As ListEditor = (CType(View, ListView)).Editor
|
|
Dim gridView As GridView = (CType(editor, GridListEditor)).GridView
|
|
|
|
AddHandler gridView.SelectionChanged, AddressOf GridView_SelectionChanged
|
|
End If
|
|
|
|
If View.Id = "GLHeader_GLRows_ListView_Mixed" Then
|
|
Dim _ListView As ListView = CType(View, ListView)
|
|
Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
|
|
_GridListEditor = TryCast(TryCast(View, ListView).Editor, GridListEditor)
|
|
If _GridListEditor IsNot Nothing Then
|
|
AddHandler _GridListEditor.GridView.CellValueChanged, AddressOf GLHeader_GLRows_ListView_Mixed_CellValueChanged
|
|
'_GridListEditor.AllowEdit = True
|
|
|
|
'For i As Integer = 0 To _GridListEditor.Columns.Count - 1
|
|
|
|
' If _GridListEditor.GridView.Columns(i).FieldName <> "NoteRows" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "AmountHUF" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "AmountDEV" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "DebitChartOfAccounts!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "CreditChartOfAccounts!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "Controlling!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "CostHolder!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "CostPlace!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "JobNumberObjects!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "UniqueObjects!" Then
|
|
' _GridListEditor.GridView.Columns(i).OptionsColumn.ReadOnly = True
|
|
' _GridListEditor.GridView.Columns(i).OptionsColumn.AllowEdit = False
|
|
' _GridListEditor.GridView.Columns(i).OptionsColumn.TabStop = False
|
|
' End If
|
|
|
|
'Next
|
|
End If
|
|
End If
|
|
|
|
'If View.Id = "GLRows_ListView_Mixed" Then
|
|
' Dim _ListView As ListView = CType(View, ListView)
|
|
' _GridListEditor = TryCast(_ListView.Editor, GridListEditor)
|
|
' If _GridListEditor IsNot Nothing Then
|
|
' _GridListEditor.AllowEdit = True
|
|
|
|
' For i As Integer = 0 To _GridListEditor.Columns.Count - 1
|
|
|
|
' If _GridListEditor.GridView.Columns(i).FieldName <> "NoteRows" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "Controlling!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "CostHolder!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "CostPlace!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "JobNumberObjects!" And _
|
|
' _GridListEditor.GridView.Columns(i).FieldName <> "UniqueObjects!" Then
|
|
' _GridListEditor.GridView.Columns(i).OptionsColumn.ReadOnly = True
|
|
' _GridListEditor.GridView.Columns(i).OptionsColumn.AllowEdit = False
|
|
' _GridListEditor.GridView.Columns(i).OptionsColumn.TabStop = False
|
|
' End If
|
|
|
|
' Next
|
|
|
|
' End If
|
|
'End If
|
|
|
|
End Sub
|
|
|
|
Private Sub GridView_SelectionChanged(ByVal sender As Object, ByVal e As DevExpress.Data.SelectionChangedEventArgs)
|
|
Dim gridView As GridView = TryCast(sender, GridView)
|
|
If View.SelectedObjects.Count = 1 Then
|
|
Dim _GLMixed As GLMixed = TryCast(View.SelectedObjects(0), GLMixed)
|
|
If _GLMixed Is Nothing Then
|
|
Else
|
|
'Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController).Active.SetItemValue("", True)
|
|
If _GLMixed.IsEditable = False Then
|
|
'Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController).Active.SetItemValue("", False)
|
|
End If
|
|
End If
|
|
ElseIf View.SelectedObjects.Count > 1 Then
|
|
'Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController).Active.SetItemValue("", False)
|
|
|
|
End If
|
|
End Sub
|
|
Private Sub GLHeader_GLRows_ListView_Mixed_CellValueChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs)
|
|
Dim nestedFrame As NestedFrame = TryCast(Frame, NestedFrame)
|
|
Select Case TryCast(e.Column, GridColumn).FieldName
|
|
Case "NoteRows", "Controlling!", "CostHolder!", "JobNumberObjects!", "UniqueObjects!", "AmountHUF", "AmountDEV", "DebitChartOfAccounts!", "CreditChartOfAccounts!"
|
|
If nestedFrame IsNot Nothing Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)().Active.SetItemValue("", False)
|
|
Dim parentView As View = nestedFrame.View
|
|
TryCast(parentView.ObjectSpace, Xpo.XPObjectSpace).CommitChanges()
|
|
Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)().Active.SetItemValue("", True)
|
|
parentView.ObjectSpace.Refresh()
|
|
End If
|
|
End Select
|
|
|
|
End Sub
|
|
|
|
End Class |