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; }
private void SelectedClass_SelectedStudentChangedEvent() { EntryPeriodCommentsViewModel entryPeriodComments = (EntryPeriodCommentsViewModel)DataContext; PeriodCommentModel periodComment = PeriodCommentModel.Read(entryPeriodComments.SelectedPeriod, entryPeriodComments.SelectedClass.SelectedStudent.Student); if (periodComment != null) { switch (periodComment.DisciplineReport) { case 1: Discipline1Radio.IsChecked = true; break; case 2: Discipline2Radio.IsChecked = true; break; case 3: Discipline3Radio.IsChecked = true; break; case 4: DisciplineARadio.IsChecked = true; break; } switch (periodComment.StudiesReport) { case 1: Studies1Radio.IsChecked = true; break; case 2: Studies2Radio.IsChecked = true; break; case 3: Studies3Radio.IsChecked = true; break; case 4: StudiesARadio.IsChecked = true; break; } } else { Studies1Radio.IsChecked = true; Discipline1Radio.IsChecked = true; } StudiesTextBox.Text = ""; DisciplineTextBox.Text = ""; }
private void SavePeriodComments(EntryPeriodCommentsViewModel entryPeriodComments) { PeriodCommentModel periodComment = new PeriodCommentModel() { IdPeriod = entryPeriodComments.SelectedPeriod.Id, IdStudent = entryPeriodComments.SelectedClass.SelectedStudent.Student.Id, Year = entryPeriodComments.SelectedPeriod.Year, }; if (Studies1Radio.IsChecked ?? false) { periodComment.StudiesReport = 1; } else if (Studies2Radio.IsChecked ?? false) { periodComment.StudiesReport = 2; } else if (Studies3Radio.IsChecked ?? false) { periodComment.StudiesReport = 3; } else if (StudiesARadio.IsChecked ?? false) { periodComment.StudiesReport = 4; } if (Discipline1Radio.IsChecked ?? false) { periodComment.DisciplineReport = 1; } else if (Discipline2Radio.IsChecked ?? false) { periodComment.DisciplineReport = 2; } else if (Discipline3Radio.IsChecked ?? false) { periodComment.DisciplineReport = 3; } else if (DisciplineARadio.IsChecked ?? false) { periodComment.DisciplineReport = 4; } PeriodCommentModel.Save(new List <PeriodCommentModel>() { periodComment }, entryPeriodComments.SelectedPeriod.Year); }