private void AtAppStart() { SubjectsX = Action.GetAverages(); foreach (Subjects b in SubjectsX) { SPick.Items.Add(b.Subject); } Marks = new ObservableCollection <Mark>(Action.QueryMarks().ToList()); string subj = ""; for (int i = 0; i < Marks.Count(); i++) { for (int a = 0; a < SubjectsX.Count(); a++) { if (Marks[i].Subject == SubjectsX[a].SubjectID) { subj = SubjectsX[a].Subject; } } GradeClass NGrade = new GradeClass(Marks[i].Grade, Marks[i].Weight, subj, Marks[i].Subject); Grades.Add(NGrade); } AddedMarks.ItemsSource = Grades; AllMarks.ItemsSource = SubjectsX; }
public void WriteAllMarks() { dbAction Action = new dbAction(); IEnumerable <Mark> Mar = Action.QueryMarks(); foreach (Mark a in Mar) { switch (a.Subject) { case 1: Console.WriteLine("English: " + a.Grade); Console.WriteLine("Weight: " + a.Weight); Console.WriteLine("ID: " + a.ID); Console.WriteLine(); break; case 2: Console.WriteLine("French: " + a.Grade); Console.WriteLine("Weight: " + a.Weight); Console.WriteLine("ID: " + a.ID); Console.WriteLine(); break; case 3: Console.WriteLine("PE: " + a.Grade); Console.WriteLine("Weight: " + a.Weight); Console.WriteLine("ID: " + a.ID); break; } } }