private void DoSearch() { if (!String.IsNullOrEmpty(SearchingContent.Trim())) { NavigationService.NavigateTo("DecksListView"); Messenger.Default.Send <SearchMessageToDeckList>(new SearchMessageToDeckList(SearchingContent.Trim())); Messenger.Default.Send <MessageToMessageBoxControl>(new MessageToMessageBoxControl(false)); SearchingContent = String.Empty; } }
public void AdvancedSearch_Using_WCFService(SearchingContent searchingContent, string startPosition, string maxRecords, List <string> catalogURLList) { contentToSearching = ""; searchingContentObject = searchingContent; maxRecordsExpectToGet = int.Parse(maxRecords); this.catalogURLList = catalogURLList; initialCatalogStutus(); foreach (string catalogURL in catalogURLList) { cswQueryServiceClient.getRecords_AdvancedSearchAsync(searchingContent, ConstantCollection.startPosition, ConstantCollection.firstTimeSearchNum, catalogURL, ConstantCollection.queryServicePerformanceScoreAtServerSide && ConstantCollection.isQueryServicePerformanceScore, ConstantCollection.calculateRelevanceAtServerSide && ConstantCollection.isCalculateRelevance); } time_BeforeSearch = DateTime.Now; }
private void Button_AdvancedSearch_Click(object sender, RoutedEventArgs e) { SearchingContent searchingContent = createSearchingContent(); setSearchConfig(); if (RecordsSearchFunctions.cannotStartSearchYet == false) { RecordsSearchFunctions.cannotStartSearchYet = true; RecordsSearchFunctions sf = new RecordsSearchFunctions(); sf.isResult_CategorizedInTabItems = classifiedWithCategories; sf.sortingRule = (ComboBox_SortBy.SelectedItem as ComboBoxItem).Content as string; if (ComboBox_SortBy.SelectedIndex != 0) { sf.sortingRule = ((ComboBoxItem)ComboBox_SortBy.SelectedItem).Content as string; } Button_AdvancedSearch.IsEnabled = false; List <string> catalogURLList = getSearchCatalogURLList(); sf.AdvancedSearch_Using_WCFService(searchingContent, ConstantCollection.startPosition, ConstantCollection.maxRecords, catalogURLList); } }
private SearchingContent createSearchingContent() { SearchingContent searchingContent = new SearchingContent(); string wordsInFullText = AllOfTheWords_Content.Text; if (wordsInFullText != null && wordsInFullText.Trim() != "") { string[] listOfKeywords = wordsInFullText.Split(' '); searchingContent.wordsInAnyText = new System.Collections.ObjectModel.ObservableCollection <string>(listOfKeywords); } string ExactPhrase = ExactPhrase_Content.Text; if (ExactPhrase != null && ExactPhrase.Trim() != "") { searchingContent.exactPhrase = ExactPhrase; } string WithoutWords = WithoutWords_Content.Text; if (WithoutWords != null && WithoutWords.Trim() != "") { string[] listOfKeywords = WithoutWords.Split(' '); searchingContent.withoutWordsInAnytext = new System.Collections.ObjectModel.ObservableCollection <string>(listOfKeywords); } string WordsInAbstract = WordsInAbstract_Content.Text; if (WordsInAbstract != null && WordsInAbstract.Trim() != "") { string[] listOfKeywords = WordsInAbstract.Split(' '); searchingContent.wordsInAbstract = new System.Collections.ObjectModel.ObservableCollection <string>(listOfKeywords); } string WordsInTitle = WordsInTitle_Content.Text; if (WordsInTitle != null && WordsInTitle.Trim() != "") { string[] listOfKeywords = WordsInTitle.Split(' '); searchingContent.wordsInTitle = new System.Collections.ObjectModel.ObservableCollection <string>(listOfKeywords); } string WordsInKeywords = Keywords_Content.Text; if (WordsInKeywords != null && WordsInKeywords.Trim() != "") { string[] listOfKeywords = WordsInKeywords.Split(' '); searchingContent.Keywords = new System.Collections.ObjectModel.ObservableCollection <string>(listOfKeywords); } ResourceType root = new ResourceType(); root.Children = new ObservableCollection <ResourceType>(); foreach (ResourceTypeTree rt in allResourceTypes) { //ResourceType node = new ResourceType(); //root.Children.Add(node); //createResourceType(rt, node); ResourceType node = createResourceType(rt); root.Children.Add(node); } root.isSelected = isAllResourceTypeSelected; searchingContent.resourceTypesTree = root; searchingContent.isNoResourceTypeSelected = isNoResourceTypeSelected; string NorthString = text_NorthBound.Text; string WestString = text_WestBound.Text; string SouthString = text_SouthBound.Text; string EastString = text_EastBound.Text; try { double NorthValue = double.Parse(NorthString); double SouthValue = double.Parse(SouthString); double EastValue = double.Parse(EastString); double WestValue = double.Parse(WestString); if (NorthValue.Equals(90.0) && SouthValue.Equals(-90.0) && EastValue.Equals(180.0) && WestValue.Equals(-180.0)) { searchingContent.where_isAnyWhere = true; } else { searchingContent.where_isAnyWhere = false; ComboBoxItem cbi = (ComboBoxItem)ComboBox_WhereType.SelectedItem; string item = cbi.Content as string; if (item.Equals("encloses")) { searchingContent.where_Relationship = "BBOX"; } else if (item.Equals("intersects")) { searchingContent.where_Relationship = "Intersects"; } else if (item.Equals("is")) { searchingContent.where_Relationship = "Equals"; } else if (item.Equals("is fully outside of")) { searchingContent.where_Relationship = "Disjoint"; } else if (item.Equals("overlaps")) { searchingContent.where_Relationship = "Overlaps"; } searchingContent.where_North = text_NorthBound.Text; searchingContent.where_West = text_WestBound.Text; searchingContent.where_South = text_SouthBound.Text; searchingContent.where_East = text_EastBound.Text; } if (RadioButton_Time_Anytime.IsChecked == true) { searchingContent.when_isAnytime = true; } else { searchingContent.when_isAnytime = false; if (RadioButton_Time_MetadataChangeDate.IsChecked == true && datePicker_Time_MetadataChangeDate_From.SelectedDate != null && datePicker_Time_MetadataChangeDate_To.SelectedDate != null) { searchingContent.when_TimeType = "MetadataChangeDate"; DateTime dt_from = (DateTime)datePicker_Time_MetadataChangeDate_From.SelectedDate; DateTime dt_to = (DateTime)datePicker_Time_MetadataChangeDate_To.SelectedDate; if (dt_from != null) { string from_time = dt_from.ToString("yyyy-MM-dd"); searchingContent.when_FromTime = from_time + "T00:00:00"; } if (dt_to != null) { string to_time = dt_to.ToString("yyyy-MM-dd"); searchingContent.when_ToTime = to_time + "T23:59:59"; } } else if (RadioButton_Time_TemporalExtent.IsChecked == true && datePicker_Time_TemporalExtent_From.SelectedDate != null && datePicker_Time_TemporalExtent_To.SelectedDate != null) { searchingContent.when_TimeType = "TempExtent"; DateTime dt_from = (DateTime)datePicker_Time_TemporalExtent_From.SelectedDate; DateTime dt_to = (DateTime)datePicker_Time_TemporalExtent_To.SelectedDate; if (dt_from != null) { string from_time = dt_from.ToString("yyyy-MM-dd"); searchingContent.when_FromTime = from_time + "T00:00:00"; } if (dt_to != null) { string to_time = dt_to.ToString("yyyy-MM-dd"); searchingContent.when_ToTime = to_time + "T00:00:00"; } } } } catch (Exception e) { e.GetType().ToString(); searchingContent.where_isAnyWhere = true; } if (RadioButton_OnlyDataCore.IsChecked == true) { searchingContent.resourceIdentificationKeywords_GEOSSDataCORE = ConstantCollection.resourceIdentificationKeywords_GEOSSDataCORE_ONLY; } else if (RadioButton_NonDataCore.IsChecked == true) { searchingContent.resourceIdentificationKeywords_GEOSSDataCORE = ConstantCollection.resourceIdentificationKeywords_GEOSSDataCORE_NON; } else if (RadioButton_BothDataCoreAndNonDataCore.IsChecked == true) { searchingContent.resourceIdentificationKeywords_GEOSSDataCORE = ConstantCollection.resourceIdentificationKeywords_GEOSSDataCORE_BOTH; } return(searchingContent); }