First create solution
This commit is contained in:
+71
@@ -0,0 +1,71 @@
|
||||
Partial Class SubcontractorVC
|
||||
|
||||
<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.aSubcontractorNavigationEnable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aSubcontractorNavigationDisable = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aSubcontractorDocuments_OpenDashboardWithViewer = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
|
||||
'
|
||||
'aSubcontractorNavigationEnable
|
||||
'
|
||||
Me.aSubcontractorNavigationEnable.AcceptButtonCaption = Nothing
|
||||
Me.aSubcontractorNavigationEnable.CancelButtonCaption = Nothing
|
||||
Me.aSubcontractorNavigationEnable.Caption = "aSubcontractor Navigation Enable"
|
||||
Me.aSubcontractorNavigationEnable.ConfirmationMessage = Nothing
|
||||
Me.aSubcontractorNavigationEnable.Id = "aSubcontractorNavigationEnable"
|
||||
Me.aSubcontractorNavigationEnable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
|
||||
Me.aSubcontractorNavigationEnable.TargetObjectType = GetType(Nuvolar.[Module].SubcontractorRoles)
|
||||
Me.aSubcontractorNavigationEnable.ToolTip = Nothing
|
||||
'
|
||||
'aSubcontractorNavigationDisable
|
||||
'
|
||||
Me.aSubcontractorNavigationDisable.AcceptButtonCaption = Nothing
|
||||
Me.aSubcontractorNavigationDisable.CancelButtonCaption = Nothing
|
||||
Me.aSubcontractorNavigationDisable.Caption = "aSubcontractor Navigation Disable"
|
||||
Me.aSubcontractorNavigationDisable.ConfirmationMessage = Nothing
|
||||
Me.aSubcontractorNavigationDisable.Id = "aSubcontractorNavigationDisable"
|
||||
Me.aSubcontractorNavigationDisable.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
|
||||
Me.aSubcontractorNavigationDisable.TargetObjectType = GetType(Nuvolar.[Module].SubcontractorRoles)
|
||||
Me.aSubcontractorNavigationDisable.ToolTip = Nothing
|
||||
'
|
||||
'aSubcontractorDocuments_OpenDashboardWithViewer
|
||||
'
|
||||
Me.aSubcontractorDocuments_OpenDashboardWithViewer.Caption = "aSubcontractorDocuments_OpenDashboardWithViewer"
|
||||
Me.aSubcontractorDocuments_OpenDashboardWithViewer.ConfirmationMessage = Nothing
|
||||
Me.aSubcontractorDocuments_OpenDashboardWithViewer.Id = "aSubcontractorDocuments_OpenDashboardWithViewer"
|
||||
Me.aSubcontractorDocuments_OpenDashboardWithViewer.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
|
||||
Me.aSubcontractorDocuments_OpenDashboardWithViewer.TargetObjectsCriteria = "IsDashboard = True"
|
||||
Me.aSubcontractorDocuments_OpenDashboardWithViewer.TargetViewId = "SubcontractorDocuments_ListView"
|
||||
Me.aSubcontractorDocuments_OpenDashboardWithViewer.ToolTip = Nothing
|
||||
|
||||
End Sub
|
||||
Friend WithEvents aSubcontractorNavigationEnable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Friend WithEvents aSubcontractorNavigationDisable As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Friend WithEvents aSubcontractorDocuments_OpenDashboardWithViewer As DevExpress.ExpressApp.Actions.SimpleAction
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,132 @@
|
||||
<?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="aSubcontractorNavigationEnable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 56</value>
|
||||
</metadata>
|
||||
<metadata name="aSubcontractorNavigationDisable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 95</value>
|
||||
</metadata>
|
||||
<metadata name="aSubcontractorDocuments_OpenDashboardWithViewer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>247, 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,326 @@
|
||||
Imports System
|
||||
Imports System.ComponentModel
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Diagnostics
|
||||
Imports System.Text
|
||||
|
||||
Imports DevExpress.ExpressApp
|
||||
Imports DevExpress.ExpressApp.Actions
|
||||
Imports DevExpress.Persistent.Base
|
||||
Imports DevExpress.Xpo
|
||||
Imports DevExpress.Data.Filtering
|
||||
Imports DevExpress.ExpressApp.SystemModule
|
||||
Imports DevExpress.ExpressApp.Web.SystemModule
|
||||
|
||||
Public Class SubcontractorVC
|
||||
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 View.Id Like "SubcontractorRoles_ListView_Subcontractor" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", False)
|
||||
End If
|
||||
If View.Id = "WorkSheet_Header_ListView_Subcontractor" Or _
|
||||
View.Id = "WorkSheet_Header_ListView_Subcontractor_Closed" Or _
|
||||
View.Id = "WorkSheet_Header_ListView_Subcontractor_Ready" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", False)
|
||||
End If
|
||||
If View.Id = "CRM_Opportunities_ListView_Subcontractor" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", False)
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
Dim _Contacts As Contacts = _ocur.FindObject(Of Contacts)(CriteriaOperator.Parse("User = ?", _ocur.GetObject(SecuritySystem.CurrentUser)))
|
||||
|
||||
If _Contacts IsNot Nothing Then
|
||||
If _Contacts.Customers IsNot Nothing Then
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("Customers.Oid = ?", _Contacts.Customers.Oid)
|
||||
Else
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("1=2")
|
||||
End If
|
||||
Else
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("1=2")
|
||||
End If
|
||||
End If
|
||||
If View.Id = "Contracts_ListView_Subcontractor" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", False)
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
Dim _Contacts As Contacts = _ocur.FindObject(Of Contacts)(CriteriaOperator.Parse("User = ?", _ocur.GetObject(SecuritySystem.CurrentUser)))
|
||||
|
||||
If _Contacts IsNot Nothing Then
|
||||
If _Contacts.Customers IsNot Nothing Then
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("Customers.Oid = ?", _Contacts.Customers.Oid)
|
||||
Else
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("1=2")
|
||||
End If
|
||||
Else
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("1=2")
|
||||
End If
|
||||
End If
|
||||
If View.Id = "OfferInHeader_ListView_Subcontractor" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", False)
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
Dim _Contacts As Contacts = _ocur.FindObject(Of Contacts)(CriteriaOperator.Parse("User = ?", _ocur.GetObject(SecuritySystem.CurrentUser)))
|
||||
|
||||
If _Contacts IsNot Nothing Then
|
||||
If _Contacts.Customers IsNot Nothing Then
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("Customers.Oid = ?", _Contacts.Customers.Oid)
|
||||
Else
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("1=2")
|
||||
End If
|
||||
Else
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("1=2")
|
||||
End If
|
||||
End If
|
||||
If View.Id = "RegistryHeader_ListView_Subcontractor" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", False)
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
Dim _Contacts As Contacts = _ocur.FindObject(Of Contacts)(CriteriaOperator.Parse("User = ?", _ocur.GetObject(SecuritySystem.CurrentUser)))
|
||||
|
||||
If _Contacts IsNot Nothing Then
|
||||
If _Contacts.Customers IsNot Nothing Then
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("Customers.Oid = ? AND RegistryType.RegistryCRMType = 2", _Contacts.Customers.Oid)
|
||||
Else
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("1=2")
|
||||
End If
|
||||
Else
|
||||
TryCast(View, ListView).CollectionSource.Criteria("ByPartner") = CriteriaOperator.Parse("1=2")
|
||||
End If
|
||||
End If
|
||||
If View.Id = "SubcontractorDocuments_ListView" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", False)
|
||||
End If
|
||||
End Sub
|
||||
Protected Overrides Sub OnDeactivated()
|
||||
MyBase.OnDeactivated()
|
||||
If View.Id Like "SubcontractorRoles_ListView_Subcontractor" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", True)
|
||||
End If
|
||||
If View.Id = "WorkSheet_Header_ListView_Subcontractor" Or _
|
||||
View.Id = "WorkSheet_Header_ListView_Subcontractor_Closed" Or _
|
||||
View.Id = "WorkSheet_Header_ListView_Subcontractor_Ready" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", True)
|
||||
End If
|
||||
If View.Id = "CRM_Opportunities_ListView_Subcontractor" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", True)
|
||||
End If
|
||||
If View.Id = "Contracts_ListView_Subcontractor" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", True)
|
||||
End If
|
||||
If View.Id = "OfferInHeader_ListView_Subcontractor" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", True)
|
||||
End If
|
||||
If View.Id = "SubcontractorDocuments_ListView" Then
|
||||
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", True)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub aSubcontractorNavigationDisable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aSubcontractorNavigationDisable.CustomizePopupWindowParams
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
|
||||
Dim _MasterKey As Guid = SecuritySystem.CurrentUserId
|
||||
|
||||
Dim _ModelNavigation_Collection As New XPCollection(Of ModelNavigation)(_uow, CriteriaOperator.Parse("MasterKey=?", _MasterKey))
|
||||
_uow.Delete(_ModelNavigation_Collection)
|
||||
_uow.CommitChanges()
|
||||
|
||||
If View.SelectedObjects.Count = 1 Then
|
||||
Dim _SubcontractorRoles As SubcontractorRoles = TryCast(View.SelectedObjects(0), SubcontractorRoles)
|
||||
If _SubcontractorRoles IsNot Nothing Then
|
||||
Dim _NavigationItemRole_Collection As New XPCollection(Of NavigationItemRole)(_onew.Session, CriteriaOperator.Parse("SubcontractorRoles.Oid=?", _SubcontractorRoles.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 _SubcontractorRoles IsNot Nothing Then
|
||||
e.View.Caption += " (" & _SubcontractorRoles.ShortName & ")"
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub aSubcontractorNavigationDisable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aSubcontractorNavigationDisable.Execute
|
||||
Dim _ModelNavigation As ModelNavigation
|
||||
Dim _NavigationItemRole As NavigationItemRole
|
||||
Dim _ocur As IObjectSpace = View.ObjectSpace
|
||||
|
||||
Dim _SubcontractorRoles As SubcontractorRoles
|
||||
|
||||
For Each _SubcontractorRoles In View.SelectedObjects
|
||||
For Each _ModelNavigation In e.PopupWindow.View.SelectedObjects
|
||||
_NavigationItemRole = _ocur.FindObject(Of NavigationItemRole)(CriteriaOperator.Parse("SubcontractorRoles.Oid=? and ChoiceActionItemId=?", _SubcontractorRoles.Oid, _ModelNavigation.Name))
|
||||
If _NavigationItemRole Is Nothing Then
|
||||
_NavigationItemRole = _ocur.CreateObject(Of NavigationItemRole)()
|
||||
_NavigationItemRole.SubcontractorRoles = _ocur.GetObject(_SubcontractorRoles)
|
||||
_NavigationItemRole.ChoiceActionItemId = _ModelNavigation.Name
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
End Sub
|
||||
|
||||
Private Sub aSubcontractorNavigationEnable_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aSubcontractorNavigationEnable.CustomizePopupWindowParams
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
|
||||
Dim _MasterKey As Guid = SecuritySystem.CurrentUserId
|
||||
|
||||
Dim _ModelNavigation_Collection As New XPCollection(Of ModelNavigation)(_uow, CriteriaOperator.Parse("MasterKey=?", _MasterKey))
|
||||
_uow.Delete(_ModelNavigation_Collection)
|
||||
_uow.CommitChanges()
|
||||
|
||||
If View.SelectedObjects.Count = 1 Then
|
||||
Dim _SubcontractorRoles As SubcontractorRoles = TryCast(View.SelectedObjects(0), SubcontractorRoles)
|
||||
If _SubcontractorRoles IsNot Nothing Then
|
||||
Dim _NavigationItemRole_Collection As New XPCollection(Of NavigationItemRole)(_onew.Session, CriteriaOperator.Parse("SubcontractorRoles.Oid=?", _SubcontractorRoles.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 _SubcontractorRoles IsNot Nothing Then
|
||||
e.View.Caption += " (" & _SubcontractorRoles.ShortName & ")"
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub aSubcontractorNavigationEnable_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aSubcontractorNavigationEnable.Execute
|
||||
Dim _ModelNavigation As ModelNavigation
|
||||
Dim _NavigationItemRole As NavigationItemRole
|
||||
Dim _ocur As IObjectSpace = View.ObjectSpace
|
||||
|
||||
Dim _SubcontractorRoles As SubcontractorRoles
|
||||
|
||||
For Each _SubcontractorRoles In View.SelectedObjects
|
||||
For Each _ModelNavigation In e.PopupWindow.View.SelectedObjects
|
||||
_NavigationItemRole = _ocur.FindObject(Of NavigationItemRole)(CriteriaOperator.Parse("SubcontractorRoles.Oid=? and ChoiceActionItemId=?", _SubcontractorRoles.Oid, _ModelNavigation.Name))
|
||||
If _NavigationItemRole IsNot Nothing Then
|
||||
_ocur.Delete(_NavigationItemRole)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
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 aSubcontractorDocuments_OpenDashboardWithViewer_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aSubcontractorDocuments_OpenDashboardWithViewer.Execute
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
Dim _SubcontractorDocuments As SubcontractorDocuments = TryCast(View.SelectedObjects(0), SubcontractorDocuments)
|
||||
|
||||
If _SubcontractorDocuments IsNot Nothing Then
|
||||
Dim _FileName As String = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetTempPath, _SubcontractorDocuments.File.FileName)
|
||||
Dim _StreamFile As System.IO.Stream = New System.IO.FileStream(_FileName, System.IO.FileMode.Create, System.IO.FileAccess.Write)
|
||||
_SubcontractorDocuments.File.SaveToStream(_StreamFile)
|
||||
_StreamFile.Close()
|
||||
|
||||
If IO.File.Exists(_FileName) Then
|
||||
GLOBAL_DASHBOARD_XML_DashboardXmlFile = _FileName
|
||||
GLOBAL_DASHBOARD_XML_UserName = _SubcontractorDocuments.XML_UserName
|
||||
GLOBAL_DASHBOARD_XML_Password = _SubcontractorDocuments.XML_Password
|
||||
GLOBAL_DASHBOARD_XML_ServerName = _SubcontractorDocuments.XML_ServerName
|
||||
GLOBAL_DASHBOARD_XML_DatabaseName = _SubcontractorDocuments.XML_DatabaseName
|
||||
Select Case _SubcontractorDocuments.XML_SqlType
|
||||
Case eSQLType.MSSQL
|
||||
GLOBAL_DASHBOARD_XML_SQLType = "MSSQL"
|
||||
Case eSQLType.MySQL
|
||||
GLOBAL_DASHBOARD_XML_SQLType = "MYSQL"
|
||||
Case eSQLType.PostgreSQL
|
||||
GLOBAL_DASHBOARD_XML_SQLType = "PSQL"
|
||||
End Select
|
||||
|
||||
DevExpress.ExpressApp.Web.WebWindow.CurrentRequestWindow.RegisterStartupScript("ShowCustomFormScriptKey", String.Format("window.open('{0}');", "Controls/DashboardViewer.aspx"))
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user