125 lines
5.4 KiB
VB.net
125 lines
5.4 KiB
VB.net
Imports Microsoft.VisualBasic
|
|
Imports System
|
|
Imports System.Collections.Generic
|
|
Imports System.ComponentModel
|
|
Imports DevExpress.ExpressApp.Win
|
|
Imports SISBusiness.Module.Win
|
|
Imports DevExpress.ExpressApp
|
|
Imports DevExpress.Xpo
|
|
Imports DevExpress.Data.Filtering
|
|
Imports DevExpress.XtraBars.Alerter
|
|
Imports DevExpress.ExpressApp.Utils
|
|
Imports DevExpress.ExpressApp.Xpo
|
|
Imports SISBusiness.Module.GeneralFunction
|
|
Imports System.Data.SqlClient
|
|
Imports System.IO
|
|
Imports System.Net
|
|
Imports Newtonsoft.Json
|
|
Imports SISBusiness.Module
|
|
Imports System.Text
|
|
|
|
Partial Public Class SISBusinessWindowsFormsApplication
|
|
Inherits WinApplication
|
|
Public Sub New()
|
|
InitializeComponent()
|
|
End Sub
|
|
|
|
Private Sub SISBusinessWindowsFormsApplication_DatabaseVersionMismatch(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs) Handles MyBase.DatabaseVersionMismatch
|
|
|
|
e.Updater.Update()
|
|
e.Handled = True
|
|
End Sub
|
|
Protected Overrides Function GetTraceLogDirectory() As String
|
|
Return MyBase.GetTraceLogDirectory()
|
|
End Function
|
|
Protected Overrides Function CreateLogonWindowControllers() As System.Collections.Generic.List(Of DevExpress.ExpressApp.Controller)
|
|
Dim _result As System.Collections.Generic.List(Of DevExpress.ExpressApp.Controller)
|
|
Dim _CreateLogonWindowsControllerVC As New CreateLogonWindowsControllerVC
|
|
_result = MyBase.CreateLogonWindowControllers()
|
|
_result.Add(_CreateLogonWindowsControllerVC)
|
|
Return _result
|
|
End Function
|
|
Protected Overrides Sub CreateDefaultObjectSpaceProvider(args As CreateCustomObjectSpaceProviderEventArgs)
|
|
args.ObjectSpaceProvider = New XPObjectSpaceProvider(args.ConnectionString, args.Connection, True)
|
|
End Sub
|
|
Protected Overrides Sub OnLoggedOn(args As DevExpress.ExpressApp.LogonEventArgs)
|
|
MyBase.OnLoggedOn(args)
|
|
Dim _onew As Xpo.XPObjectSpace = Me.ObjectSpaceProvider.CreateObjectSpace()
|
|
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
|
|
Dim _User As DevExpress.Persistent.BaseImpl.User = _onew.FindObject(Of DevExpress.Persistent.BaseImpl.User)(CriteriaOperator.Parse("Oid=?", SecuritySystem.CurrentUserId))
|
|
SISBusiness.Module.LockingModule.ReleaseAllLocking(_uow, _User)
|
|
|
|
'// Itt sikeres a belépés !!!
|
|
SISPushInfoSSL()
|
|
End Sub
|
|
Protected Overrides Sub OnLoggingOff(args As DevExpress.ExpressApp.LoggingOffEventArgs)
|
|
MyBase.OnLoggingOff(args)
|
|
Dim _onew As Xpo.XPObjectSpace = Me.ObjectSpaceProvider.CreateObjectSpace()
|
|
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
|
|
Dim _User As DevExpress.Persistent.BaseImpl.User = _onew.FindObject(Of DevExpress.Persistent.BaseImpl.User)(CriteriaOperator.Parse("Oid=?", SecuritySystem.CurrentUserId))
|
|
SISBusiness.Module.LockingModule.ReleaseAllLocking(_uow, _User)
|
|
End Sub
|
|
Private Sub SISPushInfoSSL()
|
|
Dim _PushInfoClass As New PushInfoClass
|
|
Dim _InfoString As String = ""
|
|
Try
|
|
Dim _onew As Xpo.XPObjectSpace = Me.ObjectSpaceProvider.CreateObjectSpace()
|
|
Dim _uow As New UnitOfWork(_onew.Session.DataLayer)
|
|
Dim _User As DevExpress.Persistent.BaseImpl.User = _onew.FindObject(Of DevExpress.Persistent.BaseImpl.User)(CriteriaOperator.Parse("Oid=?", SecuritySystem.CurrentUserId))
|
|
|
|
_PushInfoClass.UserName = _User.UserName
|
|
_PushInfoClass.FullName = _User.FullName
|
|
|
|
_InfoString = JsonConvert.SerializeObject(_PushInfoClass)
|
|
_InfoString = AESEncrypt(_InfoString, "HrX12!!0Zm7764W2", "vXm657YS+!0@mmT")
|
|
_InfoString = Convert.ToBase64String(Encoding.UTF8.GetBytes(_InfoString))
|
|
|
|
Dim _url = "http://sis-r.hu/SISChat/SISPushInfoSSL.ashx?id=" & _InfoString
|
|
Dim _request As HttpWebRequest = TryCast(WebRequest.Create(_url), HttpWebRequest)
|
|
Dim _response As HttpWebResponse = TryCast(_request.GetResponse, HttpWebResponse)
|
|
Dim _reader As StreamReader = New StreamReader(_response.GetResponseStream())
|
|
_InfoString = _reader.ReadToEnd
|
|
|
|
GLOBAL_ActivityID = _InfoString
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
End Sub
|
|
|
|
End Class
|
|
Public Class PushInfoClass
|
|
Property Company As String
|
|
Property ComputerName As String
|
|
Property ComputerIPAddress As String
|
|
Property ComputerUserName As String
|
|
Property ComputerUserDomainName As String
|
|
Property UserName As String
|
|
Property FullName As String
|
|
Sub New()
|
|
Company = GLOBAL_Company
|
|
ComputerName = Environment.MachineName
|
|
ComputerIPAddress = GetIPv4Address()
|
|
ComputerUserName = Environment.UserName
|
|
ComputerUserDomainName = Environment.UserDomainName
|
|
End Sub
|
|
Private Function GetIPv4Address() As String
|
|
Dim _GetIPv4Address As String = ""
|
|
GetIPv4Address = String.Empty
|
|
Dim strHostName As String = System.Net.Dns.GetHostName()
|
|
Dim iphe As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(strHostName)
|
|
|
|
For Each ipheal As System.Net.IPAddress In iphe.AddressList
|
|
If ipheal.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then
|
|
If _GetIPv4Address = "" Then
|
|
_GetIPv4Address = ipheal.ToString()
|
|
Else
|
|
_GetIPv4Address += ";" + ipheal.ToString()
|
|
End If
|
|
End If
|
|
Next
|
|
Return _GetIPv4Address
|
|
End Function
|
|
|
|
End Class
|
|
|