public IEnumerable <Test> getPlannedTests(DateTime date, DateChoice dayOrMonth) { if (dayOrMonth == DateChoice.day) { return(getMatchTests(t => t.TestDateTime.Date == date.Date)); } return(getMatchTests(t => (t.TestDateTime.Month == date.Month && t.TestDateTime.Year == date.Year))); }
private void filter() { if (datePicker.SelectedDate != null) //user wants to filter by planned tests { DateTime wantedDate = ((DateTime)this.datePicker.SelectedDate).DeepClone(); DateChoice choise = radioDay.IsChecked == true ? DateChoice.day : DateChoice.month; this.TestsDataGrid.ItemsSource = bl.getPlannedTests(wantedDate, choise); return; } bool car = comboBoxCarType.SelectedItem != null ? true : false; bool isHendicapped = CheckBoxIsHandicapped.IsChecked != false ? true : false; if (car || isHendicapped) //user wants to filter by car type or exessible for handicapped { if (car && !isHendicapped) { CarType c = (CarType)comboBoxCarType.SelectedItem; this.TestsDataGrid.ItemsSource = bl.getTestsList(t => t.carTypeTest == c); return; } if (isHendicapped && !car) { this.TestsDataGrid.ItemsSource = bl.getTestsList(t => t.IsAccessibleForHandicapped == true); return; } if (car && isHendicapped) { CarType c = (CarType)comboBoxCarType.SelectedItem; this.TestsDataGrid.ItemsSource = bl.getTestsList(t => (t.carTypeTest == c) && (t.IsAccessibleForHandicapped == true)); return; } } this.TestsDataGrid.ItemsSource = bl.getTestsList(); }