Ejemplo n.º 1
0
 public void SupprimerEvent(Evenement e)
 {
     if (e.DateDebut.Year == MonthData.Month.Year && e.DateDebut.Month == MonthData.Month.Month)
     {
         MonthData.Data[new DateTime(e.DateDebut.Year, e.DateDebut.Month, e.DateDebut.Day)].Remove(e);
         MonthData.StoreData();
     }
     else
     {
         CalendarInfo ci = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{e.DateDebut.Month}-{e.DateDebut.Year}.json", new DateTime(e.DateDebut.Year, e.DateDebut.Month, 1));
         ci.Data[new DateTime(e.DateDebut.Year, e.DateDebut.Month, e.DateDebut.Day)].Remove(e);
         ci.StoreData();
     }
 }
Ejemplo n.º 2
0
 public void SupprimerTache(Tache t)
 {
     if (t.dateDebut.Year == MonthData.Month.Year && t.dateDebut.Month == MonthData.Month.Month)
     {
         MonthData.Data[new DateTime(t.dateDebut.Year, t.dateDebut.Month, t.dateDebut.Day)].Remove(t);
         MonthData.StoreData();
     }
     else
     {
         CalendarInfo ci = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{t.dateDebut.Month}-{t.dateDebut.Year}.json", new DateTime(t.dateDebut.Year, t.dateDebut.Month, 1));
         ci.Data[new DateTime(t.dateDebut.Year, t.dateDebut.Month, t.dateDebut.Day)].Remove(t);
         ci.StoreData();
     }
 }
Ejemplo n.º 3
0
 public void AddEvenement(Evenement e)
 {
     if (this.user == null)
     {
         throw new Exception("User account is not loaded");
     }
     if (e.DateDebut.Month == this.MonthData.Month.Month && e.DateDebut.Year == this.MonthData.Month.Year)
     {
         this.MonthData.AddEvenement(new DateTime(e.DateDebut.Year, e.DateDebut.Month, e.DateDebut.Day), e);
         MainWindow.CalendarField.UpdateCalendar();
         MainWindow.TachesEventsField.Update();
     }
     else
     {
         CalendarInfo ci = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{e.DateDebut.Month}-{e.DateDebut.Year}.json", new DateTime(e.DateDebut.Year, e.DateDebut.Month, 1));
         ci.AddEvenement(new DateTime(e.DateDebut.Year, e.DateDebut.Month, e.DateDebut.Day), e);
         ci.StoreData();
     }
     foreach (Notif n in e.Alarms)
     {
         OtherThread.sendData(ConvertToNotification(n, "evenment", e.DateDebut, e.Title));
     }
 }
Ejemplo n.º 4
0
 public void AddTache(Tache t)
 {
     if (this.user == null)
     {
         throw new Exception("User account is not loaded");
     }
     if (t.dateDebut.Month == this.MonthData.Month.Month && t.dateDebut.Year == this.MonthData.Month.Year)
     {
         this.MonthData.AddTache(new DateTime(t.dateDebut.Year, t.dateDebut.Month, t.dateDebut.Day), t);
         MainWindow.CalendarField.UpdateCalendar();
         MainWindow.TachesEventsField.Update();
     }
     else
     {
         CalendarInfo ci = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{t.dateDebut.Month}-{t.dateDebut.Year}.json", new DateTime(t.dateDebut.Year, t.dateDebut.Month, 1));
         ci.AddTache(new DateTime(t.dateDebut.Year, t.dateDebut.Month, t.dateDebut.Day), t);
         ci.StoreData();
     }
     foreach (Notif n in t.Alarms)
     {
         OtherThread.sendData(ConvertToNotification(n, "tache", t.dateDebut, t.title));
     }
 }