last postaback en usuarios

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2020-03-17 18:17:43 -07:00
parent c602c4145f
commit b7256ba33b
4 changed files with 34 additions and 3 deletions

View File

@@ -3503,6 +3503,8 @@ Public Class ClsPaginas
If UsuarioActual.CveEmpresa = 42 Then If UsuarioActual.CveEmpresa = 42 Then
Me.MasterPageFile = "~/Masters/Site42.master" 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 '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 If
End Sub End Sub

View File

@@ -115,6 +115,7 @@ Namespace ADSSession
getListasession = 3 'solo lectura getListasession = 3 'solo lectura
CambiarEmpresa = 4 CambiarEmpresa = 4
getSession = 5 getSession = 5
CambiarModulo = 6
End Enum End Enum
Public Enum OpcionHub As Integer Public Enum OpcionHub As Integer
agregar = 1 agregar = 1
@@ -158,7 +159,7 @@ Namespace ADSSession
HttpContext.Current.Session(strsessionDpage) = value HttpContext.Current.Session(strsessionDpage) = value
End Set End Set
End Property 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 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 If _dicSessionobj Is Nothing Then
_dicSessionobj = New ConcurrentDictionary(Of String, ADSSessionObj) _dicSessionobj = New ConcurrentDictionary(Of String, ADSSessionObj)
@@ -194,6 +195,18 @@ Namespace ADSSession
obj.CveEmpresa = CveEmpresa obj.CveEmpresa = CveEmpresa
End If End If
retorno = obj 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 End Select
Catch ex As Exception Catch ex As Exception
retorno = Nothing retorno = Nothing
@@ -227,6 +240,8 @@ Namespace ADSSession
End Sub End Sub
Public Property CveUsuario As Integer Public Property CveUsuario As Integer
Public Property CveEmpresa As Integer Public Property CveEmpresa As Integer
Public Property Modulo As String
Public Property LastPostback As DateTime
Protected Property _SessionID As String Protected Property _SessionID As String
Private Property _ipAdrres As String Private Property _ipAdrres As String
Public ReadOnly Property IpAddres As String Public ReadOnly Property IpAddres As String

View File

@@ -67,7 +67,7 @@
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Login"> <asp:TemplateField HeaderText="Fecha Login">
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("FechaSLogin")%>'></asp:Literal> <asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("FechaSLogin", "{0:dd/MM/yyyy HH:mm}")%>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="IP"> <asp:TemplateField HeaderText="IP">
@@ -75,6 +75,16 @@
<asp:Literal ID="LtlRemoteIpAddres" runat="server" Text='<%# Eval("RemoteIpAddres")%>'></asp:Literal> <asp:Literal ID="LtlRemoteIpAddres" runat="server" Text='<%# Eval("RemoteIpAddres")%>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Modulo">
<ItemTemplate>
<asp:Literal ID="LtlModulo" runat="server" Text='<%# Eval("Modulo")%>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Post">
<ItemTemplate>
<asp:Literal ID="LtlPost" runat="server" Text='<%# Eval("LastPostback", "{0:dd/MM/yyyy HH:mm}")%>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>
<asp:LinkButton ID="LnkEnviarMensaje" OnClick="LnkEnviarMensaje_Click" CssClass="btn btn-circle btn-sm blue" runat="server" Text="<i class='fa fa-comments-o'></i>"></asp:LinkButton> <asp:LinkButton ID="LnkEnviarMensaje" OnClick="LnkEnviarMensaje_Click" CssClass="btn btn-circle btn-sm blue" runat="server" Text="<i class='fa fa-comments-o'></i>"></asp:LinkButton>

View File

@@ -33,6 +33,8 @@ Partial Class SessionesActivas
Dim dtU As DataTable = objUsuarios.DtResultados Dim dtU As DataTable = objUsuarios.DtResultados
dtU.Columns.Add("FechaSLogin", System.Type.GetType("System.DateTime")) dtU.Columns.Add("FechaSLogin", System.Type.GetType("System.DateTime"))
dtU.Columns.Add("RemoteIpAddres", System.Type.GetType("System.String")) 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 dtF As DataTable = dtU.Clone
Dim objlist As List(Of ADSSession.ADSSessionObj) = ADSSession.ADSSessionConfig.SessionManager(ADSSession.OpcionSession.getListasession) 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 If Not IsNothing(row) Then
row("FechaSLogin") = user.FechaLogin row("FechaSLogin") = user.FechaLogin
row("RemoteIpAddres") = user.IpAddres row("RemoteIpAddres") = user.IpAddres
row("LastPostback") = user.LastPostback
row("Modulo") = user.Modulo
dtF.Rows.Add(row.ItemArray()) dtF.Rows.Add(row.ItemArray())
End If End If
Next Next