public ShowAllMothers()
        {
            SortMotherBy sortBy = new SortMotherBy();

            DataContext = sortBy;
            InitializeComponent();
            bl = factoryBL.get_bl();
            dataGrid.ItemsSource = bl.get_mother_list();
            comboBox.ItemsSource = bl.get_sort_mothers_by_list();
        }
Beispiel #2
0
        public List <Mother> get_mother_list(SortMotherBy sortBy)
        {
            List <Mother> mother_list = d2.get_mother_list();

            if (sortBy == SortMotherBy.Id)
            {
                mother_list.Sort((mother1, mother2) => (mother1.Id.CompareTo(mother2.Id)));
            }
            if (sortBy == SortMotherBy.MaxTravelDistance)
            {
                mother_list.Sort((mother1, mother2) => (mother1.Max_Travel_Distance.CompareTo(mother2.Max_Travel_Distance)));
            }
            if (sortBy == SortMotherBy.LastName)
            {
                mother_list.Sort((mother1, mother2) => (mother1.Family_Name.CompareTo(mother2.Family_Name)));
            }
            return(mother_list);
        }
 private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     sortBy = (SortMotherBy)comboBox.SelectedItem;
     dataGrid.ItemsSource = bl.get_mother_list(sortBy);
 }