Exemplo n.º 1
0
        public static void DeleteYear(int year)
        {
            TrimesterCommentModel.DeleteAll(year);
            TrimesterSubjectCommentModel.DeleteAll(year);
            SemiTrimesterCommentModel.DeleteAll(year);
            PeriodCommentModel.DeleteAll(year);
            MarkModel.DeleteAll(year);
            TeacherClassModel.DeleteAll(year);
            LevelSubjectModel.DeleteAll(year);
            SubjectTeacherModel.DeleteAll(year);
            SemiTrimesterModel.DeleteAll(year);
            PeriodModel.DeleteAll(year);
            StudentModel.DeleteAll(year);
            ClassModel.DeleteAll(year);
            LevelModel.DeleteAll(year);
            SubjectModel.DeleteAll(year);
            TeacherModel.DeleteAll(year);
            YearParametersModel.DeleteAll(year);
            YearModel.Delete(year);

            MessageBox.Show("Suppresion de l'année réussie.", "Réussite", MessageBoxButton.OK, MessageBoxImage.Information);

            MainViewModel.Instance.LoadYears();
            MainViewModel.Instance.SelectedYear = year - 1;
        }
Exemplo n.º 2
0
        private static void CreateSemiTrimesters(MainViewModel mainViewModel, int year)
        {
            List <SemiTrimesterViewModel> semiTrimesters = new List <SemiTrimesterViewModel>();

            foreach (SemiTrimesterViewModel semiTrimester in MainViewModel.Instance.Parameters.SemiTrimesters)
            {
                semiTrimesters.Add(new SemiTrimesterViewModel()
                {
                    Name    = semiTrimester.Name,
                    Period1 = mainViewModel.Parameters.Periods.FirstOrDefault(p => p.Number == semiTrimester.Period1.Number),
                    Period2 = mainViewModel.Parameters.Periods.FirstOrDefault(p => p.Number == semiTrimester.Period2.Number),
                    Year    = year,
                });
            }
            SemiTrimesterModel.Save(semiTrimesters);
            mainViewModel.Parameters.LoadSemiTrimesters();
        }