Exemple #1
0
        public void UpdateWithTaches(int day, CalendarInfo c)
        {
            activitiesStack.Children.Clear();
            DateTime     d     = new DateTime(c.Month.Year, c.Month.Month, day);
            List <Tache> datal = c.GetDayTaches(c.Month.Year, c.Month.Month, day);

            if (datal.Count != 0)
            {
                Dictionary <string, List <Tache> > actDictionary = new Dictionary <string, List <Tache> >();
                actDictionary[""] = new List <Tache>();
                foreach (string s in DataSupervisor.ds.user.Activities.Keys)
                {
                    actDictionary[s] = new List <Tache>();
                }
                foreach (Tache t in datal)
                {
                    if (actDictionary.ContainsKey(t.Activitee))
                    {
                        actDictionary[t.Activitee].Add(t);
                    }
                    else
                    {
                        actDictionary[""].Add(t);
                    }
                }

                foreach (KeyValuePair <string, List <Tache> > kv in actDictionary)
                {
                    if (kv.Key == "")
                    {
                        continue;
                    }
                    StackActivite s     = new StackActivite();
                    string        color = "#FFFFFF";
                    if (DataSupervisor.ds.user.Activities.ContainsKey(kv.Key))
                    {
                        color = DataSupervisor.ds.user.Activities[kv.Key];
                    }
                    s.LoadData(kv.Key, color, kv.Value);
                    activitiesStack.Children.Add(s);
                }
            }
            else
            {
                TextBlock tb = new TextBlock()
                {
                    Text                = "Vous n'avez pas ajouté de tâches",
                    FontSize            = 16,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Margin              = new Thickness(0, 20, 0, 0)
                };
                activitiesStack.Children.Add(tb);
            }
        }
 public void LoadMonthData(int year, int month)
 {
     if (this.user == null)
     {
         throw new Exception("User account is not loaded");
     }
     if (this.MonthData != null)
     {
         this.MonthData.StoreData();
     }
     this.MonthData = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{month}-{year}.json", new DateTime(year, month, 1));
 }
 public List <Evenement> GetDayEvents(int day, int month, int year)
 {
     if (MonthData.Month.Month == month && MonthData.Month.Year == year)
     {
         return(MonthData.GetDayEvents(year, month, day));
     }
     else
     {
         CalendarInfo data = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{month}-{year}.json", new DateTime(year, month, day));
         return(data.GetDayEvents(year, month, day));
     }
 }
Exemple #4
0
 private void ParseMonthEvenementsData(CalendarInfo data)
 {
     if (jourActive)
     {
         this.jourSemainField.Content = affichageparJourControl;
         affichageparJourControl.UpdateWithEvents(this.TachemonthYearSelectRegion.selectedDay, data);
     }
     else
     {
         this.jourSemainField.Content = affichageparSemaineControl;
         affichageparSemaineControl.UpdateWithEvents(this.TachemonthYearSelectRegion.selectedWeek, this.TachemonthYearSelectRegion.Month, this.TachemonthYearSelectRegion.Year);
     }
 }
 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();
     }
 }
 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();
     }
 }
 // Saves the data in user object and close it
 public void LogOut()
 {
     OtherThread.stop();
     if (this.user == null)
     {
         return;
     }
     this.SaveUserProfile();
     this.user                 = null;
     this.MonthData            = null;
     this.Contactes            = null;
     MainWindow.settingsField  = null;
     MainWindow.ContactesField = null;
     userPasswrd               = "";
 }
        public List <Tache> GetDayTaches(int day, int month, int year)
        {
            List <Tache> lst;

            if (MonthData.Month.Month == month && MonthData.Month.Year == year)
            {
                lst = MonthData.GetDayTaches(year, month, day);
            }
            else
            {
                CalendarInfo data = new CalendarInfo(this.currentUserDataPath + $"\\MonthData{month}-{year}.json", new DateTime(year, month, day));
                lst = data.GetDayTaches(year, month, day);
            }
            return(lst);
        }
Exemple #9
0
        public void ParseMonthEvenementsData(CalendarInfo monthDataProvider)
        {
            Dictionary <DateTime, List <Evenement> > events = monthDataProvider.getMonthEvenements();
            string   order = (string)((ComboBoxItem)OrderSelectionComboBox.SelectedValue).Content;
            DateTime m     = monthDataProvider.Month;

            SetMonth(year: m.Year, month: m.Month);
            foreach (KeyValuePair <DateTime, List <Evenement> > kv in events)
            {
                List <Evenement> lt = kv.Value;
                if (selectedActivitie != "Toutes les activités")
                {
                    lt = DataSupervisor.FilterByActivities(lt, selectedActivitie);
                }
                switch (order)
                {
                case "Date":
                    lt.Sort(new EventTimeComparer());
                    break;

                case "Priorité":
                    lt.Sort(new EventUrgenceComparer());
                    break;
                }
                this.SetDayEvenements(kv.Value, kv.Key);
            }
            Dictionary <DateTime, Dictionary <string, Object> > dict = new Dictionary <DateTime, Dictionary <string, Object> >();

            foreach (KeyValuePair <DateTime, string> kv in DataSupervisor.ds.user.JoursFeries)
            {
                Dictionary <string, Object> dict2 = new Dictionary <string, Object>();
                string color = "#555555";
                dict2["color"]    = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));
                dict2["dayTitle"] = kv.Value;
                dict[kv.Key]      = dict2;
            }
            this.SetDaysCaptions(dict);
        }
Exemple #10
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));
     }
 }
Exemple #11
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));
     }
 }