/// <summary> /// Searches the specified search page. /// </summary> /// <param name="searchPage">The search page.</param> public override void Search(object searchPage) { if (this.TimelineSearches == null) { this.TimelineSearches = new List <UPSearchPageModelControllerPreparedSearch>(); foreach (ConfigTimelineInfoArea timelineInfoArea in this.TimelineConfiguration.InfoAreas) { UPSearchPageModelControllerPreparedSearch preparedSearch = new UPSearchPageModelControllerPreparedSearch(timelineInfoArea); this.TimelineSearches.Add(preparedSearch); } } UPMCalendarPage calendarPage = (UPMCalendarPage)this.Page; this.fromDate = calendarPage.CalendarFromDate; this.toDate = calendarPage.CalendarToDate; string fromDateString = this.fromDate?.CrmValueFromDate(); string toDateString = this.toDate?.CrmValueFromDate(); int searchCount = this.TimelineSearches.Count; this.searches = new List <TimelineSearch>(); for (int i = 0; i < searchCount; i++) { UPSearchPageModelControllerPreparedSearch preparedSearch = this.TimelineSearches[i]; UPContainerMetaInfo crmQuery = preparedSearch.CrmQueryForValue(null, null, false); if (!string.IsNullOrEmpty(fromDateString)) { UPInfoAreaCondition fromCondition = new UPInfoAreaConditionLeaf(preparedSearch.TimelineConfiguration.InfoAreaId, preparedSearch.TimelineConfiguration.DateField.FieldId, ">=", fromDateString); crmQuery.RootInfoAreaMetaInfo.AddCondition(fromCondition); } if (!string.IsNullOrEmpty(toDateString)) { int dateFieldIndex; dateFieldIndex = preparedSearch.TimelineConfiguration.EndDateField?.FieldId ?? preparedSearch.TimelineConfiguration.DateField.FieldId; UPInfoAreaCondition toCondition = new UPInfoAreaConditionLeaf(preparedSearch.TimelineConfiguration.InfoAreaId, dateFieldIndex, "<=", toDateString); crmQuery.RootInfoAreaMetaInfo.AddCondition(toCondition); } crmQuery.SetLinkRecordIdentification(this.RecordIdentification, preparedSearch.TimelineConfiguration.LinkId); this.searches.Add(new TimelineSearch(crmQuery, preparedSearch)); } this.nextSearch = 0; this.ExecuteNextSearch(); }
/// <summary> /// Creates the container meta information with value prepared search. /// </summary> /// <param name="searchValue">The search value.</param> /// <param name="preparedSearch">The prepared search.</param> /// <returns></returns> public override UPContainerMetaInfo CreateContainerMetaInfoWithValuePreparedSearch(string searchValue, UPSearchPageModelControllerPreparedSearch preparedSearch) { List <UPConfigFilter> configFilter = null; if (this.usedFilters.ContainsKey(preparedSearch.SearchConfiguration.UnitName)) { UPMFilter vFilter = this.usedFilters[preparedSearch.SearchConfiguration.UnitName]; configFilter = UPMFilter.ActiveFiltersForFilters(new List <UPMFilter> { vFilter }); } UPContainerMetaInfo container = preparedSearch.CrmQueryForValue(searchValue, configFilter, false); return(container); }
/// <inheritdoc/> public override UPContainerMetaInfo CreateContainerMetaInfoWithValuePreparedSearch(string searchValue, UPSearchPageModelControllerPreparedSearch preparedSearch) { var firstFilter = this.SearchPage.AvailableFilters[0] as UPMDistanceFilter; var vFilter = this.usedFilters.ValueOrDefault(preparedSearch.SearchConfiguration.UnitName) as UPMDistanceFilter; List <UPConfigFilter> configFilter = null; if (vFilter != null) { vFilter.Active = true; vFilter.Radius = firstFilter.Radius; vFilter.LocationResult(this.currentUserLocation); configFilter = UPMFilter.ActiveFiltersForFilters(new List <UPMFilter> { vFilter }); } UPContainerMetaInfo container = preparedSearch.CrmQueryForValue(searchValue, configFilter, false); return(container); }
/// <summary> /// Creates the container meta information with value prepared search. /// </summary> /// <param name="searchValue">The search value.</param> /// <param name="preparedSearch">The prepared search.</param> /// <returns></returns> public virtual UPContainerMetaInfo CreateContainerMetaInfoWithValuePreparedSearch(string searchValue, UPSearchPageModelControllerPreparedSearch preparedSearch) { UPContainerMetaInfo container = preparedSearch.CrmQueryForValue(searchValue, null, this.FullTextSearch); return(container); }