First create solution

This commit is contained in:
2017-03-08 11:21:27 +01:00
commit a2fb86bacf
5508 changed files with 1082238 additions and 0 deletions
@@ -0,0 +1,59 @@
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Model
Public Module LockingModule
Public Function LockObject(_Paramuow As UnitOfWork, _ParamObjectType As Type, _ParamObjectKey As String, _ParamUser As User) As Boolean
Dim _IsLocked As Boolean = False
Dim _TableName As String
Dim _LockingObject As LockingObject
Try
_TableName = _ParamObjectType.Name & "-" & _ParamObjectKey
_LockingObject = New LockingObject(_Paramuow)
_LockingObject.TableName = _TableName
_LockingObject.User = _Paramuow.GetObjectByKey(Of User)(_ParamUser.Oid)
_LockingObject.ObjectKey = _ParamObjectKey
_LockingObject.ObjectType = _ParamObjectType
_LockingObject.ObjectCreated = Now
_LockingObject.SessionCreated = _Paramuow.ToString
_Paramuow.CommitChanges()
_LockingObject = _Paramuow.FindObject(Of LockingObject)(PersistentCriteriaEvaluationBehavior.InTransaction, _
CriteriaOperator.Parse("TableName=? and User=? and SessionCreated=?", _TableName, _Paramuow.GetObjectByKey(Of User)(_ParamUser.Oid), _Paramuow.ToString))
If _LockingObject IsNot Nothing Then
_IsLocked = True
End If
Catch ex As Exception
_IsLocked = False
End Try
Return _IsLocked
End Function
Public Function UnLockObject(_Paramuow As UnitOfWork, _ParamObjectType As Type, _ParamObjectKey As String, _ParamUser As User) As Boolean
Dim _TableName As String = _ParamObjectType.Name & "-" & _ParamObjectKey
Dim _LockingObject As LockingObject = _Paramuow.FindObject(Of LockingObject)(PersistentCriteriaEvaluationBehavior.InTransaction, _
CriteriaOperator.Parse("TableName=? AND User=? AND ObjectKey=?", _TableName, _Paramuow.GetObjectByKey(Of DevExpress.Persistent.BaseImpl.User)(_ParamUser.Oid), _ParamObjectKey))
If _LockingObject IsNot Nothing Then
_Paramuow.Delete(_LockingObject)
_Paramuow.CommitChanges()
End If
End Function
Public Function ReleaseAllLocking(_Paramuow As UnitOfWork, _Paramuser As User) As Boolean
Dim _LockingObject_Collection As New XPCollection(Of LockingObject)(_Paramuow, CriteriaOperator.Parse("User.Oid=?", _Paramuser.Oid))
Dim _IsUnlocked As Boolean = False
Try
_Paramuow.Delete(_LockingObject_Collection)
_Paramuow.CommitChanges()
_LockingObject_Collection = New XPCollection(Of LockingObject)(_Paramuow, CriteriaOperator.Parse("User.Oid=?", _Paramuser.Oid))
If _LockingObject_Collection.Count = 0 Then
_IsUnlocked = True
End If
Catch ex As Exception
_IsUnlocked = False
End Try
Return _IsUnlocked
End Function
End Module
@@ -0,0 +1,87 @@
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 LockingObject
Inherits BaseObject
Private _TableName As String
Private _User As User
Private _ObjectType As Type
Private _ObjectKey As String
Private _ObjectCreated As Date
Private _SessionCreated 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
<Size(255), Indexed(Unique:=True)> _
Property TableName As String
Get
Return _TableName
End Get
Set(value As String)
SetPropertyValue("TableName", _TableName, value)
End Set
End Property
Property User As User
Get
Return _User
End Get
Set(value As User)
SetPropertyValue("User", _User, value)
End Set
End Property
Property ObjectType As Type
Get
Return _ObjectType
End Get
Set(value As Type)
SetPropertyValue("ObjectType", _ObjectType, value)
End Set
End Property
Property ObjectKey As String
Get
Return _ObjectKey
End Get
Set(value As String)
SetPropertyValue("ObjectKey", _ObjectKey, value)
End Set
End Property
Property ObjectCreated As Date
Get
Return _ObjectCreated
End Get
Set(value As Date)
SetPropertyValue("ObjectCreated", _ObjectCreated, value)
End Set
End Property
<Size(-1)> _
Property SessionCreated As String
Get
Return _SessionCreated
End Get
Set(value As String)
SetPropertyValue("SessionCreated", _SessionCreated, value)
End Set
End Property
End Class