From b7256ba33b7e2a09dee426e8685621e237f98bd8 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Tue, 17 Mar 2020 18:17:43 -0700 Subject: [PATCH] last postaback en usuarios --- App_Code/ClsPaginas.vb | 4 +++- App_Code/Usuario.vb | 17 ++++++++++++++++- Sistemas/SessionesActivas.aspx | 12 +++++++++++- Sistemas/SessionesActivas.aspx.vb | 4 ++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 023ae689e..3e646964b 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3502,7 +3502,9 @@ Public Class ClsPaginas End If If UsuarioActual.CveEmpresa = 42 Then Me.MasterPageFile = "~/Masters/Site42.master" - End If + End If + + ADSSession.ADSSessionConfig.SessionManager(ADSSession.OpcionSession.CambiarModulo, Nothing, -1, "", Request.Url.ToString()) 'If Me.Request.ServerVariables("http_user_agent").ToLower.Contains("safari") AndAlso Page.ClientTarget <> "uplevel" Then Page.ClientTarget = "uplevel" 'Código agregado para que muestre bién el menu, en chrome End If End Sub diff --git a/App_Code/Usuario.vb b/App_Code/Usuario.vb index 39b921fe9..11d6e8718 100644 --- a/App_Code/Usuario.vb +++ b/App_Code/Usuario.vb @@ -115,6 +115,7 @@ Namespace ADSSession getListasession = 3 'solo lectura CambiarEmpresa = 4 getSession = 5 + CambiarModulo = 6 End Enum Public Enum OpcionHub As Integer agregar = 1 @@ -158,7 +159,7 @@ Namespace ADSSession HttpContext.Current.Session(strsessionDpage) = value End Set End Property - Public Shared Function SessionManager(opcion As OpcionSession, Optional obj As ADSSessionObj = Nothing, Optional CveEmpresa As Integer = -1, Optional SessionID As String = Nothing) As Object + Public Shared Function SessionManager(opcion As OpcionSession, Optional obj As ADSSessionObj = Nothing, Optional CveEmpresa As Integer = -1, Optional SessionID As String = Nothing, Optional modulo As String = "") As Object SyncLock strsessionid 'todo el codigo que este dentro de este corchete no se ejecutara mas de una vez al mismo tiempo en el servidor If _dicSessionobj Is Nothing Then _dicSessionobj = New ConcurrentDictionary(Of String, ADSSessionObj) @@ -194,6 +195,18 @@ Namespace ADSSession obj.CveEmpresa = CveEmpresa End If retorno = obj + + Case OpcionSession.CambiarModulo + If Not IsNothing(HttpContext.Current) AndAlso Not IsNothing(HttpContext.Current.Session) AndAlso Not IsNothing(HttpContext.Current.Session(strsessionid)) Then + obj = DirectCast(HttpContext.Current.Session(strsessionid), ADSSessionObj) + obj.Modulo = modulo + obj.LastPostback = DateTime.Now + If _dicSessionobj.TryGetValue(obj.SessionID, obj) Then + obj.Modulo = modulo + obj.LastPostback = DateTime.Now + End If + retorno = obj + End If End Select Catch ex As Exception retorno = Nothing @@ -227,6 +240,8 @@ Namespace ADSSession End Sub Public Property CveUsuario As Integer Public Property CveEmpresa As Integer + Public Property Modulo As String + Public Property LastPostback As DateTime Protected Property _SessionID As String Private Property _ipAdrres As String Public ReadOnly Property IpAddres As String diff --git a/Sistemas/SessionesActivas.aspx b/Sistemas/SessionesActivas.aspx index 61e8ea10d..b8ba50c2f 100644 --- a/Sistemas/SessionesActivas.aspx +++ b/Sistemas/SessionesActivas.aspx @@ -67,7 +67,7 @@ - + @@ -75,6 +75,16 @@ + + + + + + + + + + diff --git a/Sistemas/SessionesActivas.aspx.vb b/Sistemas/SessionesActivas.aspx.vb index d75f57267..2139cef5a 100644 --- a/Sistemas/SessionesActivas.aspx.vb +++ b/Sistemas/SessionesActivas.aspx.vb @@ -33,6 +33,8 @@ Partial Class SessionesActivas Dim dtU As DataTable = objUsuarios.DtResultados dtU.Columns.Add("FechaSLogin", System.Type.GetType("System.DateTime")) dtU.Columns.Add("RemoteIpAddres", System.Type.GetType("System.String")) + dtU.Columns.Add("LastPostback", System.Type.GetType("System.DateTime")) + dtU.Columns.Add("Modulo", System.Type.GetType("System.String")) Dim dtF As DataTable = dtU.Clone Dim objlist As List(Of ADSSession.ADSSessionObj) = ADSSession.ADSSessionConfig.SessionManager(ADSSession.OpcionSession.getListasession) @@ -41,6 +43,8 @@ Partial Class SessionesActivas If Not IsNothing(row) Then row("FechaSLogin") = user.FechaLogin row("RemoteIpAddres") = user.IpAddres + row("LastPostback") = user.LastPostback + row("Modulo") = user.Modulo dtF.Rows.Add(row.ItemArray()) End If Next