public void SetDataSourceForLearningDays() { ICollection <LearningDays> learningDaysAsSource = new List <LearningDays>(); try { using (StudentsOrgEntities entities = new StudentsOrgEntities()) { foreach (var learnDay in entities.LearningDays) { learningDaysAsSource.Add(learnDay); } } } catch (Exception) { MessageBox.Show("Wystapil blad z \"Dniami uczenia\". Powiadom administratora bazy danych"); App.Current.Shutdown(); } ICollection <LearnDayAdvenced> learnDayAdvenceds = new List <LearnDayAdvenced>(); foreach (var learningDay in learningDaysAsSource) { LearnDayAdvenced advencedLearnDay = new LearnDayAdvenced(learningDay); learnDayAdvenceds.Add(advencedLearnDay); } this.DataGrid.ItemsSource = learnDayAdvenceds; }
public void SetDataSourceForExams() { ICollection <Exams> examsAsSource = new List <Exams>(); try { using (StudentsOrgEntities entities = new StudentsOrgEntities()) { foreach (var exam in entities.Exams) { examsAsSource.Add(exam); } } } catch (Exception e) { MessageBox.Show(e.Message, "Wystapil blad z egzaminami. Powiadom administratora bazy danych"); App.Current.Shutdown(); } this.DataGrid.ItemsSource = OrderExamByDate(examsAsSource); }
public void SetDataSourceForSubjects() { try { using (StudentsOrgEntities entities = new StudentsOrgEntities()) { ICollection <DataBase.Subjects> subjects = new List <Subjects>(); foreach (var subject in entities.Subjects) { subjects.Add(subject); } this.DataGrid.ItemsSource = OrderSubjectsByDate(subjects); } } catch (Exception e) { MessageBox.Show(e.Message, "Nie można nawiązać połączenia."); App.Current.Shutdown(); } }