signalcampana
This commit is contained in:
@@ -158,8 +158,18 @@ Public Class ClsSisNotificaciones
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Shared Sub ContadorCampana(Mensaje As String, CveUsuario As String)
|
||||
Dim hub = GlobalHost.ConnectionManager.GetHubContext(Of Notificaciones)()
|
||||
'VERIFICA SI EXISTE LA CONEXION DEL USUARIO
|
||||
If Notificaciones.UsuariosConexiones.Keys.Any(Function(key) key = CveUsuario) Then
|
||||
hub.Clients.Client(Notificaciones.UsuariosConexiones(CveUsuario)).ContadorCampana(Mensaje)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub DispararNotificacion(CveNotificacion As Integer, CvesFiltro As List(Of Object), CveEmpresa As Integer)
|
||||
|
||||
Public Sub DispararNotificacion(CveNotificacion As Integer, CvesFiltro As List(Of Object), CveEmpresa As Integer)
|
||||
|
||||
|
||||
_CveNotificacion = CveNotificacion
|
||||
_CveEmpresa = CveEmpresa
|
||||
|
||||
|
||||
@@ -63,6 +63,13 @@ Public Class Notificaciones
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub ContadorCampana(ContadorMesagge As String, Para As List(Of String))
|
||||
If (Para IsNot Nothing) AndAlso Para.Count > 0 Then
|
||||
Dim Clients As Hubs.IHubConnectionContext(Of Object) = GlobalHost.ConnectionManager.GetHubContext(Of Notificaciones)().Clients
|
||||
Clients.Users(Para).ContadorCampana(ContadorMesagge)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Public Class MyhubUserIdProvider
|
||||
Implements IUserIdProvider
|
||||
|
||||
@@ -67,8 +67,9 @@ Partial Class Inicio
|
||||
End Sub
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
|
||||
|
||||
'Using objnoti = New ClsSisNotificaciones()
|
||||
' objnoti.ContadorCampana("Mi Mensaje", UsuarioActual.CveUsuario.ToString())
|
||||
'End Using
|
||||
|
||||
If Not IsNothing(Request("logout")) AndAlso Request("logout").ToString() = "1" Then
|
||||
Usuario.CerrarSession()
|
||||
|
||||
@@ -94,7 +94,11 @@ var NotificacionesADS = function () {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var ContadorCampana = function (contadormessage) {
|
||||
console.log('(SignalR) ContadorCampana \'' + contadormessage);
|
||||
localStorage.setItem("ContadorCampana", "");
|
||||
localStorage.setItem("ContadorCampana", contadormessage);
|
||||
}
|
||||
//-------------------------------------------------------------------- EndEventos ----------------------------------------------------------------------
|
||||
function closeopenConexion() {
|
||||
if (VentanaConConexion) {
|
||||
@@ -122,6 +126,7 @@ var NotificacionesADS = function () {
|
||||
});
|
||||
|
||||
proxy.client.alertaVentana = AlertaVentana;
|
||||
proxy.client.ContadorCampana = ContadorCampana;
|
||||
|
||||
proxy.client.Execstring = Execstring;
|
||||
|
||||
@@ -138,7 +143,7 @@ var NotificacionesADS = function () {
|
||||
setTimeout(function () {
|
||||
nointentos = nointentos + 1;
|
||||
if (nointentos < maxintentos) {
|
||||
$.connection.hub.start().done(function () { console.log('(SignalR)Bienvenido'); nointentos = 0; })
|
||||
$.connection.hub.start().done(function () { console.log('(SignalR) Bienvenido'); nointentos = 0; })
|
||||
.fail(function () { console.log(' (SignalR) no conectado (Intento:' + nointentos + ')'); signalrconectionStar(1200); });
|
||||
}
|
||||
}, TimeOut);
|
||||
@@ -159,6 +164,8 @@ var NotificacionesADS = function () {
|
||||
///
|
||||
x = 1;
|
||||
}
|
||||
console.log({ key: evt.key });
|
||||
console.log({newValue: evt.newValue});
|
||||
switch (evt.key + "") {
|
||||
case 'ADSCloseConection':
|
||||
closeopenConexion();
|
||||
@@ -173,6 +180,15 @@ var NotificacionesADS = function () {
|
||||
window.removeEventListener("beforeunload", beforeunloadcloseopenConexion);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ContadorCampana':
|
||||
try {
|
||||
console.log('(SignalR) contadormessage \'' + evt.newValue);
|
||||
|
||||
} catch (e) {
|
||||
console.error('(SignalR) contadormessage \''+e);
|
||||
}
|
||||
break;
|
||||
case 'ADSNotificaciones':
|
||||
try {
|
||||
let obj = JSON.parse(evt.newValue);
|
||||
|
||||
Reference in New Issue
Block a user