Exemple #1
0
        public EntryTrimesterCommentsViewModel()
        {
            Classes    = new ObservableCollection <EntryClassViewModel>();
            Trimesters = new ObservableCollection <int>(MainViewModel.Instance.Parameters.Periods.Select(p => p.Trimester).Distinct());

            PeriodViewModel period = MainViewModel.Instance.Parameters.Periods.FirstOrDefault(p => p.FromDate <= DateTime.Now.Date && p.ToDate > DateTime.Now.Date.AddDays(1));

            SelectedTrimester = period != null ? period.Trimester : 1;

            Load();
        }
        public EntryTrimesterSubjectCommentsViewModel()
        {
            Classes    = new ObservableCollection <EntryClassViewModel>();
            Trimesters = new ObservableCollection <int>(MainViewModel.Instance.Parameters.Periods.Select(p => p.Trimester).Distinct());
            Teachers   = new ObservableCollection <TeacherViewModel>(MainViewModel.Instance.Parameters.Teachers);

            PeriodViewModel period = MainViewModel.Instance.Parameters.Periods.FirstOrDefault(p => p.FromDate <= DateTime.Now.Date && p.ToDate > DateTime.Now.Date.AddDays(1));

            SelectedTrimester = period != null ? period.Trimester : 1;

            if (MainViewModel.Instance.User.Teacher != null)
            {
                SelectedTeacher = MainViewModel.Instance.Parameters.Teachers.FirstOrDefault(t => t.Id == MainViewModel.Instance.User.Teacher.Id);
            }
        }