Reconfigure for GIT

This commit is contained in:
2017-03-26 20:00:03 +02:00
commit 00637826ab
8056 changed files with 535977 additions and 0 deletions
@@ -0,0 +1,32 @@
Partial Class ActionToolTipforSysAdmin
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,73 @@
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.Templates
Imports DevExpress.ExpressApp.Editors
Public Class ActionToolTipforSysAdmin
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
Dim _Container As IActionContainer
Dim _Action As DevExpress.ExpressApp.Actions.ActionBase
If Frame.Template IsNot Nothing Then
For Each _Container In Frame.Template.GetContainers
For Each _Action In _Container.Actions
_Action.ToolTip = "View Id: " & View.Id & Chr(13) + Chr(10) & "Action Id : " & _Action.Id & Chr(13) & Chr(10) & "Controller Id : " & _Action.Controller.Name
Next
Next
End If
If TryCast(Frame, NestedFrame) IsNot Nothing Then
If TryCast(Frame, NestedFrame).Controllers.Count > 0 Then
Dim _Controller As Controller
For Each _Controller In TryCast(Frame, NestedFrame).Controllers
For Each _Action In _Controller.Actions
_Action.ToolTip = "View Id: " & View.Id & Chr(13) + Chr(10) & "Action Id : " & _Action.Id & Chr(13) & Chr(10) & "Controller Id : " & _Action.Controller.Name
Next
Next
End If
End If
AddHandler View.ControlsCreated, AddressOf View_ControlsCreated
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
RemoveHandler View.ControlsCreated, AddressOf View_ControlsCreated
End Sub
Private Sub View_ControlsCreated(sender As Object, e As EventArgs)
If TryCast(View, DetailView) IsNot Nothing Then
Dim _ViewItem As ViewItem
Dim _ActionContainerViewItem As ActionContainerViewItem
For Each _ViewItem In TryCast(View, DetailView).Items
_ActionContainerViewItem = TryCast(_ViewItem, ActionContainerViewItem)
If _ActionContainerViewItem IsNot Nothing Then
AddHandler _ActionContainerViewItem.ControlCreated, AddressOf ActionContainerViewItem_ControlCreated
End If
Next
End If
End Sub
Private Sub ActionContainerViewItem_ControlCreated(sender As Object, e As EventArgs)
For Each _Action In TryCast(sender, ActionContainerViewItem).Actions
_Action.ToolTip = "View Id: " & View.Id & Chr(13) + Chr(10) & "Action Id : " & _Action.Id & Chr(13) & Chr(10) & "Controller Id : " & _Action.Controller.Name
Next
End Sub
End Class
@@ -0,0 +1,148 @@
' Developer Express Code Central Example:
' How to prevent sorting by columns in a ListView
'
' This example provides a workaround solution to the
' http://www.devexpress.com/scid=S131144 suggestion. Below is the list of
' implemented features:
' 1. AllowSortAttribute - this is a regular attribute class
' that can be used in your code to mark either a business class or its property,
' to specify whether you want to allow columns to be sorted in the whole class, or
' for only a specific column:
'
' [AttributeUsage(AttributeTargets.Interface |
' AttributeTargets.Class | AttributeTargets.Field |
' AttributeTargets.Property)]
' public class AllowSortAttribute : Attribute
' {
' public AllowSortAttribute(bool allowSort) {...}
' public AllowSortAttribute()
' : this(true) { }
' ...
'
'
' See these examples below:
' a) This code prevents
' sorting by all columns in the
' ListView:
'
' [DefaultClassOptions]
' [AllowSort(false)]
' public class DemoIssue :
' BaseObject {
' ...
'
'
' b) This code prevents sorting by the Description column
' in the ListView:
'
' private string _Description;
' [AllowSort(false)]
' public
' string Description {
' get { return _Description; }
' set {
' SetPropertyValue("Description", ref _Description, value); }
' }
'
' When this
' attribute is applied to a class, its value is used to calculate the default
' value of the DefaultListViewAllowSortAttribute attribute on the BOModel | Class
' node level in the application model.
' When this attribute is applied to a
' property, its value is used to calculate the default value of the AllowSort
' attribute on the BOModel | Class | Member node level in the application
' model.
'
' 2. DefaultListViewAllowSortAttribute - this is an attribute declared
' on the BOModel | Class node level in the application model. You can use it to
' control the default sorting behavior for all ListViews of a business class. The
' value of this attribute is used to calculate the value of the attribute on the
' Views | ListView node level.
'
' 3. AllowSort - this is an attribute declared on
' the BOModel | Member, Views | ListView and ListView | Columns | ColumnInfo nodes
' level in the application model. You can use this attribute to flexibly control
' the sorting behavior of columns.
'
' 4. Sorting management, with the help of the
' AllowSort attribute, is supported in both Windows Forms and ASP.NET applications
' for the GridListEditor and ASPxGridListEditor correspondingly.
'
' See
' Also:
' http://www.devexpress.com/scid=E1253
' http://www.devexpress.com/scid=E1276
' Sorting
' (ms-help://DevExpress.WindowsForms/CustomDocument3499.htm)
' Sorting
' (ms-help://DevExpress.AspNet/CustomDocument3714.htm)
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E1254
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports DevExpress.Persistent.Base
Imports DevExpress.Xpo
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.ExpressApp
Imports DevExpress.Xpo.DB
Imports DevExpress.Xpo.Metadata
Imports DevExpress.Data
Imports DevExpress.ExpressApp.DC
Imports DevExpress.ExpressApp.Model
<AttributeUsage(AttributeTargets.Interface Or AttributeTargets.Class Or AttributeTargets.Field Or AttributeTargets.Property)> _
Public Class AllowSortAttribute
Inherits Attribute
Public Const DefaultListViewAllowSortAttributeName As String = "DefaultListViewAllowSort"
Public Const AllowSortAttributeName As String = "AllowSort"
Public Shared [Default] As New AllowSortAttribute(True)
Private allowSortCore As Boolean = True
Public Sub New()
Me.New(True)
End Sub
Public Sub New(ByVal allowSort As Boolean)
Me.allowSortCore = allowSort
End Sub
Public Property AllowSort() As Boolean
Get
Return allowSortCore
End Get
Set(ByVal value As Boolean)
allowSortCore = value
End Set
End Property
End Class
Public MustInherit Class AllowSortListViewController
Inherits ViewController(Of ListView)
Protected MustOverride Sub UpdateAllowSort()
Private Sub ListView_InfoChanged(ByVal sender As Object, ByVal e As EventArgs)
UpdateAllowSort()
End Sub
Protected Function GetAllowSortListView() As Boolean
If View.Model IsNot Nothing Then
Return (CType(View.Model, IModelListViewAllowSort)).AllowSort
End If
Return False
End Function
Protected Function GetAllowSortColumn(ByVal column As IModelColumn) As Boolean
If column IsNot Nothing AndAlso GetAllowSortListView() Then
Return (CType(column, IModelColumnAllowSort)).AllowSort
End If
Return False
End Function
Protected Overloads Overrides Sub OnActivated()
MyBase.OnActivated()
AddHandler View.ModelChanged, AddressOf ListView_InfoChanged
End Sub
Protected Overloads Overrides Sub OnDeactivated()
RemoveHandler View.ModelChanged, AddressOf ListView_InfoChanged
MyBase.OnDeactivated()
End Sub
End Class
+32
View File
@@ -0,0 +1,32 @@
Partial Class AppearanceVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,46 @@
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.ConditionalAppearance
Public Class AppearanceVC
Inherits DevExpress.ExpressApp.ViewController
Private _AppearanceController As AppearanceController
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
'_AppearanceController = Frame.GetController(Of AppearanceController)()
'If _AppearanceController IsNot Nothing Then
' AddHandler _AppearanceController.AppearanceApplied, AddressOf _AppearanceController_AppearanceApplied
'End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
'_AppearanceController = Frame.GetController(Of AppearanceController)()
'If _AppearanceController IsNot Nothing Then
' RemoveHandler _AppearanceController.AppearanceApplied, AddressOf _AppearanceController_AppearanceApplied
'End If
End Sub
Private Sub _AppearanceController_AppearanceApplied(sender As Object, e As ApplyAppearanceEventArgs)
End Sub
End Class
@@ -0,0 +1,32 @@
Partial Class AuditToDatabaseVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,28 @@
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
Public Class AuditToDatabaseVC
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
'//Biztonság kedvéért beírjuk !
GLOBAL_HAS_Audit = True
End Sub
End Class
@@ -0,0 +1,50 @@
Partial Class AuditTrailVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.aGetAuditTrail = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
'
'aGetAuditTrail
'
Me.aGetAuditTrail.Caption = "aGet Audit Trail"
Me.aGetAuditTrail.Category = "View"
Me.aGetAuditTrail.ConfirmationMessage = Nothing
Me.aGetAuditTrail.Id = "aGetAuditTrail"
Me.aGetAuditTrail.ImageName = Nothing
Me.aGetAuditTrail.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
Me.aGetAuditTrail.Shortcut = Nothing
Me.aGetAuditTrail.Tag = Nothing
Me.aGetAuditTrail.TargetObjectsCriteria = Nothing
Me.aGetAuditTrail.TargetViewId = Nothing
Me.aGetAuditTrail.ToolTip = Nothing
Me.aGetAuditTrail.TypeOfView = Nothing
End Sub
Friend WithEvents aGetAuditTrail As DevExpress.ExpressApp.Actions.SimpleAction
End Class
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="aGetAuditTrail.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,64 @@
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.Persistent.BaseImpl
Imports DevExpress.Data.Filtering
Public Class AuditTrailVC
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
TargetViewType = ViewType.ListView
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
GLOBAL_HAS_Audit = True
If View.Id Like "*AuditDataItemPersistent*" Then
Frame.GetController(Of AuditTrailVC).aGetAuditTrail.Active.SetItemValue("", False)
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id Like "*AuditDataItemPersistent*" Then
Frame.GetController(Of AuditTrailVC).aGetAuditTrail.Active.SetItemValue("", True)
End If
End Sub
Private Sub aGetAuditTrail_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aGetAuditTrail.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _AuditDataItemPersistent_Collection As XPCollection(Of AuditDataItemPersistent)
Dim _AuditDataItemPersistent As AuditDataItemPersistent
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As New CollectionSource(_onew, GetType(AuditDataItemPersistent))
_AuditDataItemPersistent_Collection = AuditedObjectWeakReference.GetAuditTrail(_ocur.Session, View.SelectedObjects(0))
_CS.BeginUpdateCriteria()
_CS.Criteria.Clear()
_CS.Criteria("First") = CriteriaOperator.Parse("1=2")
_CS.EndUpdateCriteria()
If _AuditDataItemPersistent_Collection IsNot Nothing Then
For Each _AuditDataItemPersistent In _AuditDataItemPersistent_Collection
_CS.Add(_onew.GetObject(_AuditDataItemPersistent))
Next
e.ShowViewParameters.CreatedView = Application.CreateListView("AuditDataItemPersistent_ListView", _CS, False)
e.ShowViewParameters.NewWindowTarget = NewWindowTarget.Separate
e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow
End If
End Sub
End Class
@@ -0,0 +1,32 @@
Partial Class DBV_Dashboard_VC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,239 @@
Imports System.Linq
Imports DevExpress.ExpressApp
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.Xpo
' For more typical usage scenarios, be sure to check out https://documentation.devexpress.com/eXpressAppFramework/clsDevExpressExpressAppViewControllertopic.aspx.
Partial Public Class DBV_Dashboard_VC
Inherits ViewController(Of DashboardView)
Private _DBV_CustomersOrder_ListView As DashboardViewItem
Private _DBV_Customers_ListView As DashboardViewItem
Private _DBV_OfferOutRows_ListView As DashboardViewItem
Private _DBV_OrderInRows_ListView As DashboardViewItem
Private _DBV_Products_ListView As DashboardViewItem
Private _CustomersOrder As CustomersOrder
Private _Customers As Customers
Public Sub New()
InitializeComponent()
' 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.
If View.Id = "DVB_Dashboard" Then
_DBV_CustomersOrder_ListView = CType(View.FindItem("DBV_CustomersOrder_ListView"), DashboardViewItem)
_DBV_Customers_ListView = CType(View.FindItem("DBV_Customers_ListView"), DashboardViewItem)
_DBV_OfferOutRows_ListView = CType(View.FindItem("DBV_OfferOutRows_ListView"), DashboardViewItem)
_DBV_OrderInRows_ListView = CType(View.FindItem("DBV_OrderInRows_ListView"), DashboardViewItem)
_DBV_Products_ListView = CType(View.FindItem("DBV_Products_ListView"), DashboardViewItem)
If _DBV_CustomersOrder_ListView IsNot Nothing Then
AddHandler _DBV_CustomersOrder_ListView.ControlCreated, AddressOf DBV_CustomersOrder_ListView_ControlCreated
End If
If _DBV_Customers_ListView IsNot Nothing Then
AddHandler _DBV_Customers_ListView.ControlCreated, AddressOf DBV_Customers_ListView_ControlCreated
End If
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.
MyBase.OnDeactivated()
End Sub
Private Sub DBV_CustomersOrder_ListView_ControlCreated(sender As Object, e As EventArgs)
Dim _DashboardViewItem As DashboardViewItem = DirectCast(sender, DashboardViewItem)
Dim _DBV_CustomersOrder_ListView As ListView = TryCast(_DashboardViewItem.InnerView, ListView)
If _DBV_CustomersOrder_ListView IsNot Nothing Then
RemoveHandler _DBV_CustomersOrder_ListView.SelectionChanged, AddressOf DBV_CustomersOrder_ListView_SelectionChanged
AddHandler _DBV_CustomersOrder_ListView.SelectionChanged, AddressOf DBV_CustomersOrder_ListView_SelectionChanged
End If
End Sub
Private Sub DBV_CustomersOrder_ListView_SelectionChanged(sender As Object, e As EventArgs)
Dim _ocur As Xpo.XPObjectSpace = TryCast(TryCast(_DBV_CustomersOrder_ListView.InnerView, ListView).ObjectSpace, Xpo.XPObjectSpace)
Dim _Criteria As String = ""
Dim _Criteria2 As String = ""
Dim _Criteria3 As String = ""
If TryCast(_DBV_CustomersOrder_ListView.InnerView, ListView).SelectedObjects.Count > 0 Then
_CustomersOrder = TryCast(_DBV_CustomersOrder_ListView.InnerView, ListView).SelectedObjects(0)
Dim _Exists As Boolean = False
Dim _CustomersOrderPriority_Collection As New XPCollection(Of CustomersOrderPriority)(_ocur.Session, CriteriaOperator.Parse("CustomersOrder.Oid=?", _CustomersOrder.Oid))
For Each _CustomersOrderPriority As CustomersOrderPriority In _CustomersOrderPriority_Collection
If _Criteria3 = "" Then
_Criteria3 = String.Format("Oid in ('{0}'", _CustomersOrderPriority.Products.Oid)
Else
_Criteria3 += String.Format(",'{0}'", _CustomersOrderPriority.Products.Oid)
End If
_Exists = True
Next
If _Exists Then
_Criteria3 += ")"
Else
_Criteria3 = "1=2"
End If
_Exists = False
For Each _CustomersOrderPriority As CustomersOrderPriority In _CustomersOrderPriority_Collection
Dim _OrderInRows_Collection As New XPCollection(Of OrderInRows)(_ocur.Session, CriteriaOperator.Parse("Products=?", _CustomersOrderPriority.Products))
For Each _OrderInRows As OrderInRows In _OrderInRows_Collection
If _Criteria = "" Then
_Criteria = String.Format("Oid in ('{0}'", _OrderInRows.OrderInHeader.Customers.Oid)
Else
_Criteria += String.Format(",'{0}'", _OrderInRows.OrderInHeader.Customers.Oid)
End If
_Exists = True
Next
Next
If _Exists Then
_Criteria += ")"
Else
_Criteria = "1=2"
End If
_Exists = False
For Each _CustomersOrderPriority As CustomersOrderPriority In _CustomersOrderPriority_Collection
Dim _OfferOutRows_Collection As New XPCollection(Of OfferOutRows)(_ocur.Session, CriteriaOperator.Parse("Product=?", _CustomersOrderPriority.Products))
For Each _OfferOutRows As OfferOutRows In _OfferOutRows_Collection
If _Criteria2 = "" Then
_Criteria2 = String.Format("Oid in ('{0}'", _OfferOutRows.OfferOutHeader.Customers.Oid)
Else
_Criteria2 += String.Format(",'{0}'", _OfferOutRows.OfferOutHeader.Customers.Oid)
End If
_Exists = True
Next
Next
If _Exists Then
_Criteria2 += ")"
Else
_Criteria2 = "1=2"
End If
_Criteria = String.Format("({0}) OR ({1})", _Criteria, _Criteria2)
Else
_CustomersOrder = Nothing
_Criteria = "1=2"
End If
TryCast(_DBV_Customers_ListView.InnerView, ListView).CollectionSource.Criteria.Clear()
TryCast(_DBV_Customers_ListView.InnerView, ListView).CollectionSource.BeginUpdateCriteria()
TryCast(_DBV_Customers_ListView.InnerView, ListView).CollectionSource.Criteria("Criteria") = CriteriaOperator.Parse(_Criteria)
TryCast(_DBV_Customers_ListView.InnerView, ListView).CollectionSource.EndUpdateCriteria()
TryCast(_DBV_Products_ListView.InnerView, ListView).CollectionSource.Criteria.Clear()
TryCast(_DBV_Products_ListView.InnerView, ListView).CollectionSource.BeginUpdateCriteria()
TryCast(_DBV_Products_ListView.InnerView, ListView).CollectionSource.Criteria("Criteria") = CriteriaOperator.Parse(_Criteria3)
TryCast(_DBV_Products_ListView.InnerView, ListView).CollectionSource.EndUpdateCriteria()
End Sub
Private Sub DBV_Customers_ListView_ControlCreated(sender As Object, e As EventArgs)
Dim _DashboardViewItem As DashboardViewItem = DirectCast(sender, DashboardViewItem)
Dim _DBV_Customers_ListView As ListView = TryCast(_DashboardViewItem.InnerView, ListView)
If _DBV_Customers_ListView IsNot Nothing Then
RemoveHandler _DBV_Customers_ListView.SelectionChanged, AddressOf DBV_Customers_ListView_SelectionChanged
AddHandler _DBV_Customers_ListView.SelectionChanged, AddressOf DBV_Customers_ListView_SelectionChanged
End If
End Sub
Private Sub DBV_Customers_ListView_SelectionChanged(sender As Object, e As EventArgs)
If _CustomersOrder Is Nothing Then Exit Sub
Dim _ocur As Xpo.XPObjectSpace = TryCast(TryCast(_DBV_Customers_ListView.InnerView, ListView).ObjectSpace, Xpo.XPObjectSpace)
Dim _Criteria As String = ""
Dim _Criteria2 As String = ""
Dim _Exists As Boolean = False
If TryCast(_DBV_Customers_ListView.InnerView, ListView).SelectedObjects.Count > 0 Then
_Customers = TryCast(_DBV_Customers_ListView.InnerView, ListView).SelectedObjects(0)
Else
_Customers = Nothing
End If
If _Customers IsNot Nothing Then
Dim _CustomersOrderPriority_Collection As New XPCollection(Of CustomersOrderPriority)(_ocur.Session, CriteriaOperator.Parse("CustomersOrder.Oid=?", _CustomersOrder.Oid))
For Each _CustomersOrderPriority As CustomersOrderPriority In _CustomersOrderPriority_Collection
Dim _OrderInRows_Collection As New XPCollection(Of OrderInRows)(_ocur.Session, CriteriaOperator.Parse("Products=?", _CustomersOrderPriority.Products))
For Each _OrderInRows As OrderInRows In _OrderInRows_Collection
If _Criteria = "" Then
_Criteria = String.Format("Oid in ('{0}'", _OrderInRows.Oid)
Else
_Criteria += String.Format(",'{0}'", _OrderInRows.Oid)
End If
_Exists = True
Next
Next
If _Exists Then
_Criteria += ")"
Else
_Criteria = "1=2"
End If
Else
_Criteria = "1=2"
End If
TryCast(_DBV_OrderInRows_ListView.InnerView, ListView).CollectionSource.Criteria.Clear()
TryCast(_DBV_OrderInRows_ListView.InnerView, ListView).CollectionSource.BeginUpdateCriteria()
TryCast(_DBV_OrderInRows_ListView.InnerView, ListView).CollectionSource.Criteria("Products") = CriteriaOperator.Parse(_Criteria)
If _Customers IsNot Nothing Then TryCast(_DBV_OrderInRows_ListView.InnerView, ListView).CollectionSource.Criteria("Customers") = CriteriaOperator.Parse("OrderInHeader.Customers.Oid=?", _Customers.Oid)
TryCast(_DBV_OrderInRows_ListView.InnerView, ListView).CollectionSource.EndUpdateCriteria()
_Exists = False
If _Customers IsNot Nothing Then
Dim _CustomersOrderPriority_Collection As New XPCollection(Of CustomersOrderPriority)(_ocur.Session, CriteriaOperator.Parse("CustomersOrder.Oid=?", _CustomersOrder.Oid))
For Each _CustomersOrderPriority As CustomersOrderPriority In _CustomersOrderPriority_Collection
Dim _OfferOutRows_Collection As New XPCollection(Of OfferOutRows)(_ocur.Session, CriteriaOperator.Parse("Product=?", _CustomersOrderPriority.Products))
For Each _OfferOutRows As OfferOutRows In _OfferOutRows_Collection
If _Criteria2 = "" Then
_Criteria2 = String.Format("Oid in ('{0}'", _OfferOutRows.Oid)
Else
_Criteria2 += String.Format(",'{0}'", _OfferOutRows.Oid)
End If
_Exists = True
Next
Next
If _Exists Then
_Criteria2 += ")"
Else
_Criteria2 = "1=2"
End If
Else
_Criteria2 = "1=2"
End If
TryCast(_DBV_OfferOutRows_ListView.InnerView, ListView).CollectionSource.Criteria.Clear()
TryCast(_DBV_OfferOutRows_ListView.InnerView, ListView).CollectionSource.BeginUpdateCriteria()
TryCast(_DBV_OfferOutRows_ListView.InnerView, ListView).CollectionSource.Criteria("Products") = CriteriaOperator.Parse(_Criteria2)
If _Customers IsNot Nothing Then TryCast(_DBV_OfferOutRows_ListView.InnerView, ListView).CollectionSource.Criteria("Customers") = CriteriaOperator.Parse("OfferOutHeader.Customers.Oid=?", _Customers.Oid)
TryCast(_DBV_OfferOutRows_ListView.InnerView, ListView).CollectionSource.EndUpdateCriteria()
End Sub
End Class
@@ -0,0 +1,80 @@
Partial Class DateYearCriteriaVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim ChoiceActionItem1 As DevExpress.ExpressApp.Actions.ChoiceActionItem = New DevExpress.ExpressApp.Actions.ChoiceActionItem()
Dim ChoiceActionItem2 As DevExpress.ExpressApp.Actions.ChoiceActionItem = New DevExpress.ExpressApp.Actions.ChoiceActionItem()
Dim ChoiceActionItem3 As DevExpress.ExpressApp.Actions.ChoiceActionItem = New DevExpress.ExpressApp.Actions.ChoiceActionItem()
Dim ChoiceActionItem4 As DevExpress.ExpressApp.Actions.ChoiceActionItem = New DevExpress.ExpressApp.Actions.ChoiceActionItem()
Dim ChoiceActionItem5 As DevExpress.ExpressApp.Actions.ChoiceActionItem = New DevExpress.ExpressApp.Actions.ChoiceActionItem()
Dim ChoiceActionItem6 As DevExpress.ExpressApp.Actions.ChoiceActionItem = New DevExpress.ExpressApp.Actions.ChoiceActionItem()
Me.aDateYearFilter = New DevExpress.ExpressApp.Actions.SingleChoiceAction(Me.components)
'
'aDateYearFilter
'
Me.aDateYearFilter.Caption = "aDate Year Filter"
Me.aDateYearFilter.ConfirmationMessage = Nothing
Me.aDateYearFilter.Id = "aDateYearFilter"
ChoiceActionItem1.Caption = "CurrentYear"
ChoiceActionItem1.ImageName = Nothing
ChoiceActionItem1.Shortcut = Nothing
ChoiceActionItem1.ToolTip = Nothing
ChoiceActionItem2.Caption = "PrevYear"
ChoiceActionItem2.ImageName = Nothing
ChoiceActionItem2.Shortcut = Nothing
ChoiceActionItem2.ToolTip = Nothing
ChoiceActionItem3.Caption = "Prev2Year"
ChoiceActionItem3.ImageName = Nothing
ChoiceActionItem3.Shortcut = Nothing
ChoiceActionItem3.ToolTip = Nothing
ChoiceActionItem4.Caption = "Prev3Year"
ChoiceActionItem4.ImageName = Nothing
ChoiceActionItem4.Shortcut = Nothing
ChoiceActionItem4.ToolTip = Nothing
ChoiceActionItem5.Caption = "Prev4Year"
ChoiceActionItem5.ImageName = Nothing
ChoiceActionItem5.Shortcut = Nothing
ChoiceActionItem5.ToolTip = Nothing
ChoiceActionItem6.Caption = "All"
ChoiceActionItem6.ImageName = Nothing
ChoiceActionItem6.Shortcut = Nothing
ChoiceActionItem6.ToolTip = Nothing
Me.aDateYearFilter.Items.Add(ChoiceActionItem1)
Me.aDateYearFilter.Items.Add(ChoiceActionItem2)
Me.aDateYearFilter.Items.Add(ChoiceActionItem3)
Me.aDateYearFilter.Items.Add(ChoiceActionItem4)
Me.aDateYearFilter.Items.Add(ChoiceActionItem5)
Me.aDateYearFilter.Items.Add(ChoiceActionItem6)
Me.aDateYearFilter.TargetViewType = DevExpress.ExpressApp.ViewType.ListView
Me.aDateYearFilter.ToolTip = Nothing
Me.aDateYearFilter.TypeOfView = GetType(DevExpress.ExpressApp.ListView)
End Sub
Friend WithEvents aDateYearFilter As DevExpress.ExpressApp.Actions.SingleChoiceAction
End Class
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="aDateYearFilter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,113 @@
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.Model
Imports DevExpress.Data.Filtering
Public Class DateYearCriteriaVC
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
'Me.aDateYearFilter.Items.Clear()
'Me.aDateYearFilter.Items.Add(
For Each _item In Me.aDateYearFilter.Items
Select Case _item.Caption
Case "CurrentYear"
_item.Caption = Year(Now).ToString
_item.Id = "CurrentYear"
Me.aDateYearFilter.SelectedItem = _item
Case "PrevYear"
_item.Caption = Year(DateAdd(DateInterval.Year, -1, Now)).ToString
_item.Id = "PrevYear"
Case "Prev2Year"
_item.Caption = Year(DateAdd(DateInterval.Year, -2, Now)).ToString
_item.Id = "Prev2Year"
Case "Prev3Year"
_item.Caption = Year(DateAdd(DateInterval.Year, -3, Now)).ToString
_item.Id = "Prev3Year"
Case "Prev4Year"
_item.Caption = Year(DateAdd(DateInterval.Year, -4, Now)).ToString
_item.Id = "Prev4Year"
Case "All"
_item.Id = "All"
End Select
Next
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
Frame.GetController(Of DateYearCriteriaVC).aDateYearFilter.Active.SetItemValue("", False)
If TryCast(View, ListView) IsNot Nothing Then
Dim _ListView As ListView = TryCast(View, ListView)
Dim _IModelListView As IModelListView
Dim _IModelListViewExtender As IModelListViewExtender
_IModelListView = _ListView.Model
_IModelListViewExtender = TryCast(_IModelListView, IModelListViewExtender)
If _IModelListViewExtender.DefaultDateYearInFilter = True Then
Frame.GetController(Of DateYearCriteriaVC).aDateYearFilter.Active.SetItemValue("", True)
Dim _Item As DevExpress.ExpressApp.Actions.ChoiceActionItem = Me.aDateYearFilter.FindItemByIdPath("CurrentYear")
If _Item IsNot Nothing Then
Me.aDateYearFilter.SelectedItem = _Item
If _ListView.Id Like "*LookupListView*" Then
Else
_ListView.CollectionSource.BeginUpdateCriteria()
_ListView.CollectionSource.Criteria("DateYearFilter") = CriteriaOperator.Parse("GetYear(" & _IModelListViewExtender.DefaultDateYearInFilterProperty & ")=?", Year(Now).ToString)
_ListView.CollectionSource.EndUpdateCriteria()
End If
End If
End If
End If
End Sub
Private Sub aDateYearFilter_Execute(sender As Object, e As SingleChoiceActionExecuteEventArgs) Handles aDateYearFilter.Execute
Dim _ListView As ListView = TryCast(View, ListView)
Dim _IModelListView As IModelListView
Dim _IModelListViewExtender As IModelListViewExtender
If _ListView IsNot Nothing Then
If _ListView.Id Like "*LookupListView*" Then Exit Sub
_IModelListView = _ListView.Model
_IModelListViewExtender = TryCast(_IModelListView, IModelListViewExtender)
_ListView.CollectionSource.BeginUpdateCriteria()
Select Case e.SelectedChoiceActionItem.Caption
Case Year(Now).ToString
_ListView.CollectionSource.Criteria("DateYearFilter") = CriteriaOperator.Parse("GetYear(" & _IModelListViewExtender.DefaultDateYearInFilterProperty & ")=?", Year(Now).ToString)
Case Year(DateAdd(DateInterval.Year, -1, Now)).ToString
_ListView.CollectionSource.Criteria("DateYearFilter") = CriteriaOperator.Parse("GetYear(" & _IModelListViewExtender.DefaultDateYearInFilterProperty & ")=?", Year(DateAdd(DateInterval.Year, -1, Now)).ToString)
Case Year(DateAdd(DateInterval.Year, -2, Now)).ToString
_ListView.CollectionSource.Criteria("DateYearFilter") = CriteriaOperator.Parse("GetYear(" & _IModelListViewExtender.DefaultDateYearInFilterProperty & ")=?", Year(DateAdd(DateInterval.Year, -2, Now)).ToString)
Case Year(DateAdd(DateInterval.Year, -3, Now)).ToString
_ListView.CollectionSource.Criteria("DateYearFilter") = CriteriaOperator.Parse("GetYear(" & _IModelListViewExtender.DefaultDateYearInFilterProperty & ")=?", Year(DateAdd(DateInterval.Year, -3, Now)).ToString)
Case Year(DateAdd(DateInterval.Year, -4, Now)).ToString
_ListView.CollectionSource.Criteria("DateYearFilter") = CriteriaOperator.Parse("GetYear(" & _IModelListViewExtender.DefaultDateYearInFilterProperty & ")=?", Year(DateAdd(DateInterval.Year, -4, Now)).ToString)
Case Else
_ListView.CollectionSource.BeginUpdateCriteria()
_ListView.CollectionSource.Criteria.Remove("DateYearFilter")
_ListView.CollectionSource.EndUpdateCriteria()
End Select
_ListView.CollectionSource.EndUpdateCriteria()
End If
End Sub
End Class
@@ -0,0 +1,110 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), DeferredDeletion(False)> _
Public Class ModelListView
Inherits BaseObject
Private _MasterObject As Guid
Private _EditorType As String
Private _IsFooterVisible As Boolean
Private _IsGroupPanelVisible As Boolean
Private _ShowAutoFilterRow As Boolean
Private _ShowFindPanel As Boolean
Private _Id As String
Private _PivotSettings As String
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
End Sub
Property MasterObject As Guid
Get
Return _MasterObject
End Get
Set(value As Guid)
SetPropertyValue("MasterObject", _MasterObject, value)
End Set
End Property
<Size(255)> _
Property EditorType As String
Get
Return _EditorType
End Get
Set(value As String)
SetPropertyValue("EditorType", _EditorType, value)
End Set
End Property
Property IsFooterVisible As Boolean
Get
Return _IsFooterVisible
End Get
Set(value As Boolean)
SetPropertyValue("IsFooterVisible", _IsFooterVisible, value)
End Set
End Property
Property IsGroupPanelVisible As Boolean
Get
Return _IsGroupPanelVisible
End Get
Set(value As Boolean)
SetPropertyValue("IsGroupPanelVisible", _IsGroupPanelVisible, value)
End Set
End Property
Property ShowAutoFilterRow As Boolean
Get
Return _ShowAutoFilterRow
End Get
Set(value As Boolean)
SetPropertyValue("ShowAutoFilterRow", _ShowAutoFilterRow, value)
End Set
End Property
Property ShowFindPanel As Boolean
Get
Return _ShowFindPanel
End Get
Set(value As Boolean)
SetPropertyValue("ShowFindPanel", _ShowFindPanel, value)
End Set
End Property
<Size(255)> _
Property Id As String
Get
Return _Id
End Get
Set(value As String)
SetPropertyValue("Id", _Id, value)
End Set
End Property
<Size(-1)> _
Property PivotSettings As String
Get
Return _PivotSettings
End Get
Set(value As String)
SetPropertyValue("PivotSettings", _PivotSettings, value)
End Set
End Property
ReadOnly Property ModelListViewColumn As XPCollection(Of ModelListViewColumn)
Get
Return New XPCollection(Of ModelListViewColumn)(Session, CriteriaOperator.Parse("ModelListView=?", Me))
End Get
End Property
End Class
@@ -0,0 +1,292 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions(), CreatableItem(False), NavigationItem(False), DeferredDeletion(False)> _
Public Class ModelListViewColumn
Inherits BaseObject
Private _ModelListView As ModelListView
Private _HideValueIfZero As Boolean
Private _InLineCriteria As String
Private _InLineEdit As Boolean
Private _PropertyEditorType As String
Private _AllowEdit As Boolean
Private _AllowSort As Boolean
Private _GroupInterval As DevExpress.ExpressApp.Model.GroupInterval
Private _ImmediatePostData As Boolean
Private _IsPassword As Boolean
Private _LookupEditorMode As DevExpress.Persistent.Base.LookupEditorMode
Private _SortOrder As DevExpress.Data.ColumnSortOrder
Private _DataSourceCriteria As String
Private _DataSourceProperty As String
Private _DataSourcePropertyIsNullCriteria As String
Private _LookupProperty As String
Private _ModelMember As String
Private _PropertyName As String
Private _DisplayFormat As String
Private _EditMask As String
Private _GroupIndex As Long
Private _MaxLength As Long
Private _SortIndex As Long
Private _Width As Long
Private _Caption As String
Private _GroupFooterSummaryType As DevExpress.Data.SummaryItemType
Private _Id As String
Private _Index As Long
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
End Sub
Property ModelListView As ModelListView
Get
Return _ModelListView
End Get
Set(value As ModelListView)
SetPropertyValue("ModelListView", _ModelListView, value)
End Set
End Property
Property HideValueIfZero As Boolean
Get
Return _HideValueIfZero
End Get
Set(value As Boolean)
SetPropertyValue("HideValueIfZero", _HideValueIfZero, value)
End Set
End Property
<Size(-1)> _
Property InLineCriteria As String
Get
Return _InLineCriteria
End Get
Set(value As String)
SetPropertyValue("InLineCriteria", _InLineCriteria, value)
End Set
End Property
Property InLineEdit As Boolean
Get
Return _InLineEdit
End Get
Set(value As Boolean)
SetPropertyValue("InLineEdit", _InLineEdit, value)
End Set
End Property
<Size(255)> _
Property PropertyEditorType As String
Get
Return _PropertyEditorType
End Get
Set(value As String)
SetPropertyValue("PropertyEditorType", _PropertyEditorType, value)
End Set
End Property
Property AllowEdit As Boolean
Get
Return _AllowEdit
End Get
Set(value As Boolean)
SetPropertyValue("AllowEdit", _AllowEdit, value)
End Set
End Property
Property AllowSort As Boolean
Get
Return _AllowSort
End Get
Set(value As Boolean)
SetPropertyValue("AllowSort", _AllowSort, value)
End Set
End Property
Property GroupInterval As DevExpress.ExpressApp.Model.GroupInterval
Get
Return _GroupInterval
End Get
Set(value As DevExpress.ExpressApp.Model.GroupInterval)
SetPropertyValue("GroupInterval", _GroupInterval, value)
End Set
End Property
Property ImmediatePostData As Boolean
Get
Return _ImmediatePostData
End Get
Set(value As Boolean)
SetPropertyValue("ImmediatePostData", _ImmediatePostData, value)
End Set
End Property
Property IsPassword As Boolean
Get
Return _IsPassword
End Get
Set(value As Boolean)
SetPropertyValue("IsPassword", _IsPassword, value)
End Set
End Property
Property LookupEditorMode As DevExpress.Persistent.Base.LookupEditorMode
Get
Return _LookupEditorMode
End Get
Set(value As DevExpress.Persistent.Base.LookupEditorMode)
SetPropertyValue("LookupEditorMode", _LookupEditorMode, value)
End Set
End Property
Property SortOrder As DevExpress.Data.ColumnSortOrder
Get
Return _SortOrder
End Get
Set(value As DevExpress.Data.ColumnSortOrder)
SetPropertyValue("SortOrder", _SortOrder, value)
End Set
End Property
<Size(-1)> _
Property DataSourceCriteria As String
Get
Return _DataSourceCriteria
End Get
Set(value As String)
SetPropertyValue("DataSourceCriteria", _DataSourceCriteria, value)
End Set
End Property
<Size(-1)> _
Property DataSourceProperty As String
Get
Return _DataSourceProperty
End Get
Set(value As String)
SetPropertyValue("DataSourceProperty", _DataSourceProperty, value)
End Set
End Property
<Size(-1)> _
Property DataSourcePropertyIsNullCriteria As String
Get
Return _DataSourcePropertyIsNullCriteria
End Get
Set(value As String)
SetPropertyValue("DataSourcePropertyIsNullCriteria", _DataSourcePropertyIsNullCriteria, value)
End Set
End Property
<Size(255)> _
Property LookupProperty As String
Get
Return _LookupProperty
End Get
Set(value As String)
SetPropertyValue("LookupProperty", _LookupProperty, value)
End Set
End Property
<Size(-1)> _
Property ModelMember As String
Get
Return _ModelMember
End Get
Set(value As String)
SetPropertyValue("ModelMember", _ModelMember, value)
End Set
End Property
<Size(255)> _
Property PropertyName As String
Get
Return _PropertyName
End Get
Set(value As String)
SetPropertyValue("PropertyName", _PropertyName, value)
End Set
End Property
Property DisplayFormat As String
Get
Return _DisplayFormat
End Get
Set(value As String)
SetPropertyValue("DisplayFormat", _DisplayFormat, value)
End Set
End Property
Property EditMask As String
Get
Return _EditMask
End Get
Set(value As String)
SetPropertyValue("EditMask", _EditMask, value)
End Set
End Property
Property GroupIndex As Long
Get
Return _GroupIndex
End Get
Set(value As Long)
SetPropertyValue("GroupIndex", _GroupIndex, value)
End Set
End Property
Property MaxLength As Long
Get
Return _MaxLength
End Get
Set(value As Long)
SetPropertyValue("MaxLength", _MaxLength, value)
End Set
End Property
Property SortIndex As Long
Get
Return _SortIndex
End Get
Set(value As Long)
SetPropertyValue("SortIndex", _SortIndex, value)
End Set
End Property
Property Width As Long
Get
Return _Width
End Get
Set(value As Long)
SetPropertyValue("Width", _Width, value)
End Set
End Property
<Size(255)> _
Property Caption As String
Get
Return _Caption
End Get
Set(value As String)
SetPropertyValue("Caption", _Caption, value)
End Set
End Property
Property GroupFooterSummaryType As DevExpress.Data.SummaryItemType
Get
Return _GroupFooterSummaryType
End Get
Set(value As DevExpress.Data.SummaryItemType)
SetPropertyValue("GroupFooterSummaryType", _GroupFooterSummaryType, value)
End Set
End Property
<Size(255)> _
Property Id As String
Get
Return _Id
End Get
Set(value As String)
SetPropertyValue("Id", _Id, value)
End Set
End Property
Property Index As Long
Get
Return _Index
End Get
Set(value As Long)
SetPropertyValue("Index", _Index, value)
End Set
End Property
End Class
@@ -0,0 +1,64 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports DevExpress.ExpressApp.Security
Public Enum eSQLType
MSSQL = 0
MySQL = 1
PostgreSQL = 2
End Enum
Public Interface ILogonConnection
Property DBConnection() As String
Property SQLServer As String
Property SQLType As eSQLType
Property Company As String
End Interface
<NonPersistent()> _
Public Class ChangeLogon
Inherits AuthenticationStandardLogonParameters
Implements ILogonConnection
Private _DBConnection As String
Private _SQLServer As String
Private _SQLType As eSQLType
Private _Company As String
Public Property DBConnection() As String Implements ILogonConnection.DBConnection
Get
Return _DBConnection
End Get
Set(ByVal value As String)
_DBConnection = value
End Set
End Property
Property SQLServer As String Implements ILogonConnection.SQLServer
Get
Return _SQLServer
End Get
Set(ByVal value As String)
_SQLServer = value
End Set
End Property
Property SQLType As eSQLType Implements ILogonConnection.SQLType
Get
Return _SQLType
End Get
Set(value As eSQLType)
_SQLType = value
End Set
End Property
Property Company As String Implements ILogonConnection.Company
Get
Return _Company
End Get
Set(value As String)
_Company = value
End Set
End Property
End Class
@@ -0,0 +1,262 @@
Imports Microsoft.VisualBasic
Imports DevExpress.Data
Imports System.ComponentModel
Imports DevExpress.ExpressApp.DC
Imports DevExpress.ExpressApp.Model
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.ExpressApp
#Region "INTERFACE"
Public Interface IModelOptionsExtender
<Category("SIS"), DefaultValue(False)> Property RequreMinimumPriceCheck As Boolean
<Category("SIS"), DefaultValue("C:\Users\Public\Documents\")> Property DefaultCustomersFileFolder As String
<Category("SIS"), DefaultValue("C:\Users\Public\Documents\")> Property DefaultproductsFileFolder As String
<Category("SIS")> Property NAVProgramPath As String
<Category("SIS")> Property ExternalBrowserPath As String
<Category("GridPrint"), DefaultValue("{0}"), Localizable(True)> Property HeaderLeft As String
<Category("GridPrint"), DefaultValue("{1}"), Localizable(True)> Property HeaderCenter As String
<Category("GridPrint"), DefaultValue("[Lap # / Összes lap #]"), Localizable(True)> Property HeaderRight As String
<Category("GridPrint"), DefaultValue(""), Localizable(True)> Property FooterLeft As String
<Category("GridPrint"), DefaultValue(""), Localizable(True)> Property FooterCenter As String
<Category("GridPrint"), DefaultValue(""), Localizable(True)> Property FooterRight As String
End Interface
Public Interface IModelListViewExtender
<DefaultValue(True)> Property IsGroupFooterVisible() As Boolean
<CriteriaOptionsAttribute("ModelClass.TypeInfo"), Editor("DevExpress.ExpressApp.Win.Core.ModelEditor.CriteriaModelEditorControl, DevExpress.ExpressApp.Win" & XafApplication.CurrentVersion, GetType(System.Drawing.Design.UITypeEditor))> Property AdditionalCriteria As String
<DefaultValue(False)> Property RequireCriteriaBeforeView As Boolean
<DefaultValue("Filter for the {0} ListView")> Property RequireCriteriaBeforeViewCaption As String
<CriteriaOptionsAttribute("ModelClass.TypeInfo"), Editor("DevExpress.ExpressApp.Win.Core.ModelEditor.CriteriaModelEditorControl, DevExpress.ExpressApp.Win" & XafApplication.CurrentVersion, GetType(System.Drawing.Design.UITypeEditor))> Property RequireCriteriaBeforeViewCriteria As String
<DefaultValue("{0}: [#image]{1} {2}")> Property GridViewGroupFormat As String
<DefaultValue(False), Category("Misc")> Property IsCentralListView As Boolean
<DefaultValue(True), Category("TreeList")> Property TreeListEnableFiltering As Boolean
<Category("DateYearInFilter"), DefaultValue(False)> Property DefaultDateYearInFilter As Boolean 'Az a képesség, hogy ListView esetén van-e automatikusan adott évre filter szűrő
<Category("DateYearInFilter")> Property DefaultDateYearInFilterProperty As String 'Az a képesség, hogy ListView esetén van-e automatikusan adott évre szűrő és melyik a dátum szűrése !
<DefaultValue(True)> Overloads Property IsFooterVisible As Boolean
<DefaultValue("")> Property Hints As String
'// Grid nyomtatáshoz
'// {0} CustomersFrom.FullName alapértelmezettből !
<Category("GridPrint"), DefaultValue(""), Localizable(True)> Property HeaderLeft As String
<Category("GridPrint"), DefaultValue(""), Localizable(True)> Property HeaderCenter As String
<Category("GridPrint"), DefaultValue(""), Localizable(True)> Property HeaderRight As String
<Category("GridPrint"), DefaultValue(""), Localizable(True)> Property FooterLeft As String
<Category("GridPrint"), DefaultValue(""), Localizable(True)> Property FooterCenter As String
<Category("GridPrint"), DefaultValue(""), Localizable(True)> Property FooterRight As String
End Interface
Public Interface IModelDetailViewExtender
<DefaultValue("")> Property Hints As String
End Interface
Public Interface IModelColumnExtender
<DefaultValue(SummaryItemType.None)> _
Property GroupFooterSummaryType() As SummaryItemType
<Category("Appearance"), DefaultValue(False)> _
Property InLineEdit As Boolean
<Category("Appearance"), CriteriaOptionsAttribute("ParentView.ModelClass.TypeInfo"), Editor("DevExpress.ExpressApp.Win.Core.ModelEditor.CriteriaModelEditorControl, DevExpress.ExpressApp.Win" & XafApplication.CurrentVersion, GetType(System.Drawing.Design.UITypeEditor))>
Property InLineCriteria As String
<DefaultValue(False)> _
<Category("Appearance")> _
Property InLineEditAutoCommit As Boolean
<Category("Appearance"), DefaultValue(False)> _
Property HideValueIfZero As Boolean
'// ModelMember.Type -> a mező tipusára vonatkoztatva
'// ParentView.ModelClass.TypeInfo -> a ListView objektumára vonatkoztatva
End Interface
Public Enum DefaultDateYearInCriteriaEnum
CurrentYearOnly = 0
CurrentYearAndPrevYear = 1
NotSet = -1
End Enum
Public Interface IModelClassAllowSort
<Category("Behavior")> Property DefaultListViewAllowSort() As Boolean
<Category("SIS"), DefaultValue(False)> Property NonPersistent As Boolean
<Category("SIS"), DefaultValue(False)> Property IsPopup As Boolean
<Category("SIS")> Property SISGroup1 As String
<Category("SIS")> Property SISGroup2 As String
<Category("SIS"), Editor(GetType(SISBusiness.Module.SISHtmlEditor), GetType(System.Drawing.Design.UITypeEditor))> Property SISDescription As String
<Category("ObjectLocking"), DefaultValue(False)> Property LockObjectBeforeEdit As Boolean '
<Category("ObjectLocking"), Localizable(True)> Property LockObjectBeforeEditErrorString As String
<Category("DateYearInFilter"), DefaultValue(False)> Property DefaultDateYearInFilter As Boolean 'Az a képesség, hogy ListView esetén van-e automatikusan adott évre filter szűrő
<Category("DateYearInFilter")> Property DefaultDateYearInFilterProperty As String 'Az a képesség, hogy ListView esetén van-e automatikusan adott évre szűrő és melyik a dátum szűrése !
End Interface
Public Interface IModelMemberAllowSort
<Category("Behavior")> Property AllowSort() As Boolean
<Category("Format"), DefaultValue(False)> Property AllowRounding() As Boolean
<Category("Format"), DefaultValue(4)> Property RoundingTo() As Long
<Category("Appearance"), DefaultValue(False)> Property HideValueIfZero As Boolean
End Interface
Public Interface IModelListViewAllowSort
<Category("Behavior")> Property AllowSort() As Boolean
<Category("SIS"), DefaultValue(True)> Property IsListViewProcess As Boolean
<Category("SIS"), DefaultValue(False)> Property RowAutoHeight As Boolean
End Interface
Public Interface IModelColumnAllowSort
<Category("Behavior")> Property AllowSort() As Boolean
End Interface
Public Interface IModelActionExtender
<Category("SIS")> Property SISGroup1 As String
<Category("SIS")> Property SISGroup2 As String
<Category("SIS")> Property SISDescription As String
Property FocusItem As String
End Interface
#End Region
#Region "DOMAIN LOGIC"
<DomainLogic(GetType(IModelClassAllowSort))> _
Public NotInheritable Class ModelClassAllowSortLogic
Public Shared Function Get_DefaultListViewAllowSort(ByVal modelClass As IModelClass) As Boolean
If modelClass Is Nothing Then
Return True
End If
If modelClass.TypeInfo Is Nothing Then
Return True
End If
Dim attribute As AllowSortAttribute = modelClass.TypeInfo.FindAttribute(Of AllowSortAttribute)()
If attribute IsNot Nothing Then
Return attribute.AllowSort
Else
Return True
End If
End Function
End Class
<DomainLogic(GetType(IModelMemberAllowSort))> _
Public NotInheritable Class ModelMemberAllowSortLogic
Public Shared Function Get_AllowSort(ByVal modelMember As IModelMember) As Boolean
If modelMember Is Nothing Then
Return True
Else
If modelMember.MemberInfo Is Nothing Then
Return True
End If
Dim attribute As AllowSortAttribute = modelMember.MemberInfo.FindAttribute(Of AllowSortAttribute)()
If attribute IsNot Nothing Then
Return attribute.AllowSort
Else
Return True
End If
End If
End Function
End Class
<DomainLogic(GetType(IModelListViewAllowSort))> _
Public NotInheritable Class ModelListViewAllowSortLogic
Public Shared Function Get_AllowSort(ByVal modelListView As IModelListView) As Boolean
Return (CType(modelListView.ModelClass, IModelClassAllowSort)).DefaultListViewAllowSort
End Function
End Class
<DomainLogic(GetType(IModelColumnAllowSort))> _
Public NotInheritable Class ModelColumnAllowSortLogic
Public Shared Function Get_AllowSort(ByVal modelColumn As IModelColumn) As Boolean
If modelColumn.ModelMember IsNot Nothing Then
Return (CType(modelColumn.ModelMember, IModelMemberAllowSort)).AllowSort
Else
Return True
End If
End Function
End Class
<DomainLogic(GetType(IModelColumnExtender))> _
Public NotInheritable Class IModelColumnExtenderLogic
Public Shared Function Get_HideValueIfZero(ByVal modelColumn As IModelColumn) As Boolean
If modelColumn.ModelMember IsNot Nothing Then
Return (CType(modelColumn.ModelMember, IModelMemberAllowSort)).HideValueIfZero
Else
Return False
End If
End Function
End Class
<DomainLogic(GetType(IModelListViewExtender))> _
Public NotInheritable Class IModelListViewExtenderLogic
Public Shared Function Get_DefaultDateYearInFilter(ByVal modelListView As IModelListView) As Boolean
If modelListView.ModelClass IsNot Nothing Then
Return (CType(modelListView.ModelClass, IModelClassAllowSort)).DefaultDateYearInFilter
Else
Return False
End If
End Function
Public Shared Function Get_DefaultDateYearInFilterProperty(ByVal modelListView As IModelListView) As String
If modelListView.ModelClass IsNot Nothing Then
Return (CType(modelListView.ModelClass, IModelClassAllowSort)).DefaultDateYearInFilterProperty
Else
Return ""
End If
End Function
Public Shared Function Get_HeaderLeft(ByVal modelListView As IModelListView) As String
If modelListView.Application IsNot Nothing Then
If modelListView.Application.Options IsNot Nothing Then
Return TryCast(modelListView.Application.Options, IModelOptionsExtender).HeaderLeft
Else
Return ""
End If
Else
Return ""
End If
End Function
Public Shared Function Get_HeaderCenter(ByVal modelListView As IModelListView) As String
If modelListView.Application IsNot Nothing Then
If modelListView.Application.Options IsNot Nothing Then
Return TryCast(modelListView.Application.Options, IModelOptionsExtender).HeaderCenter
Else
Return ""
End If
Else
Return ""
End If
End Function
Public Shared Function Get_HeaderRight(ByVal modelListView As IModelListView) As String
If modelListView.Application IsNot Nothing Then
If modelListView.Application.Options IsNot Nothing Then
Return TryCast(modelListView.Application.Options, IModelOptionsExtender).HeaderRight
Else
Return ""
End If
Else
Return ""
End If
End Function
Public Shared Function Get_FooterLeft(ByVal modelListView As IModelListView) As String
If modelListView.Application IsNot Nothing Then
If modelListView.Application.Options IsNot Nothing Then
Return TryCast(modelListView.Application.Options, IModelOptionsExtender).FooterLeft
Else
Return ""
End If
Else
Return ""
End If
End Function
Public Shared Function Get_FooterCenter(ByVal modelListView As IModelListView) As String
If modelListView.Application IsNot Nothing Then
If modelListView.Application.Options IsNot Nothing Then
Return TryCast(modelListView.Application.Options, IModelOptionsExtender).FooterCenter
Else
Return ""
End If
Else
Return ""
End If
End Function
Public Shared Function Get_FooterRight(ByVal modelListView As IModelListView) As String
If modelListView.Application IsNot Nothing Then
If modelListView.Application.Options IsNot Nothing Then
Return TryCast(modelListView.Application.Options, IModelOptionsExtender).FooterRight
Else
Return ""
End If
Else
Return ""
End If
End Function
End Class
#End Region
@@ -0,0 +1,43 @@
' Developer Express Code Central Example:
' How to populate a List View with data from a LINQ query
'
' See the http://www.devexpress.com/scid=K18107 KB Article for more information.
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E859
' Developer Express Code Central Example:
' How to populate the list view with data from a LINQ query
'
' See the http://www.devexpress.com/scid=K18107 KB Article for more information.
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E859
Imports Microsoft.VisualBasic
Imports System
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.SystemModule
Namespace Dennis.Linq
Public Class DisableActionsLinqListViewController
Inherits ViewController
Private Const DefaultReason As String = "LinqListViewController is active"
Protected Overloads Overrides Sub OnActivated()
MyBase.OnActivated()
Dim flag As Boolean = Not View.Id.EndsWith(LinqCollectionSource.DefaultSuffix)
Frame.GetController(Of ListViewProcessCurrentObjectController)().Active(DefaultReason) = flag
Frame.GetController(Of DeleteObjectsViewController)().Active(DefaultReason) = flag
Frame.GetController(Of NewObjectViewController)().Active(DefaultReason) = flag
Frame.GetController(Of FilterController)().Active(DefaultReason) = flag
End Sub
Protected Overloads Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
Frame.GetController(Of ListViewProcessCurrentObjectController)().Active.RemoveItem(DefaultReason)
Frame.GetController(Of DeleteObjectsViewController)().Active.RemoveItem(DefaultReason)
Frame.GetController(Of NewObjectViewController)().Active.RemoveItem(DefaultReason)
Frame.GetController(Of FilterController)().Active.RemoveItem(DefaultReason)
End Sub
End Class
End Namespace
@@ -0,0 +1,5 @@
Imports DevExpress.ExpressApp.Model
Public Interface IModelListViewLinq
Inherits IModelNode
Property XPQueryMethod() As String
End Interface
@@ -0,0 +1,77 @@
' Developer Express Code Central Example:
' How to populate a List View with data from a LINQ query
'
' See the http://www.devexpress.com/scid=K18107 KB Article for more information.
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E859
' Developer Express Code Central Example:
' How to populate the list view with data from a LINQ query
'
' See the http://www.devexpress.com/scid=K18107 KB Article for more information.
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E859
Imports Microsoft.VisualBasic
Imports System
Imports System.Linq
Imports DevExpress.Xpo
Imports System.Collections
Imports System.ComponentModel
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.DC
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp.Xpo
Namespace Dennis.Linq
Public Class LinqCollectionSource
Inherits CollectionSourceBase
Public Const DefaultSuffix As String = "_Linq"
Private collectionCore As IBindingList
Private objectTypeInfoCore As ITypeInfo
Public Function ConvertQueryToCollection(ByVal sourceQuery As IQueryable) As IList
collectionCore = New BindingList(Of Object)()
For Each item In sourceQuery
collectionCore.Add(item)
Next item
Return collectionCore
End Function
Private queryCore As IQueryable = Nothing
Protected Sub New(ByVal objectSpace As IObjectSpace, ByVal mode As CollectionSourceMode)
MyBase.New(objectSpace, mode)
End Sub
Protected Sub New(ByVal objectSpace As IObjectSpace)
MyBase.New(objectSpace)
End Sub
Public Sub New(ByVal objectSpace As IObjectSpace, ByVal objectType As Type, ByVal query As IQueryable)
MyBase.New(objectSpace)
objectTypeInfoCore = XafTypesInfo.Instance.FindTypeInfo(objectType)
queryCore = query
End Sub
Public Property Query() As IQueryable
Get
Return queryCore
End Get
Set(ByVal value As IQueryable)
queryCore = value
End Set
End Property
Protected Overrides Function CreateCollection() As Object
CType(Query, XPQueryBase).Session = TryCast(ObjectSpace, XPObjectSpace).Session
Return ConvertQueryToCollection(Query)
End Function
Public Overrides Function IsObjectFitForCollection(ByVal obj As Object) As Boolean?
Return collectionCore.Contains(obj)
End Function
Protected Overrides Sub ApplyCriteriaCore(ByVal criteria As CriteriaOperator)
End Sub
Public Overrides ReadOnly Property ObjectTypeInfo() As ITypeInfo
Get
Return objectTypeInfoCore
End Get
End Property
End Class
End Namespace
@@ -0,0 +1,109 @@
' Developer Express Code Central Example:
' How to populate a List View with data from a LINQ query
'
' See the http://www.devexpress.com/scid=K18107 KB Article for more information.
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E859
' Developer Express Code Central Example:
' How to populate the list view with data from a LINQ query
'
' See the http://www.devexpress.com/scid=K18107 KB Article for more information.
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E859
Imports Microsoft.VisualBasic
Imports System
Imports System.Linq
Imports DevExpress.Xpo
Imports System.Reflection
Imports DevExpress.ExpressApp
Imports System.Collections.Generic
Imports SISBusiness.Module.Dennis.Linq
Public NotInheritable Class LinqCollectionSourceHelper
Private Sub New()
End Sub
Public Shared Sub CreateCustomCollectionSource(ByVal sender As Object, ByVal e As CreateCustomCollectionSourceEventArgs)
Dim listViewInfo As IModelListViewLinq = TryCast((CType(sender, XafApplication)).FindModelView(e.ListViewID), IModelListViewLinq)
If listViewInfo Is Nothing Then
Return
End If
If String.IsNullOrEmpty(listViewInfo.XPQueryMethod) Then
Return
End If
Dim query As IQueryable = LinqCollectionSourceHelper.InvokeMethod(e.ObjectType, listViewInfo.XPQueryMethod, (CType(e.ObjectSpace, Xpo.XPObjectSpace)).Session)
If query Is Nothing Then
Return
End If
e.CollectionSource = New LinqCollectionSource(e.ObjectSpace, e.ObjectType, query)
End Sub
Public Shared Function GetXPQueryMethods(ByVal type As Type) As String()
Dim names As New List(Of String)()
Dim methods() As MethodInfo = type.GetMethods(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static)
For Each mi As MethodInfo In methods
If IsCompatibleMethod(mi) Then
names.Add(mi.Name)
End If
Next mi
Return names.ToArray()
End Function
Public Shared Function IsCompatibleMethod(ByVal mi As MethodInfo) As Boolean
Dim pis() As ParameterInfo = mi.GetParameters()
Return mi.ReturnType IsNot Nothing AndAlso GetType(IQueryable).IsAssignableFrom(mi.ReturnType) AndAlso pis.Length = 1 AndAlso pis(0).ParameterType.IsAssignableFrom(GetType(Session))
End Function
Public Shared Function InvokeMethod(ByVal type As Type, ByVal name As String, ByVal session As Session) As IQueryable
Dim method As MethodInfo = FindMethod(type, name)
If method Is Nothing Then
Return Nothing
End If
Return CType(method.Invoke(Nothing, New Object() {session}), IQueryable)
End Function
Private Shared Function FindMethod(ByVal type As Type, ByVal name As String) As MethodInfo
Dim methods() As MethodInfo = type.GetMethods(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static)
For Each mi As MethodInfo In methods
If mi.Name = name AndAlso IsCompatibleMethod(mi) Then
Return mi
End If
Next mi
Return Nothing
End Function
Public Shared Function GetDisplayableProperties(ByVal type As Type, ByVal name As String) As String()
Dim method As MethodInfo = FindMethod(type, name)
If method Is Nothing Then
Return Nothing
End If
For Each attribute As CustomQueryPropertiesAttribute In method.GetCustomAttributes(GetType(CustomQueryPropertiesAttribute), False)
If attribute.Name = "DisplayableProperties" Then
Return attribute.Value.Split(";"c)
End If
Next attribute
Return Nothing
End Function
End Class
<AttributeUsage(AttributeTargets.Method)> _
Public NotInheritable Class CustomQueryPropertiesAttribute
Inherits Attribute
Private theName As String
Private theValue As String
Public ReadOnly Property Name() As String
Get
Return theName
End Get
End Property
Public ReadOnly Property Value() As String
Get
Return theValue
End Get
End Property
Public Sub New(ByVal theName As String, ByVal theValue As String)
Me.theName = theName
Me.theValue = theValue
End Sub
End Class
@@ -0,0 +1,34 @@
Imports DevExpress.ExpressApp.Model
Imports DevExpress.ExpressApp.Model.Core
Imports DevExpress.ExpressApp.Model.NodeGenerators
Public Class ModelListViewLinqColumnsNodesGeneratorUpdater
Inherits ModelNodesGeneratorUpdater(Of ModelListViewColumnsNodesGenerator)
Public Overrides Sub UpdateNode(ByVal node As ModelNode)
Dim linqViewInfo As IModelListViewLinq = TryCast(node.Parent, IModelListViewLinq)
If linqViewInfo IsNot Nothing AndAlso (Not String.IsNullOrEmpty(linqViewInfo.XPQueryMethod)) Then
Dim listViewInfo As IModelListView = CType(linqViewInfo, IModelListView)
Dim columns() As String = LinqCollectionSourceHelper.GetDisplayableProperties(listViewInfo.ModelClass.TypeInfo.Type, linqViewInfo.XPQueryMethod)
If columns IsNot Nothing Then
If listViewInfo.Columns Is Nothing Then
listViewInfo.AddNode(Of IModelColumns)("Columns")
End If
Dim i As Integer = listViewInfo.Columns.Count
Do While i > 0
i -= 1
Dim col As IModelColumn = listViewInfo.Columns.Item(i)
If Array.IndexOf(columns, col.Id) < 0 Then
'listViewInfo.Columns.Remove(col)
End If
Loop
For Each column As String In columns
Dim col As IModelColumn = listViewInfo.Columns.GetNode(column)
If col Is Nothing Then
col = listViewInfo.Columns.AddNode(Of IModelColumn)(column)
col.PropertyName = column
End If
Next column
End If
End If
End Sub
End Class
@@ -0,0 +1,27 @@
Imports DevExpress.ExpressApp.Model
Imports DevExpress.ExpressApp.Model.Core
Imports DevExpress.ExpressApp.Model.NodeGenerators
Imports SISBusiness.Module.Dennis.Linq
Public Class ModelListViewLinqNodesGeneratorUpdater
Inherits ModelNodesGeneratorUpdater(Of ModelViewsNodesGenerator)
Public Overrides Sub UpdateNode(ByVal node As ModelNode)
For Each classInfo As IModelClass In node.Application.BOModel
If classInfo.TypeInfo.IsPersistent Then
If (Not String.IsNullOrEmpty(classInfo.Name)) Then
For Each method As String In LinqCollectionSourceHelper.GetXPQueryMethods(classInfo.TypeInfo.Type)
Dim id As String = String.Format("{0}_{1}{2}", ModelListViewNodesGenerator.GetListViewId(classInfo.TypeInfo.Type), method, LinqCollectionSource.DefaultSuffix)
Dim listViewInfo As IModelListView = node.Application.Views.GetNode(id)
If listViewInfo Is Nothing Then
listViewInfo = node.AddNode(Of IModelListView)(id)
End If
listViewInfo.ModelClass = classInfo
If TryCast(listViewInfo, IModelListViewLinq) IsNot Nothing Then
CType(listViewInfo, IModelListViewLinq).XPQueryMethod = method
End If
Next method
End If
End If
Next classInfo
End Sub
End Class
@@ -0,0 +1,32 @@
Partial Class ListViewProcess
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,37 @@
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.SystemModule
Public Class ListViewProcess
Inherits DevExpress.ExpressApp.ViewController(Of ListView)
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 CType(View.Model, IModelListViewAllowSort).IsListViewProcess Then
Else
Frame.GetController(Of ListViewProcessCurrentObjectController).Active.SetItemValue("", False)
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If CType(View.Model, IModelListViewAllowSort).IsListViewProcess Then
Else
Frame.GetController(Of ListViewProcessCurrentObjectController).Active.SetItemValue("", True)
End If
End Sub
End Class
@@ -0,0 +1,32 @@
Partial Class HRPerson_LookupListView
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,34 @@
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
Public Class HRPerson_LookupListView
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
If View.Id = "HRPerson_LookupListView" Then
Dim _HRPerson_LookupListView As ListView = TryCast(View, ListView)
Dim _HRPerson_LookupListView_CollectionSourece As CollectionSource = _HRPerson_LookupListView.CollectionSource
_HRPerson_LookupListView_CollectionSourece.BeginUpdateCriteria()
_HRPerson_LookupListView_CollectionSourece.Criteria.Clear()
_HRPerson_LookupListView_CollectionSourece.Criteria.Add("ActiveHRPerson", DevExpress.Data.Filtering.CriteriaOperator.Parse("User.IsActive=True"))
_HRPerson_LookupListView_CollectionSourece.EndUpdateCriteria()
End If
End Sub
End Class
@@ -0,0 +1,93 @@
' Developer Express Code Central Example:
' How to show filter dialog before showing ListView
'
' When the ListView contains a large amount of data, it is useful to provide a
' capability for the end-user to set a filter for this View before loading it. To
' accomplish this task, I've performed the following actions in this example:
' 1.
' Extended the Application Model with the AdditionalCriteria attribute for the
' ListView node via the WinSampleModule.GetSchema overridden method. This
' attribute should store the filter, selected by the user.
' 2. Implemented the
' ViewFilterContainer class, whose DetailView is used as a filter dialog.
' 3.
' Implemented the ViewFilterObject class, which is used to store filters.
' 4.
' Implemented a ShowFilterDialogController, which shows the DetailView of the
' ViewFilterContainer object before showing ListView, and then shows the filtered
' ListView.
' 5. Implemented the ViewFilterContainerModificationsController, which
' sets the ObjectType property of the ViewFilterObject class, created by the
' lookup's New action.
'
' See Also:
' How to: Use Criteria Property Editors
' (ms-help://DevExpress.Xaf/CustomDocument3014.htm)
' How to: Extend the
' Application Model and Schema
' (ms-help://DevExpress.Xaf/CustomDocument2785.htm)
' ShowNavigationItemController
' Class
' (ms-help://DevExpress.Xaf/clsDevExpressExpressAppSystemModuleShowNavigationItemControllertopic.htm)
' Dialog
' Controller
' (ms-help://DevExpress.Xaf/clsDevExpressExpressAppSystemModuleDialogControllertopic.htm)
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E1554
Imports Microsoft.VisualBasic
Imports System
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Xpo
Imports DevExpress.ExpressApp.Editors
Imports System.ComponentModel
Imports DevExpress.Persistent.Base
Imports DevExpress.ExpressApp
Imports DevExpress.Data.Filtering
<NonPersistent()> _
Public Class ViewFilterContainer
Inherits BaseObject
Private _Criteria As String
Private _ObjectType As Type
Private _ViewID As String
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
<CriteriaOptionsAttribute("ObjectType"), ImmediatePostData()> _
Public Property Criteria() As String
Get
Return _Criteria
End Get
Set(ByVal value As String)
SetPropertyValue("Criteria", _Criteria, value)
End Set
End Property
<MemberDesignTimeVisibility(False)> _
Public Property ObjectType() As Type
Get
Return _ObjectType
End Get
Set(ByVal value As Type)
SetPropertyValue("ObjectType", _ObjectType, value)
End Set
End Property
<MemberDesignTimeVisibility(False)> _
Property ViewID As String
Get
Return _ViewID
End Get
Set(value As String)
SetPropertyValue("ViewID", _ViewID, value)
End Set
End Property
ReadOnly Property ViewFilterContainerSaved As XPCollection(Of ViewFilterContainerSaved)
Get
Return New XPCollection(Of ViewFilterContainerSaved)(Session, CriteriaOperator.Parse("ViewID=?", Me.ViewID))
End Get
End Property
End Class
@@ -0,0 +1,97 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False)> _
Public Class ViewFilterContainerSaved
Inherits BaseObject
Private _ViewID As String
Private _ShortName As String
Private _Criteria As String
Private _IsPublic As Boolean = True
Private _ObjectCreated As DateTime
Private _UserCreated As User
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
End Sub
Protected Overrides Sub OnSaving()
MyBase.OnSaving()
If Session.IsNewObject(Me) Then
ObjectCreated = GetSQLTime(Session)
UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
End If
End Sub
<Size(255), Browsable(False)> _
Property ViewID As String
Get
Return _ViewID
End Get
Set(value As String)
SetPropertyValue("ViewID", _ViewID, value)
End Set
End Property
<Size(255)> _
<RuleRequiredField("ViewFilterContainerSaved-ShortName", DefaultContexts.Save)> _
Property ShortName As String
Get
Return _ShortName
End Get
Set(value As String)
SetPropertyValue("ShortName", _ShortName, value)
End Set
End Property
<Size(-1)> _
Property Criteria As String
Get
Return _Criteria
End Get
Set(value As String)
SetPropertyValue("Criteria", _Criteria, value)
End Set
End Property
Property IsPublic As Boolean
Get
Return _IsPublic
End Get
Set(value As Boolean)
SetPropertyValue("IsPublic", _IsPublic, value)
End Set
End Property
<NonCloneable()> _
Property ObjectCreated As Date
Get
Return _ObjectCreated
End Get
Set(value As Date)
SetPropertyValue("ObjectCreated", _ObjectCreated, value)
End Set
End Property
<NonCloneable()> _
Property UserCreated As User
Get
Return _UserCreated
End Get
Set(value As User)
SetPropertyValue("UserCreated", _UserCreated, value)
End Set
End Property
End Class
@@ -0,0 +1,112 @@
Partial Class ViewFilterContainerVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.aResetRequireCriteriaBeforeView = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aFindRecords = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aLoadCriteria = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aSaveCriteria = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
Me.aDeleteCriteria = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aInitCriteria = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
'
'aResetRequireCriteriaBeforeView
'
Me.aResetRequireCriteriaBeforeView.Caption = "aReset Require Criteria Before View"
Me.aResetRequireCriteriaBeforeView.Category = "aResetRequireCriteriaBeforeView"
Me.aResetRequireCriteriaBeforeView.ConfirmationMessage = Nothing
Me.aResetRequireCriteriaBeforeView.Id = "aResetRequireCriteriaBeforeView"
Me.aResetRequireCriteriaBeforeView.TargetObjectType = GetType(SISBusiness.[Module].ViewFilterContainer)
Me.aResetRequireCriteriaBeforeView.TargetViewType = DevExpress.ExpressApp.ViewType.DetailView
Me.aResetRequireCriteriaBeforeView.ToolTip = Nothing
Me.aResetRequireCriteriaBeforeView.TypeOfView = GetType(DevExpress.ExpressApp.DetailView)
'
'aFindRecords
'
Me.aFindRecords.ActionMeaning = DevExpress.ExpressApp.Actions.ActionMeaning.Accept
Me.aFindRecords.Caption = "aFind Records"
Me.aFindRecords.Category = "aFindRecords"
Me.aFindRecords.ConfirmationMessage = Nothing
Me.aFindRecords.Id = "aFindRecords"
Me.aFindRecords.TargetObjectType = GetType(SISBusiness.[Module].ViewFilterContainer)
Me.aFindRecords.TargetViewType = DevExpress.ExpressApp.ViewType.DetailView
Me.aFindRecords.ToolTip = Nothing
Me.aFindRecords.TypeOfView = GetType(DevExpress.ExpressApp.DetailView)
'
'aLoadCriteria
'
Me.aLoadCriteria.ActionMeaning = DevExpress.ExpressApp.Actions.ActionMeaning.Accept
Me.aLoadCriteria.Caption = "aLoad Criteria"
Me.aLoadCriteria.Category = "aLoadCriteria"
Me.aLoadCriteria.ConfirmationMessage = Nothing
Me.aLoadCriteria.Id = "aLoadCriteria"
Me.aLoadCriteria.TargetObjectType = GetType(SISBusiness.[Module].ViewFilterContainer)
Me.aLoadCriteria.TargetViewType = DevExpress.ExpressApp.ViewType.DetailView
Me.aLoadCriteria.ToolTip = Nothing
Me.aLoadCriteria.TypeOfView = GetType(DevExpress.ExpressApp.DetailView)
'
'aSaveCriteria
'
Me.aSaveCriteria.AcceptButtonCaption = Nothing
Me.aSaveCriteria.CancelButtonCaption = Nothing
Me.aSaveCriteria.Caption = "aSave Criteria"
Me.aSaveCriteria.Category = "aSaveCriteria"
Me.aSaveCriteria.ConfirmationMessage = Nothing
Me.aSaveCriteria.Id = "aSaveCriteria"
Me.aSaveCriteria.TargetObjectType = GetType(SISBusiness.[Module].ViewFilterContainer)
Me.aSaveCriteria.TargetViewType = DevExpress.ExpressApp.ViewType.DetailView
Me.aSaveCriteria.ToolTip = Nothing
Me.aSaveCriteria.TypeOfView = GetType(DevExpress.ExpressApp.DetailView)
'
'aDeleteCriteria
'
Me.aDeleteCriteria.Caption = "aDelete Criteria"
Me.aDeleteCriteria.Category = "ObjectsCreation"
Me.aDeleteCriteria.ConfirmationMessage = Nothing
Me.aDeleteCriteria.Id = "aDeleteCriteria"
Me.aDeleteCriteria.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
Me.aDeleteCriteria.TargetObjectType = GetType(SISBusiness.[Module].ViewFilterContainerSaved)
Me.aDeleteCriteria.ToolTip = Nothing
'
'aInitCriteria
'
Me.aInitCriteria.Caption = "aInit Criteria"
Me.aInitCriteria.ConfirmationMessage = Nothing
Me.aInitCriteria.Id = "aInitCriteria"
Me.aInitCriteria.TargetViewType = DevExpress.ExpressApp.ViewType.ListView
Me.aInitCriteria.ToolTip = Nothing
Me.aInitCriteria.TypeOfView = GetType(DevExpress.ExpressApp.ListView)
End Sub
Friend WithEvents aResetRequireCriteriaBeforeView As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aFindRecords As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aLoadCriteria As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aSaveCriteria As DevExpress.ExpressApp.Actions.PopupWindowShowAction
Friend WithEvents aDeleteCriteria As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aInitCriteria As DevExpress.ExpressApp.Actions.SimpleAction
End Class
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="aResetRequireCriteriaBeforeView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="aFindRecords.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 134</value>
</metadata>
<metadata name="aLoadCriteria.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 212</value>
</metadata>
<metadata name="aSaveCriteria.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 95</value>
</metadata>
<metadata name="aDeleteCriteria.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 173</value>
</metadata>
<metadata name="aInitCriteria.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>141, 173</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,182 @@
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.SystemModule
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.ExpressApp.Model
Public Class ViewFilterContainerVC
Inherits DevExpress.ExpressApp.ViewController
Private dialogCotnroller As DialogController
Private oldListView As View
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 = "ViewFilterContainer_DetailView" Then
If Frame.GetController(Of DialogController)() IsNot Nothing Then
Frame.GetController(Of DialogController).AcceptAction.Active.SetItemValue("", False)
Frame.GetController(Of DialogController).CancelAction.Active.SetItemValue("", False)
End If
If Frame.GetController(Of RefreshController)() IsNot Nothing Then
Frame.GetController(Of RefreshController).Active.SetItemValue("", False)
End If
Frame.GetController(Of ModificationsController).Active.SetItemValue("", False)
'Frame.GetController(Of RecordsNavigationController).Active.SetItemValue("", False)
End If
Frame.GetController(Of ViewFilterContainerVC).aInitCriteria.Active.SetItemValue("", False)
If TryCast(View, ListView) IsNot Nothing Then
Dim _IModelListViewExtender As IModelListViewExtender = TryCast(View.Model, IModelListViewExtender)
If _IModelListViewExtender IsNot Nothing Then
If _IModelListViewExtender.RequireCriteriaBeforeView Then
_IModelListViewExtender.DefaultDateYearInFilter = False
TryCast(View.Model, IModelListView).DataAccessMode = CollectionSourceDataAccessMode.Client
View.SaveModel()
Frame.GetController(Of ViewFilterContainerVC).aInitCriteria.Active.SetItemValue("", True)
End If
End If
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "ViewFilterContainer_DetailView" Then
If Frame.GetController(Of DialogController)() IsNot Nothing Then
Frame.GetController(Of DialogController).AcceptAction.Active.SetItemValue("", True)
Frame.GetController(Of DialogController).CancelAction.Active.SetItemValue("", True)
End If
If Frame.GetController(Of RefreshController)() IsNot Nothing Then
Frame.GetController(Of RefreshController).Active.SetItemValue("", True)
End If
Frame.GetController(Of ModificationsController).Active.SetItemValue("", True)
'Frame.GetController(Of RecordsNavigationController).Active.SetItemValue("", True)
End If
End Sub
Private Sub aResetRequireCriteriaBeforeView_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aResetRequireCriteriaBeforeView.Execute
Dim _ViewFilterContainer As ViewFilterContainer = TryCast(View.SelectedObjects(0), ViewFilterContainer)
Dim _IModelListViewExtender As IModelListViewExtender = TryCast(View.Model, IModelListViewExtender)
For Each _View In Application.Model.Views
If _View.Id = _ViewFilterContainer.ViewID Then
If TryCast(_View, IModelListViewExtender) IsNot Nothing Then
_ViewFilterContainer.Criteria = TryCast(_View, IModelListViewExtender).RequireCriteriaBeforeViewCriteria
End If
Exit For
End If
Next
End Sub
Private Sub aFindRecords_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aFindRecords.Execute
If Frame.GetController(Of DialogController)() IsNot Nothing Then
Frame.GetController(Of DialogController).AcceptAction.Active.SetItemValue("", True)
Frame.GetController(Of DialogController).AcceptAction.DoExecute()
Else
AcceptAction_Execute(sender, e)
End If
End Sub
Private Sub aSaveCriteria_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aSaveCriteria.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _ViewFilterContainerSaved As ViewFilterContainerSaved = _onew.CreateObject(Of ViewFilterContainerSaved)()
e.View = Application.CreateDetailView(_onew, "ViewFilterContainerSaved_DetailView", False, _ViewFilterContainerSaved)
End Sub
Private Sub aSaveCriteria_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aSaveCriteria.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _ViewFilterContainer As ViewFilterContainer = TryCast(View.SelectedObjects(0), ViewFilterContainer)
Dim _ViewFilterContainerSaved_Popup As ViewFilterContainerSaved = TryCast(e.PopupWindow.View.SelectedObjects(0), ViewFilterContainerSaved)
Dim _ViewFilterContainerSaved As ViewFilterContainerSaved = _ocur.CreateObject(Of ViewFilterContainerSaved)()
_ViewFilterContainerSaved.ViewID = _ViewFilterContainer.ViewID
_ViewFilterContainerSaved.ShortName = _ViewFilterContainerSaved_Popup.ShortName
_ViewFilterContainerSaved.IsPublic = _ViewFilterContainerSaved_Popup.IsPublic
_ViewFilterContainerSaved.Criteria = _ViewFilterContainer.Criteria
_ocur.CommitChanges()
View.Refresh()
End Sub
Private Sub aLoadCriteria_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aLoadCriteria.Execute
Dim _ViewFilterContainer As ViewFilterContainer = TryCast(View.SelectedObjects(0), ViewFilterContainer)
Dim _ListView As ListPropertyEditor = TryCast(View, DetailView).FindItem("ViewFilterContainerSaved")
If _ListView.ListView.SelectedObjects.Count > 0 Then
_ViewFilterContainer.Criteria = TryCast(_ListView.ListView.SelectedObjects(0), ViewFilterContainerSaved).Criteria
End If
End Sub
Private Sub aDeleteCriteria_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aDeleteCriteria.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _ViewFilterContainerSaved As ViewFilterContainerSaved = TryCast(View.SelectedObjects(0), ViewFilterContainerSaved)
For Each _ViewFilterContainerSaved In View.SelectedObjects
_ocur.Delete(_ViewFilterContainerSaved)
Next
_ocur.CommitChanges()
End Sub
Private Sub aInitCriteria_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aInitCriteria.Execute
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
oldListView = View
Dim newViewFilterContainer As ViewFilterContainer = _onew.CreateObject(Of ViewFilterContainer)()
Dim showViewParameters As ShowViewParameters = e.ShowViewParameters
newViewFilterContainer.ObjectType = oldListView.ObjectTypeInfo.Type
newViewFilterContainer.ViewID = oldListView.Id
newViewFilterContainer.Criteria = CType(oldListView.Model, IModelListViewExtender).AdditionalCriteria
showViewParameters.CreatedView = Application.CreateDetailView(_onew, newViewFilterContainer)
showViewParameters.CreatedView.Caption = String.Format((CType(oldListView.Model, IModelListViewExtender)).RequireCriteriaBeforeViewCaption, oldListView.Caption)
showViewParameters.TargetWindow = TargetWindow.Current
dialogCotnroller = Application.CreateController(Of DialogController)()
AddHandler dialogCotnroller.AcceptAction.Execute, AddressOf AcceptAction_Execute
showViewParameters.Controllers.Add(dialogCotnroller)
End Sub
Private Sub AcceptAction_Execute(sender As Object, e As SimpleActionExecuteEventArgs)
Try
Dim currentViewFilterContainer As ViewFilterContainer = CType(e.CurrentObject, ViewFilterContainer)
Dim _CollectionSource As CollectionSource
Dim _IModelListView As IModelListView
Dim _ModelClass As IModelClass
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
_IModelListView = TryCast(oldListView.Model, IModelListView)
_ModelClass = TryCast(_IModelListView.ModelClass, IModelClass)
_CollectionSource = New CollectionSource(_onew, _ModelClass.TypeInfo.Type)
_CollectionSource.BeginUpdateCriteria()
_CollectionSource.Criteria("ByViewFilterObject") = CriteriaEditorHelper.GetCriteriaOperator(currentViewFilterContainer.Criteria, currentViewFilterContainer.ObjectType, _onew)
_CollectionSource.EndUpdateCriteria()
CType(oldListView.Model, IModelListViewExtender).AdditionalCriteria = currentViewFilterContainer.Criteria
e.ShowViewParameters.CreatedView = Application.CreateListView(oldListView.Id, _CollectionSource, False)
e.ShowViewParameters.TargetWindow = TargetWindow.Current
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Hiba")
End Try
End Sub
End Class
@@ -0,0 +1,111 @@
' Developer Express Code Central Example:
' How to show filter dialog before showing ListView
'
' When the ListView contains a large amount of data, it is useful to provide a
' capability for the end-user to set a filter for this View before loading it. To
' accomplish this task, I've performed the following actions in this example:
' 1.
' Extended the Application Model with the AdditionalCriteria attribute for the
' ListView node via the WinSampleModule.GetSchema overridden method. This
' attribute should store the filter, selected by the user.
' 2. Implemented the
' ViewFilterContainer class, whose DetailView is used as a filter dialog.
' 3.
' Implemented the ViewFilterObject class, which is used to store filters.
' 4.
' Implemented a ShowFilterDialogController, which shows the DetailView of the
' ViewFilterContainer object before showing ListView, and then shows the filtered
' ListView.
' 5. Implemented the ViewFilterContainerModificationsController, which
' sets the ObjectType property of the ViewFilterObject class, created by the
' lookup's New action.
'
' See Also:
' How to: Use Criteria Property Editors
' (ms-help://DevExpress.Xaf/CustomDocument3014.htm)
' How to: Extend the
' Application Model and Schema
' (ms-help://DevExpress.Xaf/CustomDocument2785.htm)
' ShowNavigationItemController
' Class
' (ms-help://DevExpress.Xaf/clsDevExpressExpressAppSystemModuleShowNavigationItemControllertopic.htm)
' Dialog
' Controller
' (ms-help://DevExpress.Xaf/clsDevExpressExpressAppSystemModuleDialogControllertopic.htm)
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E1554
Imports Microsoft.VisualBasic
Imports System
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Xpo
Imports DevExpress.ExpressApp.Editors
Imports System.ComponentModel
Imports DevExpress.Persistent.Base
Imports DevExpress.ExpressApp
Imports DevExpress.Data.Filtering
<DefaultProperty("FilterName")> _
Public Class ViewFilterObject
Inherits BaseObject
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Private _ObjectTypeName As String
<MemberDesignTimeVisibility(False)> _
Public Property ObjectTypeName() As String
Get
Return _ObjectTypeName
End Get
Set(ByVal value As String)
SetPropertyValue(Of String)("ObjectTypeName", _ObjectTypeName, value)
End Set
End Property
<NonPersistent(), MemberDesignTimeVisibility(False)> _
Public Property ObjectType() As Type
Get
If ObjectTypeName IsNot Nothing Then
Return XafTypesInfo.Instance.FindTypeInfo(ObjectTypeName).Type
Else
Return Nothing
End If
End Get
Set(ByVal value As Type)
Dim stringValue As String
If value Is Nothing Then
stringValue = Nothing
Else
stringValue = value.FullName
End If
Dim savedObjectTypeName As String = ObjectTypeName
Try
If stringValue <> ObjectTypeName Then
ObjectTypeName = stringValue
End If
Catch e1 As Exception
ObjectTypeName = savedObjectTypeName
End Try
Criteria = String.Empty
End Set
End Property
Private _Criteria As String
<CriteriaOptionsAttribute("ObjectType")> _
Public Property Criteria() As String
Get
Return _Criteria
End Get
Set(ByVal value As String)
SetPropertyValue("Criteria", _Criteria, value)
End Set
End Property
Private _FilterName As String
Public Property FilterName() As String
Get
Return _FilterName
End Get
Set(ByVal value As String)
SetPropertyValue("FilterName", _FilterName, value)
End Set
End Property
End Class
@@ -0,0 +1,32 @@
Partial Class LockObjectBeforeeditVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,90 @@
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.Model
Imports DevExpress.ExpressApp.SystemModule
Imports DevExpress.Xpo
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Data.Filtering
Public Class LockObjectBeforeeditVC
Inherits DevExpress.ExpressApp.ViewController
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 TryCast(View, ListView) IsNot Nothing Then
Dim _ListView As ListView = TryCast(View, ListView)
Dim _IModelClass As IModelClass
_IModelClass = _ListView.Model.ModelClass
If TryCast(_IModelClass, IModelClassAllowSort).LockObjectBeforeEdit = True Then
AddHandler Frame.GetController(Of ListViewProcessCurrentObjectController).CustomProcessSelectedItem, AddressOf ListView_CustomProcessSelectedItem
End If
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If TryCast(View, DetailView) IsNot Nothing Then
'// DetailView után a lock felszabadítása !
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _uow_lock As New UnitOfWork(_onew.Session.DataLayer)
Dim _User As User = _onew.GetObject(TryCast(SecuritySystem.CurrentUser, User))
Dim _IModelClass As IModelClass = TryCast(View, DetailView).Model.ModelClass
If TryCast(_IModelClass, IModelClassAllowSort).LockObjectBeforeEdit = True Then
If View.SelectedObjects.Count > 0 Then
Dim _ActBusinessObject As Object = TryCast(View.SelectedObjects(0), Object)
LockingModule.UnLockObject(_uow_lock, _IModelClass.TypeInfo.Type, _ActBusinessObject.Oid.ToString, _User)
End If
End If
End If
If TryCast(View, ListView) IsNot Nothing Then
Dim _ListView As ListView = TryCast(View, ListView)
Dim _IModelClass As IModelClass
_IModelClass = _ListView.Model.ModelClass
If TryCast(_IModelClass, IModelClassAllowSort).LockObjectBeforeEdit = True Then
RemoveHandler Frame.GetController(Of ListViewProcessCurrentObjectController).CustomProcessSelectedItem, AddressOf ListView_CustomProcessSelectedItem
End If
End If
End Sub
Private Sub ListView_CustomProcessSelectedItem(sender As Object, e As CustomProcessListViewSelectedItemEventArgs)
'// Objektum lockolása, ha nem megy akkor e.handled=True !
Try
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _uow_lock As New UnitOfWork(_onew.Session.DataLayer)
Dim _User As User = _onew.GetObject(TryCast(SecuritySystem.CurrentUser, User))
Dim _IModelClass As IModelClass = TryCast(View, ListView).Model.ModelClass
Dim _ActBusinessObject As Object = TryCast(View.SelectedObjects(0), Object)
If Not LockingModule.LockObject(_uow_lock, _IModelClass.TypeInfo.Type, _ActBusinessObject.Oid.ToString, _User) Then
e.Handled = True
Dim _LockingObject As LockingObject = _onew.FindObject(Of LockingObject)(CriteriaOperator.Parse("ObjectKey=?", _ActBusinessObject.Oid.ToString))
If _LockingObject IsNot Nothing Then
MsgBox(String.Format(TryCast(_IModelClass, IModelClassAllowSort).LockObjectBeforeEditErrorString, _LockingObject.User.FullName, _LockingObject.ObjectCreated), MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Hiba!")
Else
End If
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Hiba!")
End Try
End Sub
End Class
@@ -0,0 +1,32 @@
Partial MustInherit Class LongOperationController
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,103 @@
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.Demos
Public Class LongOperationController
Inherits DevExpress.ExpressApp.ViewController
Private progressControl As IProgressControl
Private waitLongOperationCompleted As AsyncOperation
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
MustOverride Sub DoWorkCore(longOperation As LongOperation)
MustOverride Function CreateProgressControl() As IProgressControl
Private Sub DoWork(longOperation As LongOperation)
Try
DoWorkCore(longOperation)
Catch ex As Exception
longOperation.TerminateAsync()
End Try
End Sub
Private Sub WorkCompleted(state As Object)
OnOperationCompleted()
End Sub
Private Sub LongOperation_CancellingTimeoutExpired(sender As Object, e As EventArgs)
TryCast(sender, LongOperation).TerminateAsync()
End Sub
Private Sub LongOperation_Completed(sender As Object, e As LongOperationCompletedEventArgs)
progressControl.Dispose()
progressControl = Nothing
AddHandler TryCast(sender, LongOperation).CancellingTimeoutExpired, AddressOf LongOperation_CancellingTimeoutExpired
AddHandler TryCast(sender, LongOperation).Completed, AddressOf LongOperation_Completed
waitLongOperationCompleted.PostOperationCompleted(AddressOf WorkCompleted, Nothing)
waitLongOperationCompleted = Nothing
End Sub
Protected Sub OnOperationStarted()
RaiseEvent OperationStarted(Me, Nothing)
End Sub
Protected Sub OnOperationCompleted()
View.ObjectSpace.Refresh()
RaiseEvent OperationCompleted(Me, Nothing)
End Sub
Protected Sub StartLongOperation()
waitLongOperationCompleted = AsyncOperationManager.CreateOperation(Nothing)
Dim _longOperation As LongOperation = New LongOperation(AddressOf DoWork)
_longOperation.CancellingTimeoutMilliSeconds = 10000
AddHandler _longOperation.CancellingTimeoutExpired, AddressOf LongOperation_CancellingTimeoutExpired
AddHandler _longOperation.Completed, AddressOf LongOperation_Completed
progressControl = CreateProgressControl()
progressControl.ShowProgress(_longOperation)
_longOperation.StartAsync()
OnOperationStarted()
End Sub
Public Event OperationCompleted As EventHandler
Public Event OperationStarted As EventHandler
End Class
Public Class LongOperationTerminateException
Inherits Exception
End Class
<AttributeUsage(AttributeTargets.Class, AllowMultiple:=False, Inherited:=True)> _
Public Class BatchCreationOptionsAttribute
Inherits Attribute
Private _objectsCount As Long
Private _commitInterval As Long
Sub New()
MyBase.New()
End Sub
Public Sub BatchCreationOptionsAttribute(objectsCount As Long)
_objectsCount = objectsCount
End Sub
Public Sub BatchCreationOptionsAttribute(objectsCount As Long, commitInterval As Integer)
_objectsCount = objectsCount
_commitInterval = commitInterval
End Sub
ReadOnly Property ObjectsCount As Long
Get
Return _objectsCount
End Get
End Property
ReadOnly Property CommitInterval As Long
Get
Return _commitInterval
End Get
End Property
End Class
Public Interface IObjectPropertiesInitializer
Sub InitializeObject(index As Integer)
End Interface
Public Interface IProgressControl
Inherits IDisposable
Sub ShowProgress(longOperation As LongOperation)
End Interface
@@ -0,0 +1,10 @@
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Public Interface IMasterDetailViewInfo
ReadOnly Property MasterDetailViewId() As String
Sub AssignMasterDetailViewId(ByVal id As String)
End Interface
@@ -0,0 +1,32 @@
Partial Class MasterModificationsControllerBase
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,26 @@
Imports Microsoft.VisualBasic
Imports System
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.ExpressApp.Editors
Public Class MasterModificationsControllerBase
Inherits ViewController
Public Sub New()
TargetViewType = ViewType.DetailView
TargetViewNesting = Nesting.Root
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
'For Each lpe As ListPropertyEditor In (CType(View, DetailView)).GetItems(Of ListPropertyEditor)()
' For Each c As Controller In lpe.Frame.Controllers
' If TypeOf c Is IMasterDetailViewInfo Then
' CType(c, IMasterDetailViewInfo).AssignMasterDetailViewId(View.Id)
' End If
' Next c
'Next lpe
End Sub
End Class
@@ -0,0 +1,32 @@
Partial Class NestedListViewControllerBase
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,29 @@
Imports Microsoft.VisualBasic
Imports System
Imports System.Reflection
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Public MustInherit Class NestedListViewControllerBase
Inherits ViewController
Implements IMasterDetailViewInfo
Public Sub New()
TargetViewNesting = Nesting.Nested
TargetViewType = ViewType.ListView
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
End Sub
Private masterDetailViewIdCore As String = String.Empty
#Region "IMasterDetailViewInfo Members"
Public ReadOnly Property MasterDetailViewId() As String Implements IMasterDetailViewInfo.MasterDetailViewId
Get
Return masterDetailViewIdCore
End Get
End Property
Public Sub AssignMasterDetailViewId(ByVal id As String) Implements IMasterDetailViewInfo.AssignMasterDetailViewId
masterDetailViewIdCore = id
End Sub
#End Region
End Class
@@ -0,0 +1,31 @@
Partial Class NavigationItemPermission
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,126 @@
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.SystemModule
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Public Class NavigationItemPermission
Inherits DevExpress.ExpressApp.WindowController
Private _navigationController As ShowNavigationItemController
Private _ID As Long = 1
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnFrameAssigned()
MyBase.OnFrameAssigned()
'_navigationController = Frame.GetController(Of ShowNavigationItemController)()
'If _navigationController IsNot Nothing Then
' AddHandler _navigationController.ItemsInitialized, AddressOf ItemsInitialized
'End If
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
End Sub
Private Sub ItemsInitialized(sender As Object, e As EventArgs)
Dim _ChoiceActionItem As ChoiceActionItem
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
Dim _NavigationItemRole_Collection As XPCollection(Of NavigationItemRole) = New XPCollection(Of NavigationItemRole)(_onew.Session, CriteriaOperator.Parse("1=1"))
_uow.Delete(New XPCollection(Of ModelNavigation)(_uow))
_uow.CommitChanges()
For Each _ChoiceActionItem In _navigationController.ShowNavigationItemAction.Items
RecursiveSetPermission(_ChoiceActionItem, _NavigationItemRole_Collection)
If SecuritySystem.CurrentUserName = "SysAdmin" Then
RecursiveAddModelNavigation(_uow, Nothing, _ChoiceActionItem)
End If
Next
_uow.CommitChanges()
End Sub
Sub RecursiveSetPermission(_ChoiceActionItem As ChoiceActionItem, _NavigationItemRole_Collection As XPCollection(Of NavigationItemRole))
Dim _NavigationItemRole As NavigationItemRole
Dim _ChoiceActionItem_Child As ChoiceActionItem
If _ChoiceActionItem.Items.Count > 0 Then
For Each _ChoiceActionItem_Child In _ChoiceActionItem.Items
RecursiveSetPermission(_ChoiceActionItem_Child, _NavigationItemRole_Collection)
Next
End If
If _ChoiceActionItem.Id = "@NavigationItemPermission" Then
If SecuritySystem.CurrentUserName <> "SysAdmin" Then
_ChoiceActionItem.Active.SetItemValue("", False)
End If
End If
For Each _NavigationItemRole In _NavigationItemRole_Collection
If _NavigationItemRole.ChoiceActionItemId = _ChoiceActionItem.Id Then
If _NavigationItemRole.Role IsNot Nothing Then
If SecuritySystemHelper.IsUserInRoleCurrentUser(_NavigationItemRole.Role.Name) Then
_ChoiceActionItem.Active.SetItemValue("", False)
End If
End If
If _NavigationItemRole.SubcontractorRoles IsNot Nothing Then
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _SubcontractorUserRoles_Collection As New XPCollection(Of SubcontractorUserRoles)(_onew.Session, CriteriaOperator.Parse("User.Oid=?", TryCast(SecuritySystem.CurrentUser, DevExpress.Persistent.BaseImpl.User).Oid))
For Each _SubcontractorUserRoles As SubcontractorUserRoles In _SubcontractorUserRoles_Collection
If _NavigationItemRole.SubcontractorRoles.Oid = _SubcontractorUserRoles.SubcontractorRoles.Oid Then
_ChoiceActionItem.Active.SetItemValue("", False)
End If
Next
End If
If _NavigationItemRole.SupportRoles IsNot Nothing Then
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _SupportUserRoles_Collection As New XPCollection(Of SupportUserRoles)(_onew.Session, CriteriaOperator.Parse("User.Oid=?", TryCast(SecuritySystem.CurrentUser, DevExpress.Persistent.BaseImpl.User).Oid))
For Each _SupportUserRoles As SupportUserRoles In _SupportUserRoles_Collection
If _NavigationItemRole.SupportRoles.Oid = _SupportUserRoles.SupportRoles.Oid Then
_ChoiceActionItem.Active.SetItemValue("", False)
End If
Next
End If
End If
Next
End Sub
Sub RecursiveAddModelNavigation(_uow As UnitOfWork, _ModelNavigationParent As ModelNavigation, _ChoiceActionItem As ChoiceActionItem)
Dim _ModelNavigation As ModelNavigation
Dim _ChoiceActionItem_Child As ChoiceActionItem
_ID += 1
_ModelNavigation = New ModelNavigation(_uow)
_ModelNavigation.Parent = _ModelNavigationParent
_ModelNavigation.Name = _ChoiceActionItem.Id
_ModelNavigation.Navigation_Caption = _ChoiceActionItem.Caption
_ModelNavigation.Navigation_ImageName = _ChoiceActionItem.ImageName
If _ChoiceActionItem.Items.Count > 0 Then
For Each _ChoiceActionItem_Child In _ChoiceActionItem.Items
RecursiveAddModelNavigation(_uow, _ModelNavigation, _ChoiceActionItem_Child)
Next
End If
End Sub
End Class
@@ -0,0 +1,61 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False)> _
Public Class NavigationItemRole
Inherits BaseObject
Private _ChoiceActionItemId As String
Private _Role As Role
Private _SubcontractorRoles As SubcontractorRoles
Private _SupportRoles As SupportRoles
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
End Sub
<DataSourceProperty("ChoiceActionItemId_DataSourceProperty")> _
Property ChoiceActionItemId As String
Get
Return _ChoiceActionItemId
End Get
Set(value As String)
SetPropertyValue("ChoiceActionItemId", _ChoiceActionItemId, value)
End Set
End Property
Property Role As Role
Get
Return _Role
End Get
Set(value As Role)
SetPropertyValue("Role", _Role, value)
End Set
End Property
Property SubcontractorRoles As SubcontractorRoles
Get
Return _SubcontractorRoles
End Get
Set(value As SubcontractorRoles)
SetPropertyValue("SubcontractorRoles", _SubcontractorRoles, value)
End Set
End Property
Property SupportRoles As SupportRoles
Get
Return _SupportRoles
End Get
Set(value As SupportRoles)
SetPropertyValue("SupportRoles", _SupportRoles, value)
End Set
End Property
End Class
@@ -0,0 +1,32 @@
Partial Class RoundingController
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,59 @@
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
Public Class RoundingController
Inherits DevExpress.ExpressApp.ViewController(Of ListView)
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
Dim _SQL As String = ""
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
If View Is Nothing Then Exit Sub
For Each _OwnMember In View.Model.ModelClass.OwnMembers
Dim _IModelMemberAllowSort As IModelMemberAllowSort = TryCast(_OwnMember, IModelMemberAllowSort)
If _IModelMemberAllowSort IsNot Nothing Then
If _IModelMemberAllowSort.AllowRounding Then
Try
Select Case GLOBAL_SQLType
Case eSQLType.MySQL, eSQLType.MSSQL
_SQL = "UPDATE " & View.Model.ModelClass.ShortName.ToString & " SET " & _OwnMember.Name.ToString & "=ROUND(" & _OwnMember.Name.ToString
_SQL += "," & _IModelMemberAllowSort.RoundingTo.ToString & ") WHERE "
_SQL += _OwnMember.Name.ToString & "<>ROUND(" & _OwnMember.Name.ToString & "," & _IModelMemberAllowSort.RoundingTo.ToString & ")"
_ocur.Session.ExecuteNonQuery(_SQL)
Case eSQLType.PostgreSQL
_SQL = "UPDATE """ & View.Model.ModelClass.ShortName.ToString & """ SET """ & _OwnMember.Name.ToString & """=ROUND(""" & _OwnMember.Name.ToString
_SQL += """," & _IModelMemberAllowSort.RoundingTo.ToString & ") WHERE """
_SQL += _OwnMember.Name.ToString & """<>ROUND(""" & _OwnMember.Name.ToString & """," & _IModelMemberAllowSort.RoundingTo.ToString & ")"
_ocur.Session.ExecuteNonQuery(_SQL)
End Select
Catch exp As Exception
Dim _uow_exception As New UnitOfWork(_ocur.Session.DataLayer)
Dim _ErrorLog As ErrorLog = New ErrorLog(_uow_exception)
_ErrorLog.Description = exp.Message.ToString & " (" & _SQL & ")"
_ErrorLog.Save()
_uow_exception.CommitChanges()
End Try
End If
End If
Next
End Sub
End Class
@@ -0,0 +1,61 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False)> _
Public Class ModelActionRole
Inherits BaseObject
Private _Action_ID As String
Private _Action_Controller As String
Private _Role As Role
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
End Sub
<Size(255)> _
Property Action_ID As String
Get
Return _Action_ID
End Get
Set(value As String)
SetPropertyValue("Action_ID", _Action_ID, value)
End Set
End Property
<Size(255)> _
Property Action_Controller As String
Get
Return _Action_Controller
End Get
Set(value As String)
SetPropertyValue("Action_Controller", _Action_Controller, value)
End Set
End Property
Property Role As Role
Get
Return _Role
End Get
Set(value As Role)
SetPropertyValue("Role", _Role, value)
End Set
End Property
End Class
@@ -0,0 +1,57 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports System.Drawing
Imports DevExpress.ExpressApp.Utils
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), NonPersistent()> _
Public Class ModelActions
Inherits BaseObject
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
Action_Enabled = True
End Sub
Property Action_ID As String
Property Action_ImageName As String
Property Action_Controller As String
Property Action_Caption As String
Property Action_SISGroup1 As String
Property Action_SISGroup2 As String
<Browsable(False)> Property Action_Enabled As Boolean
<VisibleInDetailView(False)> _
ReadOnly Property Image1 As Image
Get
Return ImageLoader.Instance.GetImageInfo(Action_ImageName).Image
End Get
End Property
<VisibleInDetailView(False)> _
ReadOnly Property Action_Enabled_Image As Image
Get
If Action_Enabled Then
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
Else
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
End If
End Get
End Property
End Class
@@ -0,0 +1,106 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports System.Drawing
Imports DevExpress.ExpressApp.Utils
<DefaultClassOptions(), NonPersistent(), NavigationItem(False), CreatableItem(False)> _
Public Class ModelBOModel
Inherits BaseObject
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
BOModel_Create = True
BOModel_Read = True
BOModel_Write = True
BOModel_Delete = True
BOModel_Navigate = True
End Sub
Property BOModel_ID As String
Property BOModel_ImageName As String
Property BOModel_Caption As String
Property BOModel_SISGroup1 As String
Property BOModel_SISGroup2 As String
Property BOModel_IsPopup As Boolean
Property BOModel_NonPersistent As Boolean
<Browsable(False)> Property BOModel_Create As Boolean
<Browsable(False)> Property BOModel_Read As Boolean
<Browsable(False)> Property BOModel_Write As Boolean
<Browsable(False)> Property BOModel_Delete As Boolean
<Browsable(False)> Property BOModel_Navigate As Boolean
<VisibleInDetailView(False)> _
ReadOnly Property Image1 As Image
Get
Return ImageLoader.Instance.GetImageInfo(BOModel_ImageName).Image
End Get
End Property
<VisibleInDetailView(False)> _
ReadOnly Property BOModel_Create_Image As Image
Get
If BOModel_Create Then
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
Else
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
End If
End Get
End Property
<VisibleInDetailView(False)> _
ReadOnly Property BOModel_Read_Image As Image
Get
If BOModel_Read Then
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
Else
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
End If
End Get
End Property
<VisibleInDetailView(False)> _
ReadOnly Property BOModel_Write_Image As Image
Get
If BOModel_Write Then
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
Else
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
End If
End Get
End Property
<VisibleInDetailView(False)> _
ReadOnly Property BOModel_Delete_Image As Image
Get
If BOModel_Delete Then
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
Else
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
End If
End Get
End Property
<VisibleInDetailView(False)> _
ReadOnly Property BOModel_Navigate_Image As Image
Get
If BOModel_Navigate Then
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
Else
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
End If
End Get
End Property
End Class
@@ -0,0 +1,53 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports System.Drawing
Imports DevExpress.ExpressApp.Utils
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), DeferredDeletion(False)> _
Public Class ModelNavigation
Inherits HCategory
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
End Sub
<Browsable(False)> Property MasterKey As Guid
Property Navigation_Caption As String
<Browsable(False)> Property Navigation_ImageName As String
Property Navigation_Enabled As Boolean = True
<Browsable(False)> Property Index As Long
<VisibleInDetailView(False)> _
ReadOnly Property Image1 As Image
Get
Return ImageLoader.Instance.GetImageInfo(Navigation_ImageName).Image
End Get
End Property
<VisibleInDetailView(False)> _
ReadOnly Property ImageDeny As Image
Get
If Navigation_Enabled Then
Return ImageLoader.Instance.GetImageInfo("Action_Grant").Image
Else
Return ImageLoader.Instance.GetImageInfo("Action_Deny").Image
End If
End Get
End Property
End Class
@@ -0,0 +1,207 @@
Partial Class RolesModelSecurity
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.aRoleActionEnable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
Me.aRoleNavigationEnable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
Me.aRoleNavigationDisable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
Me.aRoleActionDisable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
Me.aRoleNavigationView = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aRoleBOModelEnable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
Me.aRoleBOModelView = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aRoleBOModelDisable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
Me.aRoleActionView = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
'
'aRoleActionEnable
'
Me.aRoleActionEnable.AcceptButtonCaption = Nothing
Me.aRoleActionEnable.CancelButtonCaption = Nothing
Me.aRoleActionEnable.Caption = "aRole Action Enable"
Me.aRoleActionEnable.Category = "Save"
Me.aRoleActionEnable.ConfirmationMessage = Nothing
Me.aRoleActionEnable.Id = "aRoleActionEnable"
Me.aRoleActionEnable.ImageName = Nothing
Me.aRoleActionEnable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
Me.aRoleActionEnable.Shortcut = Nothing
Me.aRoleActionEnable.Tag = Nothing
Me.aRoleActionEnable.TargetObjectsCriteria = Nothing
Me.aRoleActionEnable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
Me.aRoleActionEnable.TargetViewId = Nothing
Me.aRoleActionEnable.ToolTip = Nothing
Me.aRoleActionEnable.TypeOfView = Nothing
'
'aRoleNavigationEnable
'
Me.aRoleNavigationEnable.AcceptButtonCaption = Nothing
Me.aRoleNavigationEnable.CancelButtonCaption = Nothing
Me.aRoleNavigationEnable.Caption = "aRole Navigation Enable"
Me.aRoleNavigationEnable.Category = "Save"
Me.aRoleNavigationEnable.ConfirmationMessage = Nothing
Me.aRoleNavigationEnable.Id = "aRoleNavigationEnable"
Me.aRoleNavigationEnable.ImageName = Nothing
Me.aRoleNavigationEnable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
Me.aRoleNavigationEnable.Shortcut = Nothing
Me.aRoleNavigationEnable.Tag = Nothing
Me.aRoleNavigationEnable.TargetObjectsCriteria = Nothing
Me.aRoleNavigationEnable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
Me.aRoleNavigationEnable.TargetViewId = Nothing
Me.aRoleNavigationEnable.ToolTip = Nothing
Me.aRoleNavigationEnable.TypeOfView = Nothing
'
'aRoleNavigationDisable
'
Me.aRoleNavigationDisable.AcceptButtonCaption = Nothing
Me.aRoleNavigationDisable.CancelButtonCaption = Nothing
Me.aRoleNavigationDisable.Caption = "aRole Navigation Disable"
Me.aRoleNavigationDisable.Category = "Save"
Me.aRoleNavigationDisable.ConfirmationMessage = Nothing
Me.aRoleNavigationDisable.Id = "aRoleNavigationDisable"
Me.aRoleNavigationDisable.ImageName = Nothing
Me.aRoleNavigationDisable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
Me.aRoleNavigationDisable.Shortcut = Nothing
Me.aRoleNavigationDisable.Tag = Nothing
Me.aRoleNavigationDisable.TargetObjectsCriteria = Nothing
Me.aRoleNavigationDisable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
Me.aRoleNavigationDisable.TargetViewId = Nothing
Me.aRoleNavigationDisable.ToolTip = Nothing
Me.aRoleNavigationDisable.TypeOfView = Nothing
'
'aRoleActionDisable
'
Me.aRoleActionDisable.AcceptButtonCaption = Nothing
Me.aRoleActionDisable.CancelButtonCaption = Nothing
Me.aRoleActionDisable.Caption = "aRole Action Disable"
Me.aRoleActionDisable.Category = "Save"
Me.aRoleActionDisable.ConfirmationMessage = Nothing
Me.aRoleActionDisable.Id = "aRoleActionDisable"
Me.aRoleActionDisable.ImageName = Nothing
Me.aRoleActionDisable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
Me.aRoleActionDisable.Shortcut = Nothing
Me.aRoleActionDisable.Tag = Nothing
Me.aRoleActionDisable.TargetObjectsCriteria = Nothing
Me.aRoleActionDisable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
Me.aRoleActionDisable.TargetViewId = Nothing
Me.aRoleActionDisable.ToolTip = Nothing
Me.aRoleActionDisable.TypeOfView = Nothing
'
'aRoleNavigationView
'
Me.aRoleNavigationView.Caption = "aRole Navigation View"
Me.aRoleNavigationView.Category = "View"
Me.aRoleNavigationView.ConfirmationMessage = Nothing
Me.aRoleNavigationView.Id = "aRoleNavigationView"
Me.aRoleNavigationView.ImageName = Nothing
Me.aRoleNavigationView.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
Me.aRoleNavigationView.Shortcut = Nothing
Me.aRoleNavigationView.Tag = Nothing
Me.aRoleNavigationView.TargetObjectsCriteria = Nothing
Me.aRoleNavigationView.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
Me.aRoleNavigationView.TargetViewId = Nothing
Me.aRoleNavigationView.ToolTip = Nothing
Me.aRoleNavigationView.TypeOfView = Nothing
'
'aRoleBOModelEnable
'
Me.aRoleBOModelEnable.AcceptButtonCaption = Nothing
Me.aRoleBOModelEnable.CancelButtonCaption = Nothing
Me.aRoleBOModelEnable.Caption = "aRole BOModel Enable"
Me.aRoleBOModelEnable.Category = "Save"
Me.aRoleBOModelEnable.ConfirmationMessage = Nothing
Me.aRoleBOModelEnable.Id = "aRoleBOModelEnable"
Me.aRoleBOModelEnable.ImageName = Nothing
Me.aRoleBOModelEnable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
Me.aRoleBOModelEnable.Shortcut = Nothing
Me.aRoleBOModelEnable.Tag = Nothing
Me.aRoleBOModelEnable.TargetObjectsCriteria = Nothing
Me.aRoleBOModelEnable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
Me.aRoleBOModelEnable.TargetViewId = Nothing
Me.aRoleBOModelEnable.ToolTip = Nothing
Me.aRoleBOModelEnable.TypeOfView = Nothing
'
'aRoleBOModelView
'
Me.aRoleBOModelView.Caption = "aRole BOModel View"
Me.aRoleBOModelView.Category = "View"
Me.aRoleBOModelView.ConfirmationMessage = Nothing
Me.aRoleBOModelView.Id = "aRoleBOModelView"
Me.aRoleBOModelView.ImageName = Nothing
Me.aRoleBOModelView.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
Me.aRoleBOModelView.Shortcut = Nothing
Me.aRoleBOModelView.Tag = Nothing
Me.aRoleBOModelView.TargetObjectsCriteria = Nothing
Me.aRoleBOModelView.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
Me.aRoleBOModelView.TargetViewId = Nothing
Me.aRoleBOModelView.ToolTip = Nothing
Me.aRoleBOModelView.TypeOfView = Nothing
'
'aRoleBOModelDisable
'
Me.aRoleBOModelDisable.AcceptButtonCaption = Nothing
Me.aRoleBOModelDisable.CancelButtonCaption = Nothing
Me.aRoleBOModelDisable.Caption = "aRole BOModel Disable"
Me.aRoleBOModelDisable.Category = "Save"
Me.aRoleBOModelDisable.ConfirmationMessage = Nothing
Me.aRoleBOModelDisable.Id = "aRoleBOModelDisable"
Me.aRoleBOModelDisable.ImageName = Nothing
Me.aRoleBOModelDisable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
Me.aRoleBOModelDisable.Shortcut = Nothing
Me.aRoleBOModelDisable.Tag = Nothing
Me.aRoleBOModelDisable.TargetObjectsCriteria = Nothing
Me.aRoleBOModelDisable.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
Me.aRoleBOModelDisable.TargetViewId = Nothing
Me.aRoleBOModelDisable.ToolTip = Nothing
Me.aRoleBOModelDisable.TypeOfView = Nothing
'
'aRoleActionView
'
Me.aRoleActionView.Caption = "aRole Action View"
Me.aRoleActionView.Category = "View"
Me.aRoleActionView.ConfirmationMessage = Nothing
Me.aRoleActionView.Id = "aRoleActionView"
Me.aRoleActionView.ImageName = Nothing
Me.aRoleActionView.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
Me.aRoleActionView.Shortcut = Nothing
Me.aRoleActionView.Tag = Nothing
Me.aRoleActionView.TargetObjectsCriteria = Nothing
Me.aRoleActionView.TargetObjectType = GetType(DevExpress.Persistent.BaseImpl.Role)
Me.aRoleActionView.TargetViewId = Nothing
Me.aRoleActionView.ToolTip = Nothing
Me.aRoleActionView.TypeOfView = Nothing
End Sub
Friend WithEvents aRoleActionEnable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
Friend WithEvents aRoleNavigationEnable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
Friend WithEvents aRoleNavigationDisable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
Friend WithEvents aRoleActionDisable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
Friend WithEvents aRoleNavigationView As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aRoleBOModelEnable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
Friend WithEvents aRoleBOModelView As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aRoleBOModelDisable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
Friend WithEvents aRoleActionView As DevExpress.ExpressApp.Actions.SimpleAction
End Class
@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="aRoleActionEnable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 329</value>
</metadata>
<metadata name="aRoleNavigationEnable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 290</value>
</metadata>
<metadata name="aRoleNavigationDisable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 251</value>
</metadata>
<metadata name="aRoleActionDisable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 212</value>
</metadata>
<metadata name="aRoleNavigationView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 173</value>
</metadata>
<metadata name="aRoleBOModelEnable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 134</value>
</metadata>
<metadata name="aRoleBOModelView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 95</value>
</metadata>
<metadata name="aRoleBOModelDisable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="aRoleActionView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>190, 56</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,501 @@
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.Data.Filtering
Imports DevExpress.ExpressApp.Model
Imports DevExpress.ExpressApp.SystemModule
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Xpo
Imports System.IO
Imports System.Security
Imports System.Xml
Imports System.Security.Principal
Imports DevExpress.Persistent.Base.Security
Imports DevExpress.ExpressApp.Security
Imports DevExpress.ExpressApp.Updating
Public Class RolesModelSecurity
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnFrameAssigned()
MyBase.OnFrameAssigned()
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
'// Ideiglenes tiltás
'Frame.GetController(Of RolesModelSecurity).aRoleActionDisable.Active.SetItemValue("", False)
'Frame.GetController(Of RolesModelSecurity).aRoleActionEnable.Active.SetItemValue("", False)
Frame.GetController(Of RolesModelSecurity).aRoleBOModelDisable.Active.SetItemValue("", False)
Frame.GetController(Of RolesModelSecurity).aRoleBOModelEnable.Active.SetItemValue("", False)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
If _ocur Is Nothing Then Exit Sub
Dim _LoggedUser As User = TryCast(SecuritySystem.CurrentUser, User)
If _LoggedUser IsNot Nothing Then
For Each _Role As Role In _LoggedUser.Roles
Dim _ModelActionRole_Collection As New XPCollection(Of ModelActionRole)(_ocur.Session, CriteriaOperator.Parse("Role.Oid=?", _Role.Oid))
For Each _ModelActionRole As ModelActionRole In _ModelActionRole_Collection
For Each _Controller As Controller In Frame.Controllers
If Replace(_Controller.Name, ".Win", "") = _ModelActionRole.Action_Controller Then
For Each _Action As ActionBase In _Controller.Actions
If _Action.Id = _ModelActionRole.Action_ID Then
_Action.Active.SetItemValue("SISBusinessSecurity", False)
End If
Next
End If
If Replace(_Controller.Name, ".Web", "") = _ModelActionRole.Action_Controller Then
For Each _Action As ActionBase In _Controller.Actions
If _Action.Id = _ModelActionRole.Action_ID Then
_Action.Active.SetItemValue("SISBusinessSecurity", False)
End If
Next
End If
Next
Next
Next
End If
End Sub
Private Sub aRoleActionEnable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aRoleActionEnable.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelActions))
Dim _ModelActions As ModelActions
Dim _Action As IModelAction
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
If _Role IsNot Nothing Then
_CS.BeginUpdateCriteria()
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
_CS.EndUpdateCriteria()
For Each _Action In Application.Model.ActionDesign.Actions
If _Action.Controller.Name Like "SIS*" Then
_ModelActions = _onew.CreateObject(Of ModelActions)()
_ModelActions.Action_ID = _Action.Id
_ModelActions.Action_Caption = _Action.Caption
_ModelActions.Action_ImageName = _Action.ImageName
_ModelActions.Action_Controller = _Action.Controller.Name
Dim _ModelActionRole As ModelActionRole = _onew.FindObject(Of ModelActionRole)(CriteriaOperator.Parse("Action_ID=? AND Action_Controller=? AND Role=?", _
_ModelActions.Action_ID, _ModelActions.Action_Controller, _onew.GetObject(_Role)))
If _ModelActionRole IsNot Nothing Then
_ModelActions.Action_Enabled = False
Else
_ModelActions.Action_Enabled = True
End If
_CS.Add(_ModelActions)
End If
Next
End If
e.View = Application.CreateListView("ModelActions_ListView", _CS, False)
End Sub
Private Sub aRoleActionEnable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aRoleActionEnable.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
If _Role IsNot Nothing Then
For Each _ModelActions As ModelActions In e.PopupWindow.View.SelectedObjects
Dim _ModelActionRole As ModelActionRole = _ocur.FindObject(Of ModelActionRole)(CriteriaOperator.Parse("Action_ID=? AND Action_Controller=? AND Role=?", _
_ModelActions.Action_ID, _ModelActions.Action_Controller, _Role))
If _ModelActionRole IsNot Nothing Then
_ocur.Delete(_ModelActionRole)
End If
Next
End If
_ocur.CommitChanges()
End Sub
Private Sub aRoleActionView_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRoleActionView.Execute
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelActions))
Dim _ModelActions As ModelActions
Dim _Action As IModelAction
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
_CS.BeginUpdateCriteria()
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
_CS.EndUpdateCriteria()
For Each _Action In Application.Model.ActionDesign.Actions
If _Action.Controller.Name Like "SIS*" Then
_ModelActions = _onew.CreateObject(Of ModelActions)()
_ModelActions.Action_ID = _Action.Id
_ModelActions.Action_Caption = _Action.Caption
_ModelActions.Action_ImageName = _Action.ImageName
_ModelActions.Action_Controller = _Action.Controller.Name
_ModelActions.Action_SISGroup1 = TryCast(_Action, IModelActionExtender).SISGroup1
_ModelActions.Action_SISGroup2 = TryCast(_Action, IModelActionExtender).SISGroup2
_CS.Add(_ModelActions)
End If
Next
e.ShowViewParameters.CreatedView = Application.CreateListView("ModelActions_ListView", _CS, True)
e.ShowViewParameters.CreatedView.Caption += " (" & _Role.Name & ")"
End Sub
Private Sub aRoleNavigationEnable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aRoleNavigationEnable.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
Dim _MasterKey As Guid = SecuritySystem.CurrentUserId
Select Case GLOBAL_SQLType
Case eSQLType.PostgreSQL
_onew.Session.ExecuteNonQuery("delete from ""ModelNavigation"" where ""MasterKey""='" & _MasterKey.ToString & "'")
_onew.CommitChanges()
Case Else
_onew.Session.ExecuteNonQuery("delete from ModelNavigation where MasterKey='" & _MasterKey.ToString & "'")
_onew.CommitChanges()
End Select
If View.SelectedObjects.Count = 1 Then
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
If _Role IsNot Nothing Then
Dim _NavigationItemRole_Collection As New XPCollection(Of NavigationItemRole)(_onew.Session, CriteriaOperator.Parse("Role.Oid=?", _Role.Oid))
Dim _NavigationItemRole As NavigationItemRole
Dim _ModelNavigation As ModelNavigation
Dim _IModelNavigationItems As IModelNavigationItems
Dim _IModelNavigationItem As IModelNavigationItem
Dim _NavigationItems As IModelRootNavigationItems = DirectCast(Application.Model, IModelApplicationNavigationItems).NavigationItems
_IModelNavigationItems = TryCast(_NavigationItems.Items, IModelNavigationItems)
For Each _IModelNavigationItem In _IModelNavigationItems
RecursiveAddModelNavigation(_uow, _MasterKey, Nothing, _IModelNavigationItem)
Next
_uow.CommitChanges()
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelNavigation))
_CS.BeginUpdateCriteria()
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("MasterKey=?", _MasterKey))
_CS.EndUpdateCriteria()
_CS.Sorting.Add(New SortProperty("Index", DB.SortingDirection.Ascending))
For Each _ModelNavigation In _CS.Collection
For Each _NavigationItemRole In _NavigationItemRole_Collection
If _NavigationItemRole.ChoiceActionItemId = _ModelNavigation.Name Then
RecursiveDeny(_ModelNavigation)
End If
Next
Next
e.View = Application.CreateListView("ModelNavigation_ListView", _CS, False)
If _Role IsNot Nothing Then
e.View.Caption += " (" & _Role.Name & ")"
End If
End If
End If
End Sub
Private Sub aRoleNavigationEnable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aRoleNavigationEnable.Execute
Dim _ModelNavigation As ModelNavigation
Dim _NavigationItemRole As NavigationItemRole
Dim _ocur As IObjectSpace = View.ObjectSpace
Dim _Role As Role
For Each _Role In View.SelectedObjects
For Each _ModelNavigation In e.PopupWindow.View.SelectedObjects
_NavigationItemRole = _ocur.FindObject(Of NavigationItemRole)(CriteriaOperator.Parse("Role.Oid=? and ChoiceActionItemId=?", _Role.Oid, _ModelNavigation.Name))
If _NavigationItemRole IsNot Nothing Then
_ocur.Delete(_NavigationItemRole)
End If
Next
Next
_ocur.CommitChanges()
End Sub
Private Sub aRoleNavigationDisable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aRoleNavigationDisable.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
Dim _MasterKey As Guid = SecuritySystem.CurrentUserId
Select Case GLOBAL_SQLType
Case eSQLType.PostgreSQL
_onew.Session.ExecuteNonQuery("delete from ""ModelNavigation"" where ""MasterKey""='" & _MasterKey.ToString & "'")
_onew.CommitChanges()
Case Else
_onew.Session.ExecuteNonQuery("delete from ModelNavigation where MasterKey='" & _MasterKey.ToString & "'")
_onew.CommitChanges()
End Select
If View.SelectedObjects.Count = 1 Then
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
If _Role IsNot Nothing Then
Dim _NavigationItemRole_Collection As New XPCollection(Of NavigationItemRole)(_onew.Session, CriteriaOperator.Parse("Role.Oid=?", _Role.Oid))
Dim _NavigationItemRole As NavigationItemRole
Dim _ModelNavigation As ModelNavigation
Dim _IModelNavigationItems As IModelNavigationItems
Dim _IModelNavigationItem As IModelNavigationItem
Dim _NavigationItems As IModelRootNavigationItems = DirectCast(Application.Model, IModelApplicationNavigationItems).NavigationItems
_IModelNavigationItems = TryCast(_NavigationItems.Items, IModelNavigationItems)
For Each _IModelNavigationItem In _IModelNavigationItems
RecursiveAddModelNavigation(_uow, _MasterKey, Nothing, _IModelNavigationItem)
Next
_onew.CommitChanges()
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelNavigation))
_CS.BeginUpdateCriteria()
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("MasterKey=?", _MasterKey))
_CS.EndUpdateCriteria()
_CS.Sorting.Add(New SortProperty("Index", DB.SortingDirection.Ascending))
For Each _ModelNavigation In _CS.Collection
For Each _NavigationItemRole In _NavigationItemRole_Collection
If _NavigationItemRole.ChoiceActionItemId = _ModelNavigation.Name Then
RecursiveDeny(_ModelNavigation)
End If
Next
Next
e.View = Application.CreateListView("ModelNavigation_ListView", _CS, False)
If _Role IsNot Nothing Then
e.View.Caption += " (" & _Role.Name & ")"
End If
End If
End If
End Sub
Private Sub aRoleNavigationDisable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aRoleNavigationDisable.Execute
Dim _ModelNavigation As ModelNavigation
Dim _NavigationItemRole As NavigationItemRole
Dim _ocur As IObjectSpace = View.ObjectSpace
Dim _Role As Role
For Each _Role In View.SelectedObjects
For Each _ModelNavigation In e.PopupWindow.View.SelectedObjects
_NavigationItemRole = _ocur.FindObject(Of NavigationItemRole)(CriteriaOperator.Parse("Role.Oid=? and ChoiceActionItemId=?", _Role.Oid, _ModelNavigation.Name))
If _NavigationItemRole Is Nothing Then
_NavigationItemRole = _ocur.CreateObject(Of NavigationItemRole)()
_NavigationItemRole.Role = _ocur.GetObject(_Role)
_NavigationItemRole.ChoiceActionItemId = _ModelNavigation.Name
End If
Next
Next
_ocur.CommitChanges()
End Sub
Private Sub aRoleNavigationView_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRoleNavigationView.Execute
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelNavigation))
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
Dim _NavigationItemRole_Collection As New XPCollection(Of NavigationItemRole)(_onew.Session, CriteriaOperator.Parse("Role.Oid=?", _Role.Oid))
Dim _NavigationItemRole As NavigationItemRole
Dim _ModelNavigation As ModelNavigation
For Each _ModelNavigation In _CS.Collection
For Each _NavigationItemRole In _NavigationItemRole_Collection
If _NavigationItemRole.ChoiceActionItemId = _ModelNavigation.Name Then
RecursiveDeny(_ModelNavigation)
End If
Next
Next
e.ShowViewParameters.CreatedView = Application.CreateListView("ModelNavigation_ListView", _CS, True)
e.ShowViewParameters.CreatedView.Caption += " (" & _Role.Name & ")"
End Sub
Private Sub aRoleBOModelEnable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aRoleBOModelEnable.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelBOModel))
Dim _ModelBOModel As ModelBOModel
Dim _IModelClass As IModelClass
_CS.BeginUpdateCriteria()
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
_CS.EndUpdateCriteria()
For Each _IModelClass In Application.Model.BOModel
If _IModelClass.Name Like "SIS*" Then
_ModelBOModel = _onew.CreateObject(Of ModelBOModel)()
_ModelBOModel.BOModel_ID = _IModelClass.Name
_ModelBOModel.BOModel_Caption = _IModelClass.Caption
_ModelBOModel.BOModel_ImageName = _IModelClass.ImageName
_ModelBOModel.BOModel_SISGroup1 = TryCast(_IModelClass, IModelClassAllowSort).SISGroup1
_ModelBOModel.BOModel_SISGroup2 = TryCast(_IModelClass, IModelClassAllowSort).SISGroup2
_ModelBOModel.BOModel_NonPersistent = TryCast(_IModelClass, IModelClassAllowSort).NonPersistent
_ModelBOModel.BOModel_IsPopup = TryCast(_IModelClass, IModelClassAllowSort).IsPopup
_CS.Add(_ModelBOModel)
End If
Next
e.View = Application.CreateListView("ModelBOModel_ListView", _CS, False)
End Sub
Private Sub aRoleBOModelEnable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aRoleBOModelEnable.Execute
End Sub
Private Sub aRoleBOModelView_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRoleBOModelView.Execute
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelBOModel))
Dim _ModelBOModel As ModelBOModel
Dim _IModelClass As IModelClass
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
Dim _Permission As IPermission
Dim _XMLDocument As New XmlDocument
Dim _XmlNodes As Xml.XmlNodeList
Dim _XmlNode As Xml.XmlNode
Dim _XmlNode1 As Xml.XmlNode
Dim i As Long = 0
_CS.BeginUpdateCriteria()
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
_CS.EndUpdateCriteria()
For Each _IModelClass In Application.Model.BOModel
If _IModelClass.Name Like "SIS*" Then
_ModelBOModel = _onew.CreateObject(Of ModelBOModel)()
_ModelBOModel.BOModel_ID = _IModelClass.Name
_ModelBOModel.BOModel_Caption = _IModelClass.Caption
_ModelBOModel.BOModel_ImageName = _IModelClass.ImageName
_ModelBOModel.BOModel_SISGroup1 = TryCast(_IModelClass, IModelClassAllowSort).SISGroup1
_ModelBOModel.BOModel_SISGroup2 = TryCast(_IModelClass, IModelClassAllowSort).SISGroup2
_ModelBOModel.BOModel_NonPersistent = TryCast(_IModelClass, IModelClassAllowSort).NonPersistent
_ModelBOModel.BOModel_IsPopup = TryCast(_IModelClass, IModelClassAllowSort).IsPopup
_CS.Add(_ModelBOModel)
End If
Next
'// For Each _Permission In _Role.Permissions
For Each _Permission In _Role.Permissions
_XMLDocument.LoadXml(_Permission.ToXml.ToString)
_XmlNodes = _XMLDocument.SelectNodes("IPermission")
For Each _XmlNode In _XmlNodes
i = 0
For Each _XmlNode1 In _XmlNode.SelectNodes("ParticularAccessItem")
For Each _ModelBOModel In _CS.List
If _ModelBOModel.BOModel_ID = _XmlNode1.Attributes("objectType").Value.ToString Then
Select Case _XmlNode1.Attributes("access").Value.ToString
Case "Create"
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Create = False
Case "Read"
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Read = False
Case "Write"
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Write = False
Case "Delete"
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Delete = False
Case "Navigate"
If _XmlNode1.Attributes("modifier").Value.ToString = "Deny" Then _ModelBOModel.BOModel_Navigate = False
End Select
End If
Next
Next
Next
Next
e.ShowViewParameters.CreatedView = Application.CreateListView("ModelBOModel_ListView", _CS, True)
e.ShowViewParameters.CreatedView.Caption += " (" & _Role.Name & ")"
End Sub
Sub RecursiveAddModelNavigation(_uow As UnitOfWork, _MasterKey As Guid, _ModelNavigationParent As ModelNavigation, _IModelNavigationItem As IModelNavigationItem)
Dim _ModelNavigation As ModelNavigation
Dim _IModelNavigationItem_Child As IModelNavigationItem
_ModelNavigation = New ModelNavigation(_uow)
_ModelNavigation.Parent = _ModelNavigationParent
_ModelNavigation.Name = _IModelNavigationItem.Id
_ModelNavigation.Navigation_Caption = _IModelNavigationItem.Caption
_ModelNavigation.Navigation_ImageName = _IModelNavigationItem.ImageName
_ModelNavigation.MasterKey = _MasterKey
'If _IModelNavigationItem.Index IsNot Nothing Then
' _ModelNavigation.Index = CLng(_IModelNavigationItem.Index)
'Else
'End If
_uow.CommitChanges()
If _IModelNavigationItem.Items.Count > 0 Then
For Each _IModelNavigationItem_Child In _IModelNavigationItem.Items
RecursiveAddModelNavigation(_uow, _MasterKey, _ModelNavigation, _IModelNavigationItem_Child)
Next
End If
End Sub
Sub RecursiveDeny(_ModelNavigation As ModelNavigation)
Dim _ModelNavigation_Children As ModelNavigation
_ModelNavigation.Navigation_Enabled = False
If _ModelNavigation.Children.Count > 0 Then
For Each _ModelNavigation_Children In _ModelNavigation.Children
RecursiveDeny(_ModelNavigation_Children)
Next
End If
End Sub
Private Sub aRoleActionDisable_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aRoleActionDisable.CustomizePopupWindowParams
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _CS As CollectionSource = New CollectionSource(_onew, GetType(ModelActions))
Dim _ModelActions As ModelActions
Dim _Action As IModelAction
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
_CS.BeginUpdateCriteria()
_CS.Criteria.Add("Filter1", CriteriaOperator.Parse("1=2"))
_CS.EndUpdateCriteria()
For Each _Action In Application.Model.ActionDesign.Actions
If _Action.Controller.Name Like "SIS*" Then
_ModelActions = _onew.CreateObject(Of ModelActions)()
_ModelActions.Action_ID = _Action.Id
_ModelActions.Action_Caption = _Action.Caption
_ModelActions.Action_ImageName = _Action.ImageName
_ModelActions.Action_Controller = _Action.Controller.Name
Dim _ModelActionRole As ModelActionRole = _onew.FindObject(Of ModelActionRole)(CriteriaOperator.Parse("Action_ID=? AND Action_Controller=? AND Role=?", _
_ModelActions.Action_ID, _ModelActions.Action_Controller, _onew.GetObject(_Role)))
If _ModelActionRole IsNot Nothing Then
_ModelActions.Action_Enabled = False
Else
_ModelActions.Action_Enabled = True
End If
_CS.Add(_ModelActions)
End If
Next
e.View = Application.CreateListView("ModelActions_ListView", _CS, False)
End Sub
Private Sub aRoleActionDisable_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aRoleActionDisable.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _Role As Role = TryCast(View.SelectedObjects(0), Role)
If _Role IsNot Nothing Then
For Each _ModelActions As ModelActions In e.PopupWindow.View.SelectedObjects
Dim _ModelActionRole As ModelActionRole = _ocur.FindObject(Of ModelActionRole)(CriteriaOperator.Parse("Action_ID=? AND Action_Controller=? AND Role=?", _
_ModelActions.Action_ID, _ModelActions.Action_Controller, _Role))
If _ModelActionRole Is Nothing Then
_ModelActionRole = New ModelActionRole(_ocur.Session)
With _ModelActionRole
.Role = _Role
.Action_Controller = _ModelActions.Action_Controller
.Action_ID = _ModelActions.Action_ID
End With
End If
Next
End If
_ocur.CommitChanges()
End Sub
End Class
@@ -0,0 +1,36 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports DevExpress.Persistent.Base.Security
Imports DevExpress.Utils
<DefaultClassOptions()> _
Public Class SecuritySystemHelper
Public Shared Function IsUserInRole(ByVal userWithRoles As IUserWithRoles, ByVal roleName As String) As Boolean
'Guard.ArgumentNotNull(userWithRoles, "userWithRoles")
If userWithRoles Is Nothing Then Return True
For Each role As IRole In userWithRoles.Roles
If role.Name = roleName Then
Return True
End If
Next role
Return False
End Function
Public Shared Function IsUserInRoleCurrentUser(ByVal roleName As String) As Boolean
Return IsUserInRole(TryCast(SecuritySystem.CurrentUser, IUserWithRoles), roleName)
End Function
Public Shared Function IsUserInRole(ByVal roleName As String, ByVal user As User) As Boolean
Return IsUserInRole(TryCast(user, IUserWithRoles), roleName)
End Function
Public Shared Function IsUserAdministrator(ByVal simpleUser As ISimpleUser) As Boolean
Guard.ArgumentNotNull(simpleUser, "simpleUser")
Return simpleUser.IsAdministrator
End Function
End Class
+32
View File
@@ -0,0 +1,32 @@
Partial Class TabEnterVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,49 @@
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
Public Class TabEnterVC
Inherits DevExpress.ExpressApp.ViewController(Of DetailView)
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
For Each propertyEditor As PropertyEditor In View.GetItems(Of PropertyEditor)()
AddHandler propertyEditor.ControlCreated, AddressOf propertyEditor_ControlCreated
Next
End Sub
Private Sub propertyEditor_ControlCreated(sender As Object, e As EventArgs)
On Error Resume Next
If TryCast(sender, PropertyEditor) IsNot Nothing Then
If TryCast(sender, PropertyEditor).Control IsNot Nothing Then
If TryCast(TryCast(sender, PropertyEditor).Control, Templates.IFrameTemplate) Is Nothing Then
Dim type As Type = DirectCast(sender, PropertyEditor).Control.GetType
If type.GetProperty("EnterMoveNextControl") IsNot Nothing Then
DirectCast(sender, PropertyEditor).Control.EnterMoveNextControl = True
End If
End If
End If
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
'For Each propertyEditor As PropertyEditor In View.GetItems(Of PropertyEditor)()
' RemoveHandler propertyEditor.ControlCreated, AddressOf propertyEditor_ControlCreated
'Next
End Sub
End Class
@@ -0,0 +1,71 @@
Imports Microsoft.VisualBasic
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
'<Browsable(False)> _
Public Class XmlUser
Inherits BaseObject
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Property User() As DevExpress.Persistent.BaseImpl.User
Get
Return GetPropertyValue(Of DevExpress.Persistent.BaseImpl.User)("User")
End Get
Set(ByVal value As DevExpress.Persistent.BaseImpl.User)
SetPropertyValue("User", value)
End Set
End Property
<VisibleInListView(False)> _
<Association("XmlUser-Aspects"), Aggregated()> _
Public ReadOnly Property Aspects() As XPCollection(Of XmlStore)
Get
Return GetCollection(Of XmlStore)("Aspects")
End Get
End Property
End Class
<NavigationItem(False), CreatableItem(False)> _
Public Class XmlStore
Inherits BaseObject
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
<Association("XmlUser-Aspects")> _
Public Property User() As XmlUser
Get
Return GetPropertyValue(Of XmlUser)("User")
End Get
Set(ByVal value As XmlUser)
SetPropertyValue("User", value)
End Set
End Property
Public Property Aspect() As String
Get
Return GetPropertyValue(Of String)("Aspect")
End Get
Set(ByVal value As String)
SetPropertyValue("Aspect", value)
End Set
End Property
<Size(SizeAttribute.Unlimited)> _
Public Property XmlData() As String
Get
Return GetPropertyValue(Of String)("XmlData")
End Get
Set(ByVal value As String)
SetPropertyValue("XmlData", value)
End Set
End Property
End Class
@@ -0,0 +1,23 @@
Partial Class UserViewVariantsController
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
End Sub
End Class
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,180 @@
Imports DevExpress.ExpressApp
Public Class UserViewVariantsController
Inherits ViewController
'Private Const STR_HasViewVariants_EnabledKey As String = "HasViewVariants"
'Private Const STR_IsRootViewVariant_EnabledKey As String = "IsRootViewVariant"
'Private Const STR_NewViewVariant_Id As String = "NewViewVariant"
'Private Const STR_DeleteViewVariant_Id As String = "DeleteViewVariant"
'Private Const STR_EditViewVariant_Id As String = "EditViewVariant"
'Private Const STR_UserViewVariants_Image As String = "Action_Copy"
'Private Const STR_NewViewVariant_Image As String = "Action_New"
'Private Const STR_DeleteViewVariant_Image As String = "Action_Delete"
'Private Const STR_EditViewVariant_Image As String = "Action_Edit"
'Private Const STR_UserViewVariants_Id As String = "UserViewVariants"
'Private ReadOnly userViewVariantsCore As SingleChoiceAction
''Protected changeVariantMainWindowController As ChangeVariantMainWindowController
'Protected changeVariantController As ChangeVariantController
'Protected rootModelViewVariants As IModelList(Of IModelVariant)
'Private modelViews As IModelList(Of IModelView)
Public Sub New()
'userViewVariantsCore = New SingleChoiceAction(Me, STR_UserViewVariants_Id, PredefinedCategory.View) With {.ImageName = STR_UserViewVariants_Image, .PaintStyle = ActionItemPaintStyle.CaptionAndImage, .Caption = CaptionHelper.ConvertCompoundName(STR_UserViewVariants_Id), .ItemType = SingleChoiceActionItemType.ItemIsOperation, .ShowItemsOnClick = True}
'Dim addViewVariantItem As New ChoiceActionItem(STR_NewViewVariant_Id, CaptionHelper.ConvertCompoundName(STR_NewViewVariant_Id), STR_NewViewVariant_Id) With {.ImageName = STR_NewViewVariant_Image}
'Dim removeViewVariantItem As New ChoiceActionItem(STR_DeleteViewVariant_Id, CaptionHelper.ConvertCompoundName(STR_DeleteViewVariant_Id), STR_DeleteViewVariant_Id) With {.ImageName = STR_DeleteViewVariant_Image}
'Dim editViewVariantItem As New ChoiceActionItem(STR_EditViewVariant_Id, CaptionHelper.ConvertCompoundName(STR_EditViewVariant_Id), STR_EditViewVariant_Id) With {.ImageName = STR_EditViewVariant_Image}
'userViewVariantsCore.Items.Add(addViewVariantItem)
'userViewVariantsCore.Items.Add(editViewVariantItem)
'userViewVariantsCore.Items.Add(removeViewVariantItem)
'AddHandler userViewVariantsCore.Execute, AddressOf UserViewVariants_Execute
End Sub
' Private Sub UserViewVariants_Execute(ByVal sender As Object, ByVal e As SingleChoiceActionExecuteEventArgs)
' UserViewVariants(e)
' End Sub
' Protected Overridable Sub UserViewVariants(ByVal e As SingleChoiceActionExecuteEventArgs)
' Dim data As String = Convert.ToString(e.SelectedChoiceActionItem.Data)
' If data = STR_NewViewVariant_Id OrElse data = STR_EditViewVariant_Id Then
' ShowViewVariantParameterDialog(e, data)
' ElseIf data = STR_DeleteViewVariant_Id Then
' DeleteViewVariant()
' End If
' End Sub
' Protected Overloads Overrides Sub OnActivated()
' MyBase.OnActivated()
' 'Initialize()
' 'UpdateUserViewVariantsAction()
' End Sub
' Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
' 'If disposing Then
' ' UnsubscribeFromEvents()
' 'End If
' MyBase.Dispose(disposing)
' End Sub
' Private Sub UnsubscribeFromEvents()
' RemoveHandler userViewVariantsCore.Execute, AddressOf UserViewVariants_Execute
' If changeVariantController IsNot Nothing AndAlso changeVariantController.ChangeVariantAction IsNot Nothing Then
' RemoveHandler changeVariantController.ChangeVariantAction.Execute, AddressOf ChangeVariantAction_Executed
' End If
' End Sub
' Private Sub Initialize()
' changeVariantMainWindowController = Frame.GetController(Of ChangeVariantMainWindowController)()
' changeVariantController = Frame.GetController(Of ChangeVariantController)()
' AddHandler changeVariantController.ChangeVariantAction.Executed, AddressOf ChangeVariantAction_Executed
' modelViews = CType(View.Model.Application.Views, IModelList(Of IModelView))
' rootModelViewVariants = CType((CType(modelViews(GetRootViewId()), IModelViewVariants)).Variants, IModelList(Of IModelVariant))
' End Sub
' Private Sub ChangeVariantAction_Executed(ByVal sender As Object, ByVal e As ActionBaseEventArgs)
' UpdateUserViewVariantsAction()
' End Sub
' Private Function GetRootViewId() As String
' Dim variantsInfo As VariantsInfo = changeVariantMainWindowController.GetVariants(View)
' Return If(variantsInfo IsNot Nothing, variantsInfo.RootViewId, View.Id)
' End Function
' Protected Overridable Sub ShowViewVariantParameterDialog(ByVal e As SingleChoiceActionExecuteEventArgs, ByVal mode As String)
' Dim viewCaption As String = String.Empty
' Dim parameter As New ViewVariantParameterObject(rootModelViewVariants)
' If mode = STR_NewViewVariant_Id Then
' parameter.Caption = String.Format("{0}_{1:g}", View.Caption, DateTime.Now)
' viewCaption = CaptionHelper.GetLocalizedText("Texts", "NewViewVariantParameterCaption")
' End If
' If mode = STR_EditViewVariant_Id AndAlso changeVariantController.ChangeVariantAction.SelectedItem IsNot Nothing Then
' parameter.Caption = changeVariantController.ChangeVariantAction.SelectedItem.Caption
' viewCaption = CaptionHelper.GetLocalizedText("Texts", "EditViewVariantParameterCaption")
' End If
' Dim dialogController As DialogController = Application.CreateController(Of DialogController)()
' AddHandler dialogController.Accepting, AddressOf dialogController_Accepting
' dialogController.Tag = mode
' Dim dv As DetailView = Application.CreateDetailView(ObjectSpaceInMemory.CreateNew(), parameter, False)
' dv.ViewEditMode = ViewEditMode.Edit
' dv.Caption = viewCaption
' e.ShowViewParameters.CreatedView = dv
' e.ShowViewParameters.Controllers.Add(dialogController)
' e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow
' End Sub
' Protected Sub dialogController_Accepting(ByVal sender As Object, ByVal e As DialogControllerAcceptingEventArgs)
' Dim dialogController As DialogController = CType(sender, DialogController)
' RemoveHandler dialogController.Accepting, AddressOf dialogController_Accepting
' Dim data As String = Convert.ToString(dialogController.Tag)
' Dim parameter As ViewVariantParameterObject = TryCast(dialogController.Window.View.CurrentObject, ViewVariantParameterObject)
' If data = STR_NewViewVariant_Id Then
' NewViewVariant(parameter)
' ElseIf data = STR_EditViewVariant_Id Then
' EditViewVariant(parameter)
' End If
' End Sub
' Protected Overridable Sub NewViewVariant(ByVal parameter As ViewVariantParameterObject)
' 'It is necessary to save the current View settings into the application model before copying them.
' View.SynchronizeInfo()
' 'Identifier of a new view variant will be based on the identifier of the root view variant.
' Dim newViewVariantId As String = String.Format("{0}_{1}", GetRootViewId(), Guid.NewGuid())
' ' Adds a new child node of the IModelVariant type with a specific identifier to the parent IModelViewVariants node.
' Dim newModelViewVariant As IModelVariant = (CType(rootModelViewVariants, ModelNode)).AddNode(Of IModelVariant)(newViewVariantId)
' ' Creates a new node of the IModelView type by cloning the settings of the current View and then sets the clone to the View property of the view variant created above.
' newModelViewVariant.View = TryCast((CType(modelViews, ModelNode)).AddClonedNode(CType(View.Model, ModelNode), newViewVariantId), IModelView)
' 'Sets the Caption property of the view variant created above to the caption specified by an end-user in the dialog.
' newModelViewVariant.Caption = parameter.Caption
' 'It is necessary to add a default view variant node for the current View for correct operation of the Change Variant Action.
' If rootModelViewVariants.Count = 1 Then
' Dim currentModelViewVariant As IModelVariant = (CType(rootModelViewVariants, ModelNode)).AddNode(Of IModelVariant)(View.Id)
' currentModelViewVariant.Caption = CaptionHelper.GetLocalizedText("Texts", "DefaultViewVariantCaption")
' currentModelViewVariant.View = View.Model
' End If
' 'Updates the Change Variant Action structure based on the model customizations above.
' changeVariantController.RefreshVariantsAction()
' 'Sets the current view variant to the newly created one.
' UpdateCurrentViewVariant(True)
' 'Updates the items of our User View Variant Action based on the current the Change Variant Action structure.
' UpdateUserViewVariantsAction()
' End Sub
' 'This method does almost the same work as NewViewVariant, but in reverse order.
' Protected Overridable Sub DeleteViewVariant()
' Dim variantsInfo As VariantsInfo = GetVariantsInfo()
' 'You should not be able to remove the root view variant.
' If variantsInfo IsNot Nothing AndAlso variantsInfo.CurrentVariantId <> GetRootViewId() Then
' UpdateCurrentViewVariant(False)
' rootModelViewVariants.Remove(rootModelViewVariants(variantsInfo.CurrentVariantId))
' modelViews.Remove(modelViews(variantsInfo.CurrentVariantId))
' changeVariantController.RefreshVariantsAction()
' UpdateUserViewVariantsAction()
' End If
' If rootModelViewVariants.Count = 1 Then
' CType(rootModelViewVariants, ModelNode).Undo()
' End If
' End Sub
' Protected Overridable Sub EditViewVariant(ByVal parameter As ViewVariantParameterObject)
' Dim variantsInfo As VariantsInfo = GetVariantsInfo()
' If variantsInfo IsNot Nothing Then
' rootModelViewVariants(variantsInfo.CurrentVariantId).Caption = parameter.Caption
' End If
' changeVariantController.RefreshVariantsAction()
' End Sub
' Private Sub UpdateCurrentViewVariant(ByVal isNew As Boolean)
' Dim action As SingleChoiceAction = changeVariantController.ChangeVariantAction
' If (Not isNew) AndAlso action.Items.Count > 1 Then
' action.DoExecute(action.Items(action.Items.Count - 2))
' End If
' If isNew AndAlso action.Items.Count > 0 Then
' action.DoExecute(action.Items(action.Items.Count - 1))
' End If
' End Sub
' Private Sub UpdateUserViewVariantsAction()
' Dim hasViewVariants As Boolean = changeVariantController.ChangeVariantAction.Items.Count > 0
' UserViewVarintsAction.Items.FindItemByID(STR_EditViewVariant_Id).Enabled(STR_HasViewVariants_EnabledKey) = hasViewVariants
' UserViewVarintsAction.Items.FindItemByID(STR_DeleteViewVariant_Id).Enabled(STR_HasViewVariants_EnabledKey) =
'UserViewVarintsAction.Items.FindItemByID(STR_EditViewVariant_Id).Enabled(STR_HasViewVariants_EnabledKey)
' If changeVariantController.ChangeVariantAction.SelectedItem IsNot Nothing Then
' Dim variantInfo As VariantInfo = CType(changeVariantController.ChangeVariantAction.SelectedItem.Data, VariantInfo)
' UserViewVarintsAction.Items.FindItemByID(STR_DeleteViewVariant_Id).Enabled(STR_IsRootViewVariant_EnabledKey) = variantInfo.ViewID <> GetRootViewId()
' End If
' End Sub
' Private Function GetVariantsInfo() As VariantsInfo
' Return changeVariantMainWindowController.GetVariants(GetRootViewId())
' End Function
' Public ReadOnly Property UserViewVarintsAction() As SingleChoiceAction
' Get
' Return userViewVariantsCore
' End Get
' End Property
End Class
@@ -0,0 +1,40 @@
Imports Microsoft.VisualBasic
Imports System
Imports System.ComponentModel
Imports DevExpress.ExpressApp.DC
Imports DevExpress.ExpressApp.Model
Imports DevExpress.Persistent.Validation
Imports DevExpress.ExpressApp.ViewVariantsModule
<DomainComponent(), DefaultProperty("Caption")> _
Public Class ViewVariantParameterObject
Private ReadOnly variants As IModelList(Of IModelVariant)
Public Sub New(ByVal variants As IModelList(Of IModelVariant))
Me.variants = variants
End Sub
<RuleFromBoolProperty("RuleFromBoolProperty_ViewVariantParameterObject.IsUniqueCaption", "AddViewVariantContext", UsedProperties:="Caption", CustomMessageTemplate:="You must specify a different value, because there is already a view variant with the same caption."), Browsable(False)> _
Public ReadOnly Property IsUniqueCaption() As Boolean
Get
Dim ok As Boolean = True
For Each [variant] As IModelVariant In variants
If [variant].Caption = Caption Then
ok = False
Exit For
End If
Next [variant]
Return ok
End Get
End Property
Private privateCaption As String
<RuleRequiredField("RuleRequiredField_ViewVariantParameterObject.Caption", "AddViewVariantContext")> _
Public Property Caption() As String
Get
Return privateCaption
End Get
Set(ByVal value As String)
privateCaption = value
End Set
End Property
End Class