Imports Microsoft.VisualBasic Imports System Imports System.Linq Imports System.Text Imports DevExpress.ExpressApp Imports DevExpress.Data.Filtering Imports System.Collections.Generic Imports DevExpress.Persistent.Base Imports DevExpress.ExpressApp.Utils Imports DevExpress.ExpressApp.Layout Imports DevExpress.ExpressApp.Actions Imports DevExpress.ExpressApp.Editors Imports DevExpress.ExpressApp.Templates Imports DevExpress.Persistent.Validation Imports DevExpress.ExpressApp.SystemModule Imports DevExpress.ExpressApp.Model.NodeGenerators Imports DevExpress.Xpo Imports DevExpress.Persistent.BaseImpl ' For more typical usage scenarios, be sure to check out http://documentation.devexpress.com/#Xaf/clsDevExpressExpressAppViewControllertopic. Partial Public Class AnonymVC Inherits ViewController Public Sub New() InitializeComponent() RegisterActions(components) ' Target required Views (via the TargetXXX properties) and create their Actions. End Sub Protected Overrides Sub OnActivated() MyBase.OnActivated() ' Perform various tasks depending on the target View. Frame.GetController(Of AnonymVC).aAnonymData.Active.SetItemValue("", False) 'If SecuritySystem.CurrentUserName = "SysAdmin" Then ' Frame.GetController(Of AnonymVC).aAnonymData.Active.SetItemValue("", True) 'End If End Sub Protected Overrides Sub OnViewControlsCreated() MyBase.OnViewControlsCreated() ' Access and customize the target View control. End Sub Protected Overrides Sub OnDeactivated() ' Unsubscribe from previously subscribed events and release other references and resources. Frame.GetController(Of AnonymVC).aAnonymData.Active.SetItemValue("", False) MyBase.OnDeactivated() End Sub Private Sub aAnonymData_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aAnonymData.Execute Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace Dim _uow As New UnitOfWork(_onew.Session.DataLayer) Dim _Organization_Collection As New XPCollection(Of Organization)(_uow) Dim _Organization As Organization For Each _Organization In _Organization_Collection Dim _Z1 As ZIPHU = ObjectSpace.FindObject(Of ZIPHU)(CriteriaOperator.Parse("ID=?", Math.Round(Rnd() * 3570, 0, MidpointRounding.AwayFromZero))) Dim _Z2 As ZIPHU = ObjectSpace.FindObject(Of ZIPHU)(CriteriaOperator.Parse("ID=?", Math.Round(Rnd() * 3570, 0, MidpointRounding.AwayFromZero))) _Organization.Name = String.Format("{0} {1}", _Z1.City, _Z2.City) _Organization.FullName = _Organization.Name If _Organization.Address1 IsNot Nothing Then _Organization.Address1.Street = _Organization.Name End If If _Organization.Address2 IsNot Nothing Then _Organization.Address2.Street = _Organization.Name End If _uow.CommitChanges() Next Dim _Person_Collection As New XPCollection(Of Person)(_uow) Dim _Person As Person For Each _Person In _Person_Collection Dim _LN1 As String = TryCast(ObjectSpace, Xpo.XPObjectSpace).Session.ExecuteScalar(String.Format("select LastName from _LastName where Oid={0}", Math.Round(Rnd() * 9039, 0, MidpointRounding.AwayFromZero))) Dim _LN2 As String = TryCast(ObjectSpace, Xpo.XPObjectSpace).Session.ExecuteScalar(String.Format("select LastName from _LastName where Oid={0}", Math.Round(Rnd() * 9039, 0, MidpointRounding.AwayFromZero))) _Person.LastName = _LN1 _Person.FirstName = _LN2 _Person.Email = String.Format("{0}.{1}@tdfexample.org", _LN2, _LN1) _uow.CommitChanges() Next End Sub End Class