This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.vb
64 lines (57 loc) · 2.59 KB
/
Program.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Imports Microsoft.VisualBasic
Imports System
Imports System.Configuration
Imports System.Windows.Forms
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Security
Imports DevExpress.ExpressApp.Win
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.AuditTrail
Imports System.Security.Principal
Imports AuditDemo.Module
Namespace AuditDemo.Win
Friend NotInheritable Class Program
'private static void WinApplication_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs args) {
' args.Updater.Update();
' args.Handled = true;
'}
'/// <summary>
'/// The main entry point for the application.
'/// </summary>
Private Sub New()
End Sub
<STAThread> _
Shared Sub Main()
application.EnableVisualStyles()
application.SetCompatibleTextRenderingDefault(False)
EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached
Dim winApplication As New AuditDemoWindowsFormsApplication()
If ConfigurationManager.ConnectionStrings("ConnectionString") IsNot Nothing Then
winApplication.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
End If
Try
'default time stamping strategy
Dim timestampStrategy As IAuditTimestampStrategy = New LocalAuditTimestampStrategy()
'////////////////////////////////////////////////////////////////
'You can use server-side time stamping for audit log
'////////////////////////////////////////////////////////////////
'Uncomment statement below to use WebService time stamps
' IAuditTimestampStrategy timestampStrategy = new WebServiceTimestampStrategy();
'Uncomment statement below to use MSSqlServer time stamps
' IAuditTimestampStrategy timestampStrategy = new MSSqlServerTimestampStrategy();
AuditTrailService.Instance.TimestampStrategy = timestampStrategy
AddHandler AuditTrailService.Instance.QueryCurrentUserName, AddressOf Instance_QueryCurrentUserName
DevExpress.ExpressApp.Xpo.InMemoryDataStoreProvider.Register()
winApplication.ConnectionString = DevExpress.ExpressApp.Xpo.InMemoryDataStoreProvider.ConnectionString
winApplication.Setup()
winApplication.Start()
Catch e As Exception
winApplication.HandleException(e)
End Try
End Sub
Private Shared Sub Instance_QueryCurrentUserName(ByVal sender As Object, ByVal e As QueryCurrentUserNameEventArgs)
e.CurrentUserName = WindowsIdentity.GetCurrent().Name
End Sub
End Class
End Namespace