using System.Security.Cryptography; using System.Text; using Entidades.Dto; using Entidades; using Microsoft.EntityFrameworkCore; using System.Collections.Concurrent; using Org.BouncyCastle.Math.EC.Rfc7748; namespace Modelo; public class RepositorioNotificaciones : RepositorioBase { public bool MarcarComoLeido(long dni, DateTime? fecha) { if (fecha == null) return false; var con = Context; Notificacione? noti = con.Notificaciones.FirstOrDefault(x=> x.Dnicliente == dni && x.Fecha == fecha); if (noti == null) return false; noti.Leido = true; return Guardar(con); } public bool AltaNotificacion(Notificacione n, long dni=0) { var con = Context; con.Notificaciones.Add(n); if (dni !=0){ GenerarLog(con, dni, "Se envio un informe"); } return Guardar(con); } public IQueryable ObtenerNotificacionesDeUsuario(long dni) { var con = Context; var notis = con.Notificaciones .Include(x=>x.IdpropiedadNavigation) .Include(x=>x.DniclienteNavigation) .Include(x=>x.DniremitenteNavigation) .Where(x => x.Dnicliente == dni); return notis; } public bool HayNotis(long dni) { var con = Context; bool hay = con.Notificaciones.Where(x=>x.Leido == false && x.Dnicliente == dni).Any(); return hay; } public Notificacione? ObtenerNotificacionPorKeys(long dni, DateTime? fecha) { var con = Context; var n = con.Notificaciones.FirstOrDefault(x => x.Dnicliente ==dni && x.Fecha == fecha); return n; } }