public void AssignMultiPage()
        {
            var search = new Search();
            search.IsMutliPage();

            Assert.AreEqual(true, search.SearchOptions.MultiPage, "MultiPage differs");
        }
        public void AssignPageSize()
        {
            var search = new Search();
            search.MaxPageSize(10);

            Assert.AreEqual(10, search.SearchOptions.ResultsPerPage, "ResultsPerPage differs");
        }
        public void AssignNotMultiPage()
        {
            var search = new Search();
            search.NotMultiPage();

            Assert.AreEqual(false, search.SearchOptions.MultiPage, "MultiPage differs");
        }
Ejemplo n.º 4
0
        /// <copydocfrom cref="IQueryFactory.CreateQuery" />
        public string CreateQuery(Search search)
        {
            if (search.SearchFields == null || search.SearchFields.Criterias == null)
            {
                return string.Empty;
            }

            var queryBuilder = new StringBuilder();

            for (var i = 0; i < search.SearchFields.Criterias.Count; i++)
            {
                var searchcriteria = search.SearchFields.Criterias[i];
                queryBuilder.Append("(");
    
                for (var j = 0; j < searchcriteria.Criteria.Count; j++)
                {
                    var criteria = searchcriteria.Criteria[j];
                    queryBuilder.Append(criteria.Field);
                    this.AddComparisonValue(queryBuilder, criteria, search.SearchOptions);

                    if (j < searchcriteria.Criteria.Count - 1)
                    {
                        queryBuilder.Append(Combinator(searchcriteria.Combinator));
                    }
                }
                queryBuilder.Append(")");

                if (i < search.SearchFields.Criterias.Count - 1)
                {
                    queryBuilder.Append(Combinator(search.SearchFields.Combinator));
                }
            }

            return queryBuilder.ToString();
        }
        public void AssignNoPageSize()
        {
            var search = new Search();
            search.NoMaxPageSize();

            Assert.IsNull(search.SearchOptions.ResultsPerPage, "ResultsPerPage differs");
        }
Ejemplo n.º 6
0
        public void no_criteria_passed()
        {
            var search = new Search();
            var result = new QueryFactory().CreateQuery(search);

            Assert.AreEqual(string.Empty, result);
        }
        public void CreateOrMappingSearch()
        {
            var expected = new Search
            {
                SearchFields = { Combinator = SearchCombinator.Or },
                SearchOptions = { IsMappingSearch = true },
            };

            var candidate = SearchBuilder.CreateSearch(SearchCombinator.Or, true);

            this.Check(expected, candidate);
        }
        public void CreateAndSearch()
        {
            var expected = new Search
            {
                SearchFields = { Combinator = SearchCombinator.And },
                SearchOptions = { IsMappingSearch = false }, 
            };

            var candidate = SearchBuilder.CreateSearch();

            this.Check(expected, candidate);
        }
        protected static void Establish_context()
        {
            var entity1 = Script.PersonData.CreateBasicEntity();
            var entity2 = Script.PersonData.CreateBasicEntity();

            client = new HttpClient();

            var search = new Search();
            Script.PersonData.CreateSearch(search, entity1, entity2);

            content = HttpContentExtensions.CreateDataContract(search);
        }
        protected static void Establish_context()
        {
            entity1 = CounterpartyData.CreateBasicEntity();
            entity2 = CounterpartyData.CreateBasicEntity();

            client = new HttpClient();

            var search = new Search();
            CounterpartyData.CreateSearch(search, entity1, entity2);

            content = HttpContentExtensions.CreateDataContract(search);
        }
        public void case_sensitive_mapping()
        {
            var search = new Search();

            search.SearchOptions.IsMappingSearch = true;
            search.SearchOptions.CaseSensitivity = true;

            search.AddSearchCriteria(SearchCombinator.And)
                  .AddCriteria("MappingValue", SearchCondition.Contains, "Test");
            var result = new QueryFactory().CreateQuery(search);

            Assert.AreEqual("(MappingValue.Contains(\"Test\"))", result);
        }
Ejemplo n.º 12
0
        public static Search CreateSearch(SearchCombinator combinator = SearchCombinator.And, bool isMappingSearch = false)
        {
            var search = new Search();

            if (search.SearchFields == null)
            {
                search.SearchFields = new SearchFields();
            }

            search.SearchOptions.IsMappingSearch = isMappingSearch;
            search.SearchFields.Combinator = combinator;

            return search;
        }
Ejemplo n.º 13
0
        public static Search SimpleSearch(string property, SearchCondition op, string value)
        {
            IList<SearchCriteria> criterias = new List<SearchCriteria>
            {
                new SearchCriteria
                {
                    Combinator = SearchCombinator.And,
                    Criteria = new List<Criteria>
                    {
                        new Criteria { Field = property, Condition = op, ComparisonValue = value, },
                    }
                }
            };

            var search = new Search
            {
                SearchFields = new SearchFields { Combinator = SearchCombinator.And, Criterias = criterias },
                SearchOptions = new SearchOptions()
            };

            return search;
        }
 public void CreateSearch(Search search, SourceSystem entity1, SourceSystem entity2)
 {
     this.CreateSearchData(search, entity1, entity2) ;
 }
 private static void CreateSearchData(Search search, PartyRole entity1, PartyRole entity2)
 {
     search.AddSearchCriteria(SearchCombinator.Or)
         .AddCriteria("Name", SearchCondition.Equals, entity1.LatestDetails.Name)
         .AddCriteria("Name", SearchCondition.Equals, entity2.LatestDetails.Name);
 }
 public static void CreateSearch(Search search, PartyRole entity1, PartyRole entity2)
 {
     CreateSearchData(search, entity1, entity2);
 }
        private void SearchRequest(SearchRequestEvent searchRequestEvent)
        {
            searchRequestEvent.Search.SearchOptions.OrderBy = "Name";

            this.entityService.ExecuteAsyncSearch<PartyAccountability>(
                this.search = searchRequestEvent.Search,
                (response) =>
                    {
                        IList<PartyAccountability> searchResults = response;
                        this.PartyAccountabilitys =
                            new ObservableCollection<PartyAccountabilityViewModel>(
                                searchResults.Select(
                                    x =>
                                    new PartyAccountabilityViewModel(new EntityWithETag<PartyAccountability>(x, null), this.eventAggregator)).OrderBy(y => y.Name));
                    },
                this.eventAggregator);
        }
        private void SearchRequest(SearchRequestEvent searchRequestEvent)
        {
            searchRequestEvent.Search.SearchOptions.OrderBy = "ReferenceKey";

            this.entityService.ExecuteAsyncSearchRD(
                this.search = searchRequestEvent.Search,
                response =>
                    {
                        ReferenceDataList searchResults = response;
                        Dictionary<string, string> combinedResults = new Dictionary<string, string>();
                        foreach (var rd in searchResults)
                        {
                            if (combinedResults.ContainsKey(rd.ReferenceKey))
                            {
                                combinedResults[rd.ReferenceKey] = combinedResults[rd.ReferenceKey] + "|" + rd.Value;
                            }
                            else
                            {
                                combinedResults.Add(rd.ReferenceKey, rd.Value);
                            }
                        }

                        this.ReferenceDatas =
                            new ObservableCollection<ReferenceDataViewModel>(
                                combinedResults.Select(
                                    x => new ReferenceDataViewModel(x.Key, x.Value, this.eventAggregator))
                                    .OrderBy(y => y.ReferenceKey));
                    },
                this.eventAggregator);
        }
        protected static void Establish_context()
        {
            entity1 = BrokerData.CreateBasicEntity();
            entity2 = BrokerData.CreateBasicEntity();

            client = new HttpClient();

            var search = new Search().IsMutliPage().MaxPageSize(1);
            BrokerData.CreateSearch(search, entity1, entity2);

            content = HttpContentExtensions.CreateDataContract(search);
        }
 public static void CreateSearch(Search search, Broker entity1, Broker entity2)
 {
     CreateSearchData(search, entity1, entity2);
 }
partial         void CreateSearchData(Search search, Person entity1, Person entity2);
 public void CreateSearch(Search search, Person entity1, Person entity2)
 {
     this.CreateSearchData(search, entity1, entity2) ;
 }
        private void AddMappingValueSearchCriteria(Search search)
        {
            var searchCriteria = search.AddSearchCriteria(SearchCombinator.And)
                .AddCriteria("MappingValue", SearchCondition.Contains, this.NameSearch);

            if (!string.IsNullOrEmpty(this.SourceSystem))
            {
                searchCriteria.AddCriteria("System.Name", SearchCondition.Equals, this.SourceSystem);
            }
        }
partial         void CreateSearchData(Search search, Person entity1, Person entity2)
        {
            search.AddSearchCriteria(SearchCombinator.Or)
                .AddCriteria("Firstname", SearchCondition.Equals, entity1.LatestDetails.FirstName)
                .AddCriteria("Firstname", SearchCondition.Equals, entity2.LatestDetails.FirstName);
        }
partial         void CreateSearchData(Search search, Party entity1, Party entity2);
partial         void CreateSearchData(Search search, SourceSystem entity1, SourceSystem entity2);
        private void OnIsActiveChanged(object sender, EventArgs eventArgs)
        {
            if (this.isActive)
            {
                Search search = SearchBuilder.CreateSearch();

                var context =
                    MyRegion(this.regionManager.Regions).Context as
                    Tuple<int, DateTime?, string>;
                search.AsOf = context.Item2;

                string field;
                switch (context.Item3)
                {
                    case "PartyAccountability":
                        field = "Parent.Id";
                        break;
                                    case "Person":
                        field = "SourcePerson.Id|TargetPerson.Id";
                        break;
                                    case "Party":
                        field = "SourceParty.Id|TargetParty.Id";
                        break;
                                    default:
                        field = context.Item3 + ".Id";
                        break;
                }

                if (field.Contains("|"))
                {
                    search.SearchFields.Combinator = SearchCombinator.Or;
                    var fields = field.Split(new Char[]{'|'});

                    foreach (string f in fields)
                    {
                        search.AddSearchCriteria(SearchCombinator.And).AddCriteria(
                            f, SearchCondition.NumericEquals, context.Item1.ToString());
                    }
                }
                else
                {
                    search.AddSearchCriteria(SearchCombinator.And).AddCriteria(
                        field, SearchCondition.NumericEquals, context.Item1.ToString());
                }

                this.entityService.ExecuteAsyncSearch<PartyAccountability>(
                    this.search = search,
                    (response) =>
                        {
                            IList<PartyAccountability> searchResults = response;
                            this.PartyAccountabilitys =
                                new ObservableCollection<PartyAccountabilityViewModel>(
                                    searchResults.Select(
                                        x =>
                                        new PartyAccountabilityViewModel(
                                            new EntityWithETag<PartyAccountability>(x, null), this.eventAggregator)).
                                        OrderBy(y => y.Name));
                        },
                    this.eventAggregator, false);
                return;
            }

            this.PartyAccountabilitys = new ObservableCollection<PartyAccountabilityViewModel>();
        }
        private void SearchRequest(SearchRequestEvent searchRequestEvent)
        {
            searchRequestEvent.Search.SearchOptions.OrderBy = "Name";

            this.entityService.ExecuteAsyncSearch<Location>(
                this.search = searchRequestEvent.Search,
                response =>
                    {
                        IList<Location> searchResults = response;
                        this.Locations =
                            new ObservableCollection<LocationViewModel>(
                                searchResults.Select(
                                    x =>
                                    new LocationViewModel(new EntityWithETag<Location>(x, null), this.eventAggregator))
                                    .OrderBy(y => y.Name));
                    },
                this.eventAggregator);
        }
 private void AddMdmIdSearchCriteria(Search search)
 {
     search.AddSearchCriteria(SearchCombinator.And)
         .AddCriteria(this.EntityName() + ".Id", SearchCondition.NumericEquals, this.NameSearch);
 }
 public static void CreateSearch(Search search, LegalEntity entity1, LegalEntity entity2)
 {
     CreateSearchData(search, entity1, entity2);
 }