public SpecialytiesGridPage(DBL d) { InitializeComponent(); dbl = d; Specialties = new ObservableCollection <Specialty>(); if (dbl.accounttype == DBL.AccountType.Dean) { foreach (Specialty s in dbl.GiveSpecialties()) { if (s.University == dbl.LoggedPerson.University && s.Faculty == ((Dean)dbl.LoggedPerson).Faculty) { Specialties.Add(s); } } } else { foreach (Specialty s in dbl.GiveSpecialties()) { if (s.University == dbl.LoggedPerson.University) { Specialties.Add(s); } } } SpecialtiesGrid.ItemsSource = Specialties; }
private void Name_Field_TextChanged(object sender, TextChangedEventArgs e) { foreach (Specialty s in dbl.GiveSpecialties()) { if (s.Name == Name_Field.Text && specialty.Name != Name_Field.Text) { Success.Visibility = Visibility.Hidden; NameError.Visibility = Visibility.Visible; } else { NameError.Visibility = Visibility.Hidden; } } }
private void Faculty_Box_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Faculty_Box.SelectedIndex != (-1)) { SpecialtyBoxList = new List <Specialty>(); Specialty_Box.Items.Clear(); foreach (Specialty s in dbl.GiveSpecialties()) { if (s.Faculty == faculties[Faculty_Box.SelectedIndex]) { SpecialtyBoxList.Add(s); } } foreach (Specialty s in SpecialtyBoxList) { Specialty_Box.Items.Add(s.Name); } } else { SpecialtyBoxList = new List <Specialty>(); Specialty_Box.Items.Clear(); } }