Refacturacion sin aceptacion

This commit is contained in:
2019-09-09 16:20:54 -07:00
parent e259e7d7e8
commit f9aa4b899f
5 changed files with 110 additions and 109 deletions

View File

@@ -601,112 +601,112 @@
End If
End If
ObjGPS.Dispose()
If EsProduccion = "1" Then
RegisterNotification()
End If
'-----------------
AspMap.License.SetLicenseKey("ccfecfcegknepnhmjighpjjpmpmbajfejhnladegmeanci")
GlobalConfiguration.Configure(AddressOf WebApiConfig.Register)
GlobalConfiguration.Configuration.EnsureInitialized()
End Sub
Sub Application_End(sender As Object, e As EventArgs)
If EsProduccion = "1" Then
SqlDependency.Stop(ConfigurationManager.ConnectionStrings("Conexion").ConnectionString)
End If
' Code that runs on application shutdown
End Sub
Sub Application_Error(sender As Object, e As EventArgs)
' Code that runs when an unhandled error occurs
Dim CveUsuario As String = ""
Dim Nombre As String = ""
Try
Dim user As Usuario = ADSSessionConfig.sessionUser
If Not IsNothing(user) Then
CveUsuario = user.CveUsuario.ToString()
Nombre = user.Nombre
End If
Catch ex As Exception
Usuario.CerrarSession()
End Try
Dim InfoAdicional As String = vbCrLf & "CveUsuario: " & CveUsuario & "; Nombre: " & Nombre & vbCrLf & "Ruta: " & Context.Request.RawUrl & " "
OnError("Ocurrió un error en la página.", Context.Error, InfoAdicional)
End Sub
Sub Session_Start(sender As Object, e As EventArgs)
' Code that runs when a new session is started
'Dim sessionData As Dictionary(Of String, HttpSessionState) = DirectCast(Application("s"), Dictionary(Of String, HttpSessionState))
'If sessionData.Keys.Contains(HttpContext.Current.Session.SessionID) Then
' sessionData.Remove(HttpContext.Current.Session.SessionID)
' sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session)
'Else
' sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session)
'End If
'Application("s") = sessionData
End Sub
Sub Session_End(sender As Object, e As EventArgs)
Dim objsession As Object = ADSSessionConfig.SessionManager(OpcionSession.removerSession, Nothing, -1, Session.SessionID)
If Not IsNothing(objsession) Then
'MyHub.RemoveConexiones(DirectCast(objsession, ADSSessionObj).CveUsuario)
End If
'Code that runs when a session ends.
' Note: The Session_End event Is raised only when the sessionstate mode
' Is set to InProc in the Web.config file. If session mode Is set to StateServer
'' or SQLServer, the event is not raised.
'Dim sessionData As Dictionary(Of String, HttpSessionState) = DirectCast(Application("s"), Dictionary(Of String, HttpSessionState))
'sessionData.Remove(HttpContext.Current.Session.SessionID)
'Application("s") = sessionData
End Sub
ObjGPS.Dispose()
'If EsProduccion = "1" Then
' RegisterNotification()
'End If
'-----------------
AspMap.License.SetLicenseKey("ccfecfcegknepnhmjighpjjpmpmbajfejhnladegmeanci")
GlobalConfiguration.Configure(AddressOf WebApiConfig.Register)
GlobalConfiguration.Configuration.EnsureInitialized()
End Sub
Sub Application_End(sender As Object, e As EventArgs)
If EsProduccion = "1" Then
SqlDependency.Stop(ConfigurationManager.ConnectionStrings("Conexion").ConnectionString)
End If
' Code that runs on application shutdown
End Sub
Sub Application_Error(sender As Object, e As EventArgs)
' Code that runs when an unhandled error occurs
Dim CveUsuario As String = ""
Dim Nombre As String = ""
Try
Dim user As Usuario = ADSSessionConfig.sessionUser
If Not IsNothing(user) Then
CveUsuario = user.CveUsuario.ToString()
Nombre = user.Nombre
End If
Catch ex As Exception
Usuario.CerrarSession()
End Try
Dim InfoAdicional As String = vbCrLf & "CveUsuario: " & CveUsuario & "; Nombre: " & Nombre & vbCrLf & "Ruta: " & Context.Request.RawUrl & " "
OnError("Ocurrió un error en la página.", Context.Error, InfoAdicional)
End Sub
Sub Session_Start(sender As Object, e As EventArgs)
' Code that runs when a new session is started
'Dim sessionData As Dictionary(Of String, HttpSessionState) = DirectCast(Application("s"), Dictionary(Of String, HttpSessionState))
'If sessionData.Keys.Contains(HttpContext.Current.Session.SessionID) Then
' sessionData.Remove(HttpContext.Current.Session.SessionID)
' sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session)
'Else
' sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session)
'End If
'Application("s") = sessionData
End Sub
Sub Session_End(sender As Object, e As EventArgs)
Dim objsession As Object = ADSSessionConfig.SessionManager(OpcionSession.removerSession, Nothing, -1, Session.SessionID)
If Not IsNothing(objsession) Then
'MyHub.RemoveConexiones(DirectCast(objsession, ADSSessionObj).CveUsuario)
End If
'Code that runs when a session ends.
' Note: The Session_End event Is raised only when the sessionstate mode
' Is set to InProc in the Web.config file. If session mode Is set to StateServer
'' or SQLServer, the event is not raised.
'Dim sessionData As Dictionary(Of String, HttpSessionState) = DirectCast(Application("s"), Dictionary(Of String, HttpSessionState))
'sessionData.Remove(HttpContext.Current.Session.SessionID)
'Application("s") = sessionData
End Sub
#Region "S Q L D E P E N D E N C Y"
Public Sub RegisterNotification()
Try
'Get the connection string from the Web.Config file. Make sure that the key exists and it is the connection string for the Notification Database and the NotificationList Table that we created
Dim connectionString As String = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
'We have selected the entire table as the command, so SQL Server executes this script and sees if there is a change in the result, raise the event
Dim commandText As String = "SELECT [FechaNotificacion] FROM dbo.Sis_NotificacionesActualizaciones"
'Start the SQL Dependency
SqlDependency.Start(connectionString)
Using connection As New SqlConnection(connectionString)
Using command As New SqlCommand(commandText, connection)
connection.Open()
Dim sqlDependency = New SqlDependency(command)
AddHandler sqlDependency.OnChange, AddressOf sqlDependency_OnChange
' NOTE: You have to execute the command, or the notification will never fire.
Using reader As SqlDataReader = command.ExecuteReader()
End Using
End Using
End Using
Catch ex As Exception
End Try
End Sub
Private Sub sqlDependency_OnChange(sender As Object, e As SqlNotificationEventArgs)
If e.Info = SqlNotificationInfo.Update Then
Try
Dim ObjNotificaciones As New ClsSisNotificaciones
ObjNotificaciones.ObtenerNotificaciones()
ObjNotificaciones.Dispose()
'System.Threading.Thread.Sleep(5000)
RegisterNotification()
Catch ex As Exception
End Try
End If
'Call the RegisterNotification method again
End Sub
'Public Sub RegisterNotification()
' Try
' 'Get the connection string from the Web.Config file. Make sure that the key exists and it is the connection string for the Notification Database and the NotificationList Table that we created
' Dim connectionString As String = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
' 'We have selected the entire table as the command, so SQL Server executes this script and sees if there is a change in the result, raise the event
' Dim commandText As String = "SELECT [FechaNotificacion] FROM dbo.Sis_NotificacionesActualizaciones"
' 'Start the SQL Dependency
' SqlDependency.Start(connectionString)
' Using connection As New SqlConnection(connectionString)
' Using command As New SqlCommand(commandText, connection)
' connection.Open()
' Dim sqlDependency = New SqlDependency(command)
' AddHandler sqlDependency.OnChange, AddressOf sqlDependency_OnChange
' ' NOTE: You have to execute the command, or the notification will never fire.
' Using reader As SqlDataReader = command.ExecuteReader()
' End Using
' End Using
' End Using
' Catch ex As Exception
' End Try
'End Sub
'Private Sub sqlDependency_OnChange(sender As Object, e As SqlNotificationEventArgs)
' If e.Info = SqlNotificationInfo.Update Then
' Try
' Dim ObjNotificaciones As New ClsSisNotificaciones
' ObjNotificaciones.ObtenerNotificaciones()
' ObjNotificaciones.Dispose()
' 'System.Threading.Thread.Sleep(5000)
' RegisterNotification()
' Catch ex As Exception
' End Try
' End If
' 'Call the RegisterNotification method again
'End Sub
#End Region
</script>