Exemplo n.º 1
0
 //AddBarn - tilføjer Barn til Liste og køre igennem Persistency Metode: Post
 public void AddBarn(Barn BAdd)
 {
     BarnsCollection.Add(BAdd);
     PersistencyService.PostBarnAsync(BAdd);
     BarnsCollection.Clear();
     GetBarnASync();
 }
        // Opret kalender skaber alle vacciner og notifikation til barnet.
        public void OpretKalender(Barn kopret)
        {
            List <VaccineView> vacViewList = Instance.VaccineViewCollection.ToList();

            foreach (VaccineView v in vacViewList)
            {
                DateTime injDate = kopret.Barn_Foedsel.AddMonths(v.TidMdr);
                Kalender k       = new Kalender(injDate, kopret.Barn_Id, v.Vac_Id);
                PersistencyService.PostKalenderAsync(k);
                ToastTemplateType toastTemplate = ToastTemplateType.ToastText02;
                XmlDocument       toastXml      = ToastNotificationManager.GetTemplateContent(toastTemplate);

                IXmlNode toasttextelements = toastXml.GetElementsByTagName("text").FirstOrDefault();
                if (k.Dato > DateTime.Today)
                {
                    toasttextelements.AppendChild(toastXml.CreateTextNode($"{kopret.Barn_Navn} skal have vaccine {v.Vac_Navn} den {k.Dato:dd-MM-yyyy} "));


                    DateTime dueTime = k.Dato.AddMonths(-1);
                    //DateTime dueTime = DateTime.Now.AddSeconds(10);
                    if (dueTime < DateTime.Today)
                    {
                        var plusdate = (DateTime.Now - dueTime).TotalDays;
                        ScheduledToastNotification scheduledToast = new ScheduledToastNotification(toastXml,
                                                                                                   dueTime.Date.AddDays(plusdate + 1));

                        ToastNotificationManager.CreateToastNotifier().AddToSchedule(scheduledToast);
                    }
                    else
                    {
                        ScheduledToastNotification scheduledToast = new ScheduledToastNotification(toastXml,
                                                                                                   dueTime.AddDays(+1));

                        ToastNotificationManager.CreateToastNotifier().AddToSchedule(scheduledToast);
                    }
                }
            }
        }
Exemplo n.º 3
0
 //RemoveBar - Fjerner barn fra liste og køre gennem Peristency: Delete
 public void RemoveBarn(Barn BRemove)
 {
     BarnsCollection.Remove(BRemove);
     PersistencyService.DeleteBarnAsync(BRemove);
 }