Hi, i need to show audit info about a master object and his childs in a unique popup.
Actually i've implemented this code to show audit info:
Public Class viewAudit
Inherits DevExpress.ExpressApp.ViewController
Private showAuditInfoActionCore As SimpleAction
Public Sub New()
showAuditInfoActionCore = New SimpleAction(Me, "ShowAuditInfo", DevExpress.Persistent.Base.PredefinedCategory.View)
showAuditInfoActionCore.Caption = "Cronologia modifiche"
showAuditInfoActionCore.ImageName = "Audit"
AddHandler showAuditInfoActionCore.Execute, AddressOf showAuditInfoActionCore_Execute
showAuditInfoActionCore.PaintStyle = ActionItemPaintStyle.Image
showAuditInfoActionCore.TargetViewType = ViewType.Any
End Sub
Public Function GetAuditInfo(ByVal session As Session, ByVal targetType As Type) As XPCollection(Of AuditDataItemPersistent)
Dim bo1 As New BinaryOperator("TargetType", session.GetObjectType(session.GetClassInfo(targetType)))
Dim bo2 As New BinaryOperator("TargetKey", XPWeakReference.KeyToString(ObjectSpace.GetKeyValue(Me.View.CurrentObject)))
Dim auditObjectWeakReference As AuditedObjectWeakReference = session.FindObject(Of AuditedObjectWeakReference)(New GroupOperator(GroupOperatorType.And, bo1, bo2))
If auditObjectWeakReference IsNot Nothing Then
auditObjectWeakReference.AuditDataItems.BindingBehavior = CollectionBindingBehavior.AllowNone
Return auditObjectWeakReference.AuditDataItems
End If
Return Nothing
End Function
Protected Overridable Sub ShowAuditInfo(ByVal e As SimpleActionExecuteEventArgs)
Dim auditInfo As XPCollection(Of AuditDataItemPersistent)
Dim objSpace As XPObjectSpace = CType(View.ObjectSpace, XPObjectSpace)
auditInfo = GetAuditInfo(CType(View.ObjectSpace, XPObjectSpace).Session, View.ObjectTypeInfo.Type)
If auditInfo IsNot Nothing Then
Dim cs As CollectionSourceBase = New CollectionSource(objSpace, GetType(AuditDataItemPersistent))
e.ShowViewParameters.CreatedView = Application.CreateListView(Application.FindListViewId(GetType(AuditDataItemPersistent)), cs, False)
e.ShowViewParameters.CreatedView.Caption = String.Format("{0} History", e.ShowViewParameters.CreatedView.ObjectTypeInfo.Name)
cs.Criteria("AllAuditInfo") = New InOperator(objSpace.GetKeyPropertyName(GetType(AuditDataItemPersistent)), auditInfo)
e.ShowViewParameters.Context = TemplateContext.View
e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow
Else
XtraMessageBox.Show("Non ci sono dati nella cronologia.", Application.Title, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information)
End If
End Sub
Private Sub showAuditInfoActionCore_Execute(ByVal sender As Object, ByVal e As SimpleActionExecuteEventArgs)
ShowAuditInfo(e)
End Sub
Public ReadOnly Property ShowAuditInfoAction() As SimpleAction
Get
Return showAuditInfoActionCore
End Get
End Property
End Class
In the GetAuditInfo sub i'd like to return a complete collection of AuditDataItemPersistent referred to master object and childs too.
How can i get all types and all id's of object referred from the master object so i can create the criteria and return the complete collection?
Thanks,
Paolo
Please accept our apologies for the delay in responding. We couldn't find an immediate answer or resolution. Please bear with us. We will inform you as soon as an answer is found.