public void insertarNotificacion(int idUsuario, string mensaje) { List <string> id = new List <string>(); List <TbSeUsuario> usuariosAsociados = new List <TbSeUsuario>(); List <TbSeMensajeReceptor> mensajeReceptor = new List <TbSeMensajeReceptor>(); TbSeMensaje notificacion = new TbSeMensaje(mensaje, "NO", idUsuario); TbSeMensaje noti = new TbSeMensaje(); List <TbSeUsuario> us = new List <TbSeUsuario>(); IUserRepository.GetAllByIdUsuario(74); noti = this.ImensajeService.create(notificacion); TbSeMensajeReceptor msj = new TbSeMensajeReceptor(); foreach (var item in IUserRepository.GetAllByIdUsuario(74)) { msj = this.IMensajeReceptorMap.Crear(noti.Id, Convert.ToInt32(item.Id)); mensajeReceptor.Add(msj); EmailSender.emailSender(item.Correo, noti.Mensaje, "Mensaje del Sistema Altiva Soluciones Seguridad"); } this.IMensajeReceptorRepository.Crear(mensajeReceptor); }
public JsonResult NoLeidos(int pMensaje) { _ = new TbSeMensajeReceptor(); TbSeMensajeReceptor re = IMensajeReceptorMap.NoLeido(pMensaje); this.IMensajeReceptorService.Update(re); return(Json(new { id = 1 })); }
public JsonResult NoLeidos(int valor) { TbSeMensajeReceptor re = new TbSeMensajeReceptor(); re = this.IMensajeReceptorMap.NoLeido(valor); this.IMensajeReceptorService.Update(re); return(Json(new { id = 1 })); }
public TbSeMensajeReceptor NoLeido(int valor) { TbSeMensajeReceptor receptor = new TbSeMensajeReceptor(); receptor = IMensajeReceptor.Consultar(valor); receptor.Estado = "NoLeido"; return(receptor); }
public TbSeMensajeReceptor EliminarTemporal(int valor) { TbSeMensajeReceptor receptor = new TbSeMensajeReceptor(); receptor = IMensajeReceptor.Consultar(valor); receptor.Estado = "Eliminado"; return(receptor); }
public TbSeMensajeReceptor Edit(int valor) { TbSeMensajeReceptor receptor = new TbSeMensajeReceptor(); receptor = IMensajeReceptor.Consultar(valor); receptor.Estado = "Archivado"; return(receptor); }
public JsonResult Eliminar(int idMensaje) { var ids = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; TbSeMensajeReceptor re = new TbSeMensajeReceptor(); re = this.IMensajeReceptorMap.EliminarTemporal(idMensaje); this.IBitacoraMap.CrearBitacora(Convert.ToInt32(ids), "Paso un mensaje a estado eliminado", re.IdMensaje, "Mensaje"); this.IMensajeReceptorService.Update(re); return(Json(new { id = 1 })); }
public JsonResult Leidos(int pMensaje) { var ids = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; TbSeMensajeReceptor re = new TbSeMensajeReceptor(); re = this.IMensajeReceptorMap.Leido(pMensaje); this.IBitacoraMap.CrearBitacora(Convert.ToInt32(ids), "Vio un mensaje recibido", re.IdMensaje, "Mensaje"); this.IMensajeReceptorService.Update(re);; return(Json(new { id = 1 })); }
public JsonResult CambiarEstado(int valor) { var ids = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; TbSeMensajeReceptor re = new TbSeMensajeReceptor(); re = this.IMensajeReceptorMap.Edit(valor); this.IBitacoraMap.CrearBitacora(Convert.ToInt32(ids), "Paso un mensaje a estado archivado", re.IdMensaje, "Mensajes"); this.IMensajeReceptorService.Update(re); return(Json(new { id = 1 })); }
public TbSeMensajeReceptor Crear(int pIdMensaje, int pIdReceptor) { TbSeMensajeReceptor msj = new TbSeMensajeReceptor { IdMensaje = pIdMensaje, IdReceptor = pIdReceptor, Estado = "NoLeido" }; return(msj); }
public ActionResult ModificarEstados(List <int> id) { var ids = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; TbSeMensajeReceptor re = new TbSeMensajeReceptor(); foreach (var i in id) { re = this.IMensajeReceptorMap.Edit(i); this.IMensajeReceptorService.Update(re); this.IBitacoraMap.CrearBitacora(Convert.ToInt32(ids), "Archivo todos los mensajes recibidos", re.IdMensaje, "Mensajes"); } return(Json(new { })); }
public void CrearNotificacion(string msj) { var id = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; TbSeMensaje notificacion = new TbSeMensaje(msj, "NO", int.Parse(id)); List <TbSeMensajeReceptor> mensajeReceptor = new List <TbSeMensajeReceptor>(); TbSeMensajeReceptor msjs = new TbSeMensajeReceptor(); ViewData["usuarios"] = IUserRepository.GetAllByIdUsuario(74); foreach (var item in ViewData["usuarios"] as List <TbSeUsuario> ) { mensajeReceptor.Add(this.IMensajeReceptorMap.Crear(int.Parse(id), Convert.ToInt32(item.Id))); // EmailSender.emailSender(item.Correo, notificacion.Mensaje1, "Mensaje del Sistema Altiva Soluciones Seguridad"); } IMensajeReceptorRepository.Crear(mensajeReceptor); }
public ActionResult Crear(MensajeViewModel collection) { try { if (!ModelState.IsValid) { return(RedirectToAction(nameof(Index))); } var ids = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; var id = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; MensajeViewModel adjunto = new MensajeViewModel(); TbSeMensaje msj = new TbSeMensaje(); TbSeMensajeReceptor msjReceptor = new TbSeMensajeReceptor(); TbSeAdjunto AdjuntoDomain = new TbSeAdjunto(); List <TbSeAdjunto> s = new List <TbSeAdjunto>(); List <TbSeMensajeReceptor> MensajeReceptor = new List <TbSeMensajeReceptor>(); msj = this.IMensajeMap.Crear(collection, int.Parse(id)); msj = this.ImensajeService.create(msj); List <string> correos = new List <string>(); TbSeUsuario userEmail = new TbSeUsuario(); if (collection.Files != null) { foreach (var item in collection.Files) { var savePath = System.IO.Path.Combine(hostingEnvironment.WebRootPath, "Files"); // var path = $"wwwroot\\Files\\{item.FileName}"; var path = $"{savePath}\\{item.FileName}"; using (var stream = new FileStream(path, FileMode.Create)) { item.CopyTo(stream); } var ruta = $"/Files/{item.FileName}"; AdjuntoDomain = this.IAdjuntoMap.crear(msj.Id, ruta); s.Add(AdjuntoDomain); } } else { AdjuntoDomain = this.IAdjuntoMap.crear(msj.Id, ""); s.Add(AdjuntoDomain); } this.IAdjuntoService.Crear(s); foreach (var item in collection.Usuarios) { int i = int.Parse(item); userEmail = this.IUserService.GetSingleUser(i); correos.Add(userEmail.Correo); msjReceptor = this.IMensajeReceptorMap.Crear(msj.Id, i); MensajeReceptor.Add(msjReceptor); } this.IMensajeReceptorService.Crear(MensajeReceptor); // insertarNotificacion(collection, int.Parse(id), correos); this.IBitacoraMap.CrearBitacora(Convert.ToInt32(ids), "Creo un nuevo Mensaje", msj.Id, "Mensaje"); return(RedirectToAction(nameof(Index))); } catch (InvalidCastException e) { // Extract some information from this exception, and then // throw it to the parent method. AltivaLog.Log.Insertar(e.ToString(), "Error"); if (e.Source != null) { Console.WriteLine("IOException source: {0}", e.Source); } throw; } }
public TbSeMensajeReceptor Update(TbSeMensajeReceptor domain) { return(this.IMensajeReceptor.Update(domain)); }