Esempio n. 1
0
        public ObservableCollection <Courseoccurrence> computeCourseOccurences()
        {
            ObservableCollection <Courseoccurrence> courseOccurenceColl = new ObservableCollection <Courseoccurrence>();
            DateTime startDate = this.StartDate;
            DateTime endDate   = this.FinishDate;

            TimeSpan diff = endDate - startDate;
            int      days = diff.Days;

            for (var i = 0; i <= days; ++i)
            {
                DateTime testDate = startDate.AddDays(i);
                if ((int)testDate.DayOfWeek == this.DayOfWeek)
                {
                    //on va ajouter l'occurence du cours à la collection
                    Courseoccurrence currentCO = new Courseoccurrence();
                    currentCO.Course   = this;
                    currentCO.Date     = testDate;
                    currentCO.Presence = null;
                    courseOccurenceColl.Add(currentCO);
                }
            }

            Console.WriteLine("oui la méthode compute a été executée");
            return(courseOccurenceColl);
        }
Esempio n. 2
0
        /**
         * Création onglet présence
         */
        public void CreateTabPresence(Course course, Courseoccurrence courseoccurrence)
        {
            var tab = new TabItem()
            {
                Header  = "Présences - " + course.Code + " - " + courseoccurrence.Date.ToString("dd/MM/yy").Trim(),
                Content = new PresenceView(course, courseoccurrence)
            };

            tabControl.Items.Add(tab);
            Dispatcher.InvokeAsync(() => tab.Focus());
        }
Esempio n. 3
0
 //////// Définiton de la commande de création tab présence
 //////// + résupération de la "commande paramater" (voir XAML)
 //////// on récupère courseOccurence via l'attribut Paramater dans le controle WPF
 private void DefineCommandDisplayCourseDetails()
 {
     CourseOccurenceClicked = new RelayCommand <string>((occurenceSelected) =>
     {
         DateTime occurenceDate     = GetOccurenceByDate(occurenceSelected);
         Courseoccurrence clickedCo = GetCourseOccurenceByDate(occurenceDate);
         App.currentCourse          = this.course;
         App.currentCo = clickedCo;
         App.Messenger.NotifyColleagues(App.MSG_SHOW_PRESENCE_FORM);
     });
 }
        /**
         * Construit une collection observable de StudentAndPresence (ceci est une classe interne)
         * pour la ListeView de la vue PresenceView.XAML
         **/
        private ObservableCollection <StudentAndPresence> BuildStudentAndPresence(Courseoccurrence courseOccurrence)
        {
            ObservableCollection <StudentAndPresence> res = new ObservableCollection <StudentAndPresence>();

            foreach (Student st in StudentsSubscribedInCourse)
            {
                //pour chaque étudiant on regarde s'il possède une présence
                Presence           presenceTemp       = new Presence(st.Id, courseOccurrence.Id, SetStudentPresent(st));
                StudentAndPresence studentAndPresence = new StudentAndPresence(st, presenceTemp);
                res.Add(studentAndPresence);
            }
            return(res);
        }
        public PresenceView(Course course, Courseoccurrence courseOccurrence)
        {
            this.courseOccurrence = courseOccurrence;
            InitializeComponent();
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }
            DataContext = this;

            StudentsSubscribedInCourse = course.Students.ToList();
            PresencesInOccurence       = courseOccurrence.Presence.ToList();
            StAndPresence = BuildStudentAndPresence(courseOccurrence);
            //commande de sauvegarde
            Save = new RelayCommand(SaveAction);
        }