Notificaciones on campana
This commit is contained in:
@@ -201,6 +201,32 @@ Public Class ClsPaginas
|
||||
#End Region
|
||||
|
||||
#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
|
||||
Get
|
||||
If GlobalTipoCambio <= 0 Then
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@ Public Class NotificacionesSQLWatcher
|
||||
Using connection As New SqlConnection(rutadb)
|
||||
' Consulta para detectar cambios recientes
|
||||
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
|
||||
Dim dependency As New SqlDependency(command)
|
||||
@@ -51,7 +51,7 @@ Public Class NotificacionesSQLWatcher
|
||||
' Método para enviar notificaciones solo de los registros actualizados
|
||||
Private Sub SendNotifications()
|
||||
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)
|
||||
|
||||
connection.Open()
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
GlobalConfiguration.Configure(AddressOf WebApiConfig.Register)
|
||||
GlobalConfiguration.Configuration.EnsureInitialized()
|
||||
|
||||
|
||||
Dim watcher As New NotificacionesSQLWatcher()
|
||||
watcher.StartWatching()
|
||||
'se comenta ya que se envbia directo desde el metodo NotificacionesUsuariosAdd en clssisnotificaciones
|
||||
'Dim watcher As New NotificacionesSQLWatcher()
|
||||
'watcher.StartWatching()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
35
Site.master
35
Site.master
@@ -20,12 +20,12 @@
|
||||
</style>
|
||||
<%: Scripts.Render("~/bundles/modernizr") %>
|
||||
<%: 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 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 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/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" />--%>
|
||||
@@ -139,13 +139,18 @@
|
||||
<span class='SigCampananoti badge <%=If(countNotificaciones > 0, "badge-danger", "badge-default") %>'><%= countNotificaciones %> </span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="external">
|
||||
<h3><span class="bold"><%= countNotificaciones %></span> Notificaciones pendientes</h3>
|
||||
<li class="external" onclick ="$('.btnSigCampananoti').click();">
|
||||
<h3>Click para ver notificaciones (<span class="bold"><%= countNotificaciones %></span>) pendientes</h3>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="dropdown-menu-list scroller" style="height: 250px;" data-handle-color="#637283">
|
||||
<asp:Literal ID="LtlMNotificaciones" runat="server"></asp:Literal>
|
||||
</ul>
|
||||
<asp:UpdatePanel ID="UpNotificaciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<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>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -347,8 +352,8 @@
|
||||
<div class="page-container" runat="server" id="divpagecontainer">
|
||||
|
||||
<!-- BEGIN SIDEBAR -->
|
||||
<div class="page-sidebar-wrapper" runat="server" id="divMenuB" style=" position: fixed;">
|
||||
<div class="page-sidebar navbar-collapse collapse" >
|
||||
<div class="page-sidebar-wrapper" runat="server" id="divMenuB" style="position: fixed;">
|
||||
<div class="page-sidebar navbar-collapse collapse">
|
||||
<!-- add "navbar-no-scroll" class to disable the scrolling of the sidebar menu -->
|
||||
<!-- BEGIN SIDEBAR MENU -->
|
||||
<ul class="page-sidebar-menu" id='ulmenulateralmaster' data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
|
||||
@@ -367,16 +372,16 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- END SIDEBAR MENU -->
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<asp:Literal ID="Menu" runat="server"></asp:Literal>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END SIDEBAR -->
|
||||
@@ -646,7 +651,7 @@
|
||||
<!-- END QUICK SIDEBAR -->
|
||||
</div>
|
||||
<!-- END CONTAINER -->
|
||||
|
||||
|
||||
|
||||
<!-- BEGIN FOOTER -->
|
||||
<%--<div class="page-footer" runat="server" id="divfooter">
|
||||
@@ -661,7 +666,7 @@
|
||||
<!-- END FOOTER -->
|
||||
|
||||
<!-- END JAVASCRIPTS -->
|
||||
|
||||
|
||||
<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 class="loading-spinner" style="width: 300px;">
|
||||
|
||||
@@ -435,12 +435,19 @@ Partial Class Site
|
||||
|
||||
#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
|
||||
|
||||
'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
|
||||
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
|
||||
@@ -461,6 +468,16 @@ Partial Class Site
|
||||
End If
|
||||
OC.Dispose()
|
||||
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
|
||||
' Using objgen As New ClsGenerales
|
||||
' pnlNotificacionSAT.Visible = True
|
||||
@@ -487,7 +504,8 @@ Partial Class Site
|
||||
'End If
|
||||
'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()
|
||||
End Sub
|
||||
|
||||
@@ -593,4 +611,5 @@ Partial Class Site
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user