Notificaciones on campana

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2025-01-06 03:53:57 -07:00
parent d14daeb4b5
commit 180fd2fe35
6 changed files with 2219 additions and 2069 deletions

View File

@@ -201,6 +201,32 @@ Public Class ClsPaginas
#End Region #End Region
#Region "GlobalDTs" #Region "GlobalDTs"
Public Shared Property GlobalDTNotificacionesUsuarios(CveUsuario As Integer, CveEmpresa As Integer) As DataTable
Get
Dim AppNombre As String = $"GlobalDTNotificacionesUsuarios-{CveEmpresa}"
If HttpContext.Current.Application(AppNombre) Is Nothing Then
Using ObjUsuarios As New ClsSisNotificaciones
If ObjUsuarios.NotificacionesUsuariosGet(-1, CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjUsuarios.DtResultados
End Using
End If
Dim filtros As New List(Of String)
If CveUsuario <> -1 Then filtros.Add($"CveUsuario = {CveUsuario}")
If filtros.Count > 0 Then
Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), String.Join(" AND ", filtros), "", DataViewRowState.CurrentRows)
GlobalDTNotificacionesUsuarios = Dv.ToTable
Dv.Dispose()
Else
GlobalDTNotificacionesUsuarios = DirectCast(HttpContext.Current.Application(AppNombre), DataTable)
End If
End Get
Set(value As DataTable)
Dim AppNombre As String = $"GlobalDTNotificacionesUsuarios-{CveEmpresa}"
HttpContext.Current.Application(AppNombre) = value
End Set
End Property
Public Shared Property GlobalTipoCambio(Optional Fecha As Date = MinFecha) As Double Public Shared Property GlobalTipoCambio(Optional Fecha As Date = MinFecha) As Double
Get Get
If GlobalTipoCambio <= 0 Then If GlobalTipoCambio <= 0 Then

File diff suppressed because it is too large Load Diff

View File

@@ -28,7 +28,7 @@ Public Class NotificacionesSQLWatcher
Using connection As New SqlConnection(rutadb) Using connection As New SqlConnection(rutadb)
' Consulta para detectar cambios recientes ' Consulta para detectar cambios recientes
Dim command As New SqlCommand( Dim command As New SqlCommand(
"SELECT CveUsuario, Notificaciones, Fecha FROM NotificacionesUsuarios", connection) "SELECT CveUsuario, Notificaciones, Fecha FROM SIG_NotificacionesUsuarios", connection)
' Asociar dependencia SQL a la consulta ' Asociar dependencia SQL a la consulta
Dim dependency As New SqlDependency(command) Dim dependency As New SqlDependency(command)
@@ -51,7 +51,7 @@ Public Class NotificacionesSQLWatcher
' Método para enviar notificaciones solo de los registros actualizados ' Método para enviar notificaciones solo de los registros actualizados
Private Sub SendNotifications() Private Sub SendNotifications()
Using connection As New SqlConnection(rutadb) Using connection As New SqlConnection(rutadb)
Dim query As String = "SELECT CveUsuario, Notificaciones, Fecha FROM NotificacionesUsuarios WHERE Fecha > DATEADD(MINUTE, -1, GETDATE())" Dim query As String = "SELECT CveUsuario, Notificaciones, Fecha FROM SIG_NotificacionesUsuarios WHERE Fecha > DATEADD(MINUTE, -1, GETDATE())"
Dim command As New SqlCommand(query, connection) Dim command As New SqlCommand(query, connection)
connection.Open() connection.Open()

View File

@@ -49,9 +49,9 @@
GlobalConfiguration.Configure(AddressOf WebApiConfig.Register) GlobalConfiguration.Configure(AddressOf WebApiConfig.Register)
GlobalConfiguration.Configuration.EnsureInitialized() GlobalConfiguration.Configuration.EnsureInitialized()
'se comenta ya que se envbia directo desde el metodo NotificacionesUsuariosAdd en clssisnotificaciones
Dim watcher As New NotificacionesSQLWatcher() 'Dim watcher As New NotificacionesSQLWatcher()
watcher.StartWatching() 'watcher.StartWatching()
End Sub End Sub

View File

@@ -20,12 +20,12 @@
</style> </style>
<%: Scripts.Render("~/bundles/modernizr") %> <%: Scripts.Render("~/bundles/modernizr") %>
<%: Styles.Render("~/Content/AjaxControlToolkit/Styles/Bundle") %> <%: Styles.Render("~/Content/AjaxControlToolkit/Styles/Bundle") %>
<link rel="preconnect" href="https://fonts.googleapis.com"/> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css" /> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700;800" rel="stylesheet"/> <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700;800" rel="stylesheet" />
<link href="/Metronic/fontawesome6/css/all.min.css" rel="stylesheet" type="text/css" /> <link href="/Metronic/fontawesome6/css/all.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/Scripts/PrintJS/print.min.css"/> <link rel="stylesheet" type="text/css" href="/Scripts/PrintJS/print.min.css" />
<%-- <link href="/Metronic/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <%-- <link href="/Metronic/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="/Metronic/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="/Metronic/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="/Metronic/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />--%> <link href="/Metronic/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />--%>
@@ -139,13 +139,18 @@
<span class='SigCampananoti badge <%=If(countNotificaciones > 0, "badge-danger", "badge-default") %>'><%= countNotificaciones %> </span> <span class='SigCampananoti badge <%=If(countNotificaciones > 0, "badge-danger", "badge-default") %>'><%= countNotificaciones %> </span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li class="external"> <li class="external" onclick ="$('.btnSigCampananoti').click();">
<h3><span class="bold"><%= countNotificaciones %></span> Notificaciones pendientes</h3> <h3>Click para ver notificaciones (<span class="bold"><%= countNotificaciones %></span>) pendientes</h3>
</li> </li>
<li> <li>
<ul class="dropdown-menu-list scroller" style="height: 250px;" data-handle-color="#637283"> <asp:UpdatePanel ID="UpNotificaciones" runat="server" UpdateMode="Conditional">
<asp:Literal ID="LtlMNotificaciones" runat="server"></asp:Literal> <ContentTemplate>
</ul> <asp:Button ID="btnSigCampananoti" CssClass="btnSigCampananoti" runat="server" Text="Enviar" OnClick="btnSigCampananoti_Click" Style="display:none" />
<ul class="dropdown-menu-list scroller" style="height: 250px;" data-handle-color="#637283">
<asp:Literal ID="LtlMNotificaciones" runat="server"></asp:Literal>
</ul>
</ContentTemplate>
</asp:UpdatePanel>
</li> </li>
</ul> </ul>
</li> </li>
@@ -347,8 +352,8 @@
<div class="page-container" runat="server" id="divpagecontainer"> <div class="page-container" runat="server" id="divpagecontainer">
<!-- BEGIN SIDEBAR --> <!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper" runat="server" id="divMenuB" style=" position: fixed;"> <div class="page-sidebar-wrapper" runat="server" id="divMenuB" style="position: fixed;">
<div class="page-sidebar navbar-collapse collapse" > <div class="page-sidebar navbar-collapse collapse">
<!-- add "navbar-no-scroll" class to disable the scrolling of the sidebar menu --> <!-- add "navbar-no-scroll" class to disable the scrolling of the sidebar menu -->
<!-- BEGIN SIDEBAR MENU --> <!-- BEGIN SIDEBAR MENU -->
<ul class="page-sidebar-menu" id='ulmenulateralmaster' data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200"> <ul class="page-sidebar-menu" id='ulmenulateralmaster' data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
@@ -367,16 +372,16 @@
</span> </span>
</div> </div>
</div> </div>
</li> </li>
</ul> </ul>
<!-- END SIDEBAR MENU --> <!-- END SIDEBAR MENU -->
</div> </div>
</div> </div>
<div class="page-sidebar-wrapper" runat="server" id="divMenu" style="margin-top: 45px;"> <div class="page-sidebar-wrapper" runat="server" id="divMenu" style="margin-top: 45px;">
<div class="page-sidebar navbar-collapse collapse" style="padding-bottom: 120px;"> <div class="page-sidebar navbar-collapse collapse" style="padding-bottom: 120px;">
<ul class="page-sidebar-menu" id='ulmenulateralmasterB' data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200"> <ul class="page-sidebar-menu" id='ulmenulateralmasterB' data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
<asp:Literal ID="Menu" runat="server"></asp:Literal> <asp:Literal ID="Menu" runat="server"></asp:Literal>
</ul> </ul>
</div> </div>
</div> </div>
<!-- END SIDEBAR --> <!-- END SIDEBAR -->
@@ -646,7 +651,7 @@
<!-- END QUICK SIDEBAR --> <!-- END QUICK SIDEBAR -->
</div> </div>
<!-- END CONTAINER --> <!-- END CONTAINER -->
<!-- BEGIN FOOTER --> <!-- BEGIN FOOTER -->
<%--<div class="page-footer" runat="server" id="divfooter"> <%--<div class="page-footer" runat="server" id="divfooter">
@@ -661,7 +666,7 @@
<!-- END FOOTER --> <!-- END FOOTER -->
<!-- END JAVASCRIPTS --> <!-- END JAVASCRIPTS -->
<div id="pogresspostback" class="hidden" style="z-index: 10000;" runat="server"> <div id="pogresspostback" class="hidden" style="z-index: 10000;" runat="server">
<div style="width: 200px; position: absolute; margin: 0 0 0 -100px; top: 50%; left: 50%; background-color: transparent;"> <div style="width: 200px; position: absolute; margin: 0 0 0 -100px; top: 50%; left: 50%; background-color: transparent;">
<div class="loading-spinner" style="width: 300px;"> <div class="loading-spinner" style="width: 300px;">

View File

@@ -435,12 +435,19 @@ Partial Class Site
#Region "Notificaciones" #Region "Notificaciones"
Private Sub CargarNotificaciones() Protected Sub btnSigCampananoti_Click(sender As Object, e As EventArgs)
CargarNotificaciones(True)
End Sub
Private Sub CargarNotificaciones(Optional obtnerNotis As Boolean = False)
Dim Notificaciones As New StringBuilder Dim Notificaciones As New StringBuilder
'Bienvenida 'Bienvenida
Notificaciones.Append(ItemNotificaciones("Bienvenido a SIG ", "Hoy", "fa fa-bullhorn")) 'Notificaciones.Append(ItemNotificaciones("Bienvenido a SIG ", "Hoy", "fa fa-bullhorn"))
countNotificaciones = 0
Dim dt As DataTable = ClsPaginas.GlobalDTNotificacionesUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If Not IsNothing(dt) AndAlso dt.Rows.Count() > 0 Then
countNotificaciones = dt(0)("Notificaciones").ToString().ToEntero()
End If
'Certificado 'Certificado
Dim fechacer As String = ConvertCER() Dim fechacer As String = ConvertCER()
If fechacer = "" OrElse (((DateTime.Parse(fechacer).Month - ClsPaginas.NowADS().Month) < 2) AndAlso ((DateTime.Parse(fechacer).Year - ClsPaginas.NowADS().Year) < 1)) Then If fechacer = "" OrElse (((DateTime.Parse(fechacer).Month - ClsPaginas.NowADS().Month) < 2) AndAlso ((DateTime.Parse(fechacer).Year - ClsPaginas.NowADS().Year) < 1)) Then
@@ -461,6 +468,16 @@ Partial Class Site
End If End If
OC.Dispose() OC.Dispose()
End If End If
If obtnerNotis Then
Using objnoti As New ClsSisNotificaciones()
If objnoti.NotificacionesUsuariosMensajesGet(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, True, True) Then
For Each row As DataRow In objnoti.DtResultados.Rows
Notificaciones.Append(ItemNotificaciones(row("Mensaje").ToString(), row("Asunto").ToString(), row("Icono").ToString()))
Next
End If
End Using
End If
'If UsuarioActual.TienePermisoProceso(303) Then 'If UsuarioActual.TienePermisoProceso(303) Then
' Using objgen As New ClsGenerales ' Using objgen As New ClsGenerales
' pnlNotificacionSAT.Visible = True ' pnlNotificacionSAT.Visible = True
@@ -487,7 +504,8 @@ Partial Class Site
'End If 'End If
'OC.Dispose() 'OC.Dispose()
LtlMNotificaciones.Text = String.Format("{0}{1}", LtlMNotificaciones.Text, Notificaciones.ToString()) 'LtlMNotificaciones.Text = String.Format("{0}{1}", LtlMNotificaciones.Text, Notificaciones.ToString())
LtlMNotificaciones.Text = Notificaciones.ToString()
Notificaciones.Clear() Notificaciones.Clear()
End Sub End Sub
@@ -593,4 +611,5 @@ Partial Class Site
Catch ex As Exception Catch ex As Exception
End Try End Try
End Sub End Sub
End Class End Class