public void mostrarNotificaciones(int idNotficacion, string titulo, string mensaje, string prioridad, string tipo, string hora, string fecha, int idPerfil) { this.perfil = idPerfil; this.idnotificacion = idNotficacion; this.Opacity = 0.0; this.StartPosition = FormStartPosition.Manual; string fnombre; for (int i = 1; i < 10; i++) { fnombre = "alerta" + i.ToString(); FrmNotificaciones frm = (FrmNotificaciones)Application.OpenForms[fnombre]; if (frm == null) { this.Name = fnombre; this.x = Screen.PrimaryScreen.WorkingArea.Width - this.Width + 15; this.y = Screen.PrimaryScreen.WorkingArea.Height - this.Height * i - 5 * i; this.Location = new Point(this.x, this.y); break; } } this.x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5; this.lblTitulo.Text = generarTituloNotificacion(tipo); generarMensajeYBackground(tipo, prioridad, "dennis"); var fechaConvertida = DateTime.ParseExact(fecha, "dd-MM-yyyy", new CultureInfo("es-ES")); this.lblHora.Text = $"{fechaConvertida.ToString("dd MMM", new CultureInfo("es-ES"))} {hora}"; this.Show(); this.accion = enmAcciones.empezar; this.timer1.Interval = 1; timer1.Start(); }
//Trabajando las notificaciones public void obtenerNotificaciones() { CapaNegocio.notificaciones.Index obj = new CapaNegocio.notificaciones.Index(); //COMENTADO TEMPORALMENTE obj.main(); var notificaciones = obj.notificaciones(); foreach (var item in notificaciones) { FrmNotificaciones frmNotif = new FrmNotificaciones(); frmNotif.mostrarNotificaciones(item.Id, item.Titulo, item.Mensaje, item.Prioridad, item.Tipo, item.Hora, item.Fecha, item.Id_perfil); } }