예제 #1
0
        public static void RemindEvents(EscritoGrupo pg)
        {
            DateTime now            = DateTime.Now;
            DateTime deadline       = pg.Date;
            int      daysDifference = (deadline - now).Days;
            string   dayName        = deadline.ToString("dddd", new CultureInfo("es-ES"));

            if (daysDifference <= 5)
            {
                string   title;
                string   body;
                DateTime sent = DateTime.Now;

                if (daysDifference == 1)
                {
                    title = "Escrito próximo";
                    body  = "¡Tenés un escrito mañana!";
                }
                else
                {
                    title = "Escrito próximo";
                    body  = "¡Tenés un escrito este " + dayName + "!";
                }


                foreach (Alumno alumno in pg.Grupo.Alumnos)
                {
                    foreach (Token token in alumno.Token)
                    {
                        SendNotification(token.Content, title, body);
                    }
                }
            }
        }
예제 #2
0
 public static void SendGroupNotification(EscritoGrupo tg, string title, string body)
 {
     foreach (Alumno alumno in tg.Grupo.Alumnos)
     {
         if (alumno.Token != null)
         {
             foreach (Token token in alumno.Token)
             {
                 SendNotification(token.Content, title, body);
             }
         }
     }
 }