Initial commit

This commit is contained in:
Jorge Luis caudillo esparza
2026-07-14 11:15:20 -07:00
commit 6685ef63fb
7326 changed files with 1020873 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
using SIG.Web.AppCode.Notifications.Models;
namespace SIG.Web.AppCode.Notifications.Contracts
{
public interface INotificationCenter
{
void Queue(NotificationMessage message);
void MarkAsShown(int notificationId, int userId);
IReadOnlyList<NotificationMessage> GetBellMessages(int userId);
int CountPending(int userId);
}
}

View File

@@ -0,0 +1,12 @@
using Microsoft.AspNet.SignalR;
namespace SIG.Web.AppCode.Notifications.Hubs
{
public class NotificationHub : Hub
{
public void Ping()
{
Clients.Caller.pong("SignalR is working.");
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
namespace SIG.Web.AppCode.Notifications.Models
{
[Serializable]
public sealed class NotificationMessage
{
public int CveNotificacion { get; set; }
public int CveUsuario { get; set; }
public string TipoNotificacion { get; set; }
public string EstadoNotificacion { get; set; }
public string Titulo { get; set; }
public string Mensaje { get; set; }
public string Url { get; set; }
public bool Leida { get; set; }
public bool MostradaEnCampana { get; set; }
public DateTime? FechaEnvio { get; set; }
public DateTime? FechaLectura { get; set; }
public DateTime FechaCreacion { get; set; }
public DateTime? FechaActualizacion { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using System.Collections.Generic;
using System.Linq;
using SIG.Web.AppCode.Notifications.Contracts;
using SIG.Web.AppCode.Notifications.Models;
namespace SIG.Web.AppCode.Notifications.Services
{
public sealed class DummyNotificationCenter : INotificationCenter
{
private static readonly List<NotificationMessage> Items = new List<NotificationMessage>();
public void Queue(NotificationMessage message)
{
if (message == null) return;
message.CveNotificacion = Items.Count + 1;
message.FechaCreacion = System.DateTime.Now;
message.EstadoNotificacion = "Pendiente";
Items.Add(message);
}
public void MarkAsShown(int notificationId, int userId)
{
var item = Items.FirstOrDefault(x => x.CveNotificacion == notificationId && x.CveUsuario == userId);
if (item == null) return;
item.MostradaEnCampana = true;
}
public IReadOnlyList<NotificationMessage> GetBellMessages(int userId)
{
return Items.Where(x => x.CveUsuario == userId && !x.Leida).ToList();
}
public int CountPending(int userId)
{
return GetBellMessages(userId).Count;
}
}
}