private void DoSearch(bool isSpecialistSearch) { ClearAllResults(); if (isSpecialistSearch ? InvalidInputForSpecialistAppointment() : InvalidInputForAppointment()) { MessageBox.Show("Invalid input."); return; } DateTime startDate = DateTime.ParseExact(GetStartDatePicker(isSpecialistSearch).SelectedDate.Value.ToString("MM/dd/yyyy") + AllConstants.DayStart, "MM/dd/yyyy HH:mm", null); DateTime endDate = DateTime.ParseExact(GetEndDatePicker(isSpecialistSearch).SelectedDate.Value.ToString("MM/dd/yyyy") + AllConstants.DayEnd, "MM/dd/yyyy HH:mm", null); Doctor chosenDoctor = GetChosenDoctor(isSpecialistSearch); RecommendationRequestDto recommendationRequestDto = new RecommendationRequestDto() { DoctorId = chosenDoctor.Id, SpecialtyId = chosenDoctor.DepartmentId, TimeInterval = new TimeInterval(startDate, endDate), Preference = GetRecommendationPreference(isSpecialistSearch ? specialistPriorityComboBox : PriorityComboBox) }; List <RecommendationDto> searchResults = schedulingController.GetAppointments(recommendationRequestDto); if (!IsValidRequest(isSpecialistSearch, searchResults)) { MessageBox.Show(isSpecialistSearch ? "There is no room with required equipment!" : "There are no available appointments for chosen period!"); return; } ISearchResultStrategy strategy = new SearchResultStrategy(new AppointmentSearchResult(searchResults)); SearchResultDialog appointmentDialog = new SearchResultDialog(strategy.GetSearchResult(), SearchType.AppointmentSearch); appointmentDialog.ShowDialog(); }
public void Equipment_Search(object sender, RoutedEventArgs e) { ClearAllResults(); if (NoEquipmentTypeIsPicked()) { MessageBox.Show("No equipment is picked."); return; } ISearchResultStrategy strategy = new SearchResultStrategy(new EquipmentSearchResult(equipmentSearchComboBox.Text)); SearchResultDialog equipmentDialog = new SearchResultDialog(strategy.GetSearchResult(), SearchType.EquipmentSearch); equipmentDialog.ShowDialog(); }
public void Medication_Search(object sender, RoutedEventArgs e) { ClearAllResults(); if (NoMedicationNameIsPicked()) { MessageBox.Show("No medication is picked."); return; } ISearchResultStrategy strategy = new SearchResultStrategy(new MedicationSearchResult(medicationSearchComboBox.Text)); SearchResultDialog medicationDialog = new SearchResultDialog(strategy.GetSearchResult(), SearchType.MedicationSearch); medicationDialog.ShowDialog(); }
private void Basic_Search(object sender, RoutedEventArgs e) { ClearAllResults(); List <MapObject> searchResults = mapObjectController.SearchMapObjects(searchInputTB.Text, searchInputComboBox.Text); if (searchResults.Count == 0) { MessageBox.Show("There is nothing we could find."); return; } ISearchResultStrategy strategy = new SearchResultStrategy(new MapObjectSearchResult(searchResults)); SearchResultDialog searchResultDialog = new SearchResultDialog(strategy.GetSearchResult(), SearchType.MapObjectSearch); searchResultDialog.ShowDialog(); }