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();
        }
        private async void SearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            if (args.ChosenSuggestion is GenericMusicItemViewModel g)
            {
                if (g.Title.IsNullorEmpty())
                {
                    return;
                }
                if (g.InnerType == MediaType.Placeholder)
                {
                    SearchBox.Text = g.Title;
                    return;
                }
                if (g.InnerType == MediaType.Album)
                {
                    var view   = new AlbumViewDialog(await g.FindAssociatedAlbumAsync());
                    var result = await view.ShowAsync();
                }
                else
                {
                    var t = Task.Run(async() =>
                    {
                        await SQLOperator.Current().SaveSearchHistoryAsync(g.Title);
                    });
                    var dialog = new SearchResultDialog(g);
                    var result = await dialog.ShowAsync();

                    if (result == ContentDialogResult.Secondary)
                    {
                        ShowModalUI(true, "Prepare to Show");
                        var view = new AlbumViewDialog(await g.FindAssociatedAlbumAsync());
                        ShowModalUI(false);
                        result = await view.ShowAsync();
                    }
                }
            }
            else
            {
                if (Context.SearchItems.IsNullorEmpty())
                {
                    var dialog = new SearchResultDialog();
                    var result = await dialog.ShowAsync();
                }
                else
                {
                    if (Context.SearchItems[0].InnerType == MediaType.Placeholder)
                    {
                        SearchBox.Text = Context.SearchItems[0].Title;
                        return;
                    }
                    var t = Task.Run(async() =>
                    {
                        await SQLOperator.Current().SaveSearchHistoryAsync(Context.SearchItems[0].Title);
                    });
                    if (Context.SearchItems[0].InnerType == MediaType.Album)
                    {
                        var view   = new AlbumViewDialog(await Context.SearchItems[0].FindAssociatedAlbumAsync());
                        var result = await view.ShowAsync();
                    }
                    else
                    {
                        var dialog = new SearchResultDialog(Context.SearchItems[0]);
                        var result = await dialog.ShowAsync();

                        if (result == ContentDialogResult.Secondary)
                        {
                            ShowModalUI(true, "Prepare to Show");
                            var view = new AlbumViewDialog(await Context.SearchItems[0].FindAssociatedAlbumAsync());
                            ShowModalUI(false);
                            result = await view.ShowAsync();
                        }
                    }
                }
            }
            sender.Text = string.Empty;
        }