当前位置: 首页>>代码示例>>C#>>正文


C# SearchCriteria类代码示例

本文整理汇总了C#中SearchCriteria的典型用法代码示例。如果您正苦于以下问题:C# SearchCriteria类的具体用法?C# SearchCriteria怎么用?C# SearchCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SearchCriteria类属于命名空间,在下文中一共展示了SearchCriteria类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShouldSupportPaging

 public void ShouldSupportPaging()
 {
     var criteria = new SearchCriteria<TestEntity>();
     criteria.PageBy(2, 25);
     Assert.AreEqual(2, criteria.PageNumber);
     Assert.AreEqual(25, criteria.PageSize);
 }
开发者ID:jcowart,项目名称:Symbiote,代码行数:7,代码来源:WhenProvidingSearchCriteria.cs

示例2: BuildArgs

        public IDictionary<string, string> BuildArgs(SearchCriteria searchCriteria)
        {
            DateTime now = _dateTimeProvider.GetNow();
            string timestamp = _dateTimeProvider.Format(now);
            string associateTag = _generator.Generate();

            var dic = new Dictionary<string, string>
            {
                { "Service", "AWSECommerceService" },
                { "AWSAccessKeyId", _awsOptions.AccessKey },
                { "AssociateTag", associateTag },
                { "Operation", searchCriteria.Operation },
                { "SearchIndex", searchCriteria.SearchIndex },
                { "ResponseGroup", String.Join(",", searchCriteria.ResponseGroups ?? Enumerable.Empty<string>()) },
                { "BrowseNode", searchCriteria.BrowseNode?.ToString(CultureInfo.InvariantCulture) ?? String.Empty },
                { "BrowseNodeId", searchCriteria.BrowseNodeId?.ToString(CultureInfo.InvariantCulture) ?? String.Empty },
                { "IdType", searchCriteria.IdType },
                { "ItemId", searchCriteria.ItemId },
                { "ItemPage", searchCriteria.ItemPage?.ToString(CultureInfo.InvariantCulture) },
                { "Condition", searchCriteria.Condition ?? "All" },
                { "Timestamp", timestamp }
            };

            // Ordering parameters in naturual byte order as required by AWS
            return new SortedDictionary<string, string>(dic, StringComparer.Ordinal);
        }
开发者ID:abatishchev,项目名称:ab,代码行数:26,代码来源:AwsArgumentBuilder.cs

示例3: FromSearchCriteria

		/// <summary>
		/// Extracts a list of <see cref="HqlCondition"/> objects from the specified <see cref="SearchCriteria"/>
		/// </summary>
		/// <param name="qualifier">The HQL qualifier to prepend to the criteria variables</param>
		/// <param name="criteria">The search criteria object</param>
		/// <param name="remapHqlExprFunc"></param>
		/// <returns>A list of HQL conditions that are equivalent to the search criteria</returns>
		public static HqlCondition[] FromSearchCriteria(string qualifier, SearchCriteria criteria, Converter<string, string> remapHqlExprFunc)
		{
			var hqlConditions = new List<HqlCondition>();
			if (criteria is SearchConditionBase)
			{
				var sc = (SearchConditionBase)criteria;
				if (sc.Test != SearchConditionTest.None)
				{
					hqlConditions.Add(GetCondition(remapHqlExprFunc(qualifier), sc.Test, sc.Values));
				}
			}
			else
			{
				// recur on subCriteria
				foreach (var subCriteria in criteria.EnumerateSubCriteria())
				{
					// use a different syntax for "extended properties" than regular properties
					var subQualifier = criteria is ExtendedPropertiesSearchCriteria ?
						string.Format("{0}['{1}']", qualifier, subCriteria.GetKey()) :
						string.Format("{0}.{1}", qualifier, subCriteria.GetKey());

					hqlConditions.AddRange(FromSearchCriteria(subQualifier, subCriteria, remapHqlExprFunc));
				}
			}

			return hqlConditions.ToArray();
		}
开发者ID:nhannd,项目名称:Xian,代码行数:34,代码来源:HqlCondition.cs

示例4: Execute_Should_Return_Product_Having_ItemAttributes_When_ResponseGroups_Contains_ItemAttributes

        public void Execute_Should_Return_Product_Having_ItemAttributes_When_ResponseGroups_Contains_ItemAttributes()
        {
            // Arrange
            const string brand = "brand";
            const string title = "title";
            const string productGroup = "productGroup";
            var detailsPageUrl = new Uri("http://www.amazon.com");
            var customerReviewsUrl = new Uri("http://www.amazon.com");

            var element = XElementFactory.Create("", title, productGroup, brand, detailsPageUrl, customerReviewsUrl);

            var searchCriteria = new SearchCriteria
            {
                ResponseGroups = new[] { "ItemAttributes" }
            };

            var filter = new ItemAttributesProductPipelineFilter();

            // Act
            var product = filter.Execute(new Product(), element, searchCriteria);

            // Assert
            product.Brand.Should().Be(brand);
            product.Title.Should().Be(title);
            product.ProductGroup.Should().Be(productGroup);
            product.DetailsPageUrl.Should().Be(detailsPageUrl);
            product.CustomerReviewsUrl.Should().Be(customerReviewsUrl);
        }
开发者ID:abatishchev,项目名称:ab,代码行数:28,代码来源:ItemAttributesProductPipelineFilterTest.cs

示例5: GenerateResultsTable

        /// <summary>
        /// Applies a SearchCriteria to the index.
        /// </summary>
        /// <param name="crit">The SearchCriteria to apply.</param>
        /// <returns>A ResultsTable that contains the result of applying the criteria.</returns>
        public ResultsTable GenerateResultsTable(SearchCriteria crit)
        {
            Debug.Assert(crit != null);

            CodeElementWrapperArrayIndexTable idxTable;

            // If using all criteria, perform a copy.
            if (crit.ElementFilter == CodeElementType.All)
            {
                idxTable = (CodeElementWrapperArrayIndexTable) indexTable.Clone();
            }
            else
            {
                idxTable = new CodeElementWrapperArrayIndexTable(codeElementArray);

                for (int i = 0; i < codeElementArray.Count; i++)
                {
                    if (codeElementArray[i].ElementType == crit.ElementFilter)
                    {
                        idxTable.Add(i);
                    }
                }

                idxTable.Sort(new SortCriteria(SortCriteria.SortType.ALPHA));
            }

            var ret = new ResultsTable(idxTable);
            return (ret);
        }
开发者ID:jda808,项目名称:NPL,代码行数:34,代码来源:CodeElementWrapperIndexTable.cs

示例6: CriteriaSearch

        public void CriteriaSearch()
        {
            var criteria = new SearchCriteria();

            using (var session = TubsDataService.GetStatelessSession())
            {
                var results = TubsDataService.Search(session, criteria);
                Assert.NotNull(results);
                Assert.AreEqual(0, results.Count());

                criteria.Observer = "DJB"; // Dave Burgess, not a real observer.
                results = TubsDataService.Search(session, criteria);
                Assert.NotNull(results);
                Assert.Greater(results.Count(), 4); // Currently 6, but that changes

                criteria.ProgramCode = "PGOB";
                results = TubsDataService.Search(session, criteria);
                Assert.GreaterOrEqual(results.Count(), 1);

                criteria.ProgramCode = String.Empty;
                criteria.Vessel = "TUNA";
                results = TubsDataService.Search(session, criteria);
                Assert.Greater(results.Count(), 5);

                criteria.Vessel = String.Empty;
                criteria.AnyDate = new DateTime(2011, 9, 10);
                results = TubsDataService.Search(session, criteria);
                Assert.Greater(results.Count(), 1);
            }
        }
开发者ID:spc-ofp,项目名称:tubs-data-clr,代码行数:30,代码来源:DataServiceTest.cs

示例7: AddSearch

 /// <summary>
 /// Adds a new <see cref="Core.Model.SearchCriteria"/> to the collection of Searches.
 /// </summary>
 /// <param name="criteria">The Search Criteria to be added</param>
 /// <returns>The UniqueId of the search just added</returns>
 public string AddSearch(SearchCriteria criteria)
 {
     int lastId = GetLastId();
     criteria.UniqueId = ++lastId;
     _unitOfWork.Searches.Add(criteria);
     return criteria.UniqueId.ToString();
 }
开发者ID:TimHarrison1260,项目名称:THLibrary,代码行数:12,代码来源:SearchRepository.cs

示例8: ShouldAllowAddingOfCriteria

 public void ShouldAllowAddingOfCriteria()
 {
     var criteria = new SearchCriteria<TestEntity>();
     criteria.Add(entity => entity.Id.HasValue);
     var list = new List<Expression<Func<TestEntity, bool>>>(criteria.All);
     Assert.IsTrue(list.Count == 1);
     Assert.AreEqual("entity.Id.HasValue", list[0].Body.ToString());
 }
开发者ID:jcowart,项目名称:Symbiote,代码行数:8,代码来源:WhenProvidingSearchCriteria.cs

示例9: GetAllCourtCases

 protected IEnumerable<CourtCaseHeading> GetAllCourtCases(SearchCriteria criteria)
 {
     List<CourtCaseHeading> output = 
         this.CallServiceGet<List<FACCTS.Server.Model.Calculations.CourtCaseHeading>>(string.Format("{0}?{1}", Routes.GetCourtCases.CourtCaseController, criteria.ToString()))
         .Select(x => new CourtCaseHeading(x))
         .ToList();
     return output;
 }
开发者ID:KonstantinDavidov,项目名称:mytestRep,代码行数:8,代码来源:CourtCases.cs

示例10: SetCriteria

 public ISearchQuery SetCriteria(SearchCriteria criteria)
 {
   if (criteria == null)
   {
     _criteria = SearchCriteria.Empty;
   }
   _criteria = criteria;
   return this;
 }
开发者ID:nahmedsoftsource,项目名称:framework-abdh,代码行数:9,代码来源:SearchQuery.cs

示例11: Map

 /// <summary>
 /// Static <c>Map</c> method maps a <see cref="Core.Model.SearchCriteria"/> class to a 
 /// <see cref="THLibrary.DataModel.SearchViewModel"/> class.
 /// </summary>
 /// <param name="criteria">The SearchCriteria instance.</param>
 /// <returns>The SearchViewModel instance.</returns>
 public static SearchViewModel Map(SearchCriteria criteria)
 {
     SearchViewModel searchVM = new SearchViewModel()
     {
         UniqueId = "",
         Type = Enum.GetName(typeof(SearchTypeEnum), criteria.Type),
         SearchString = criteria.SearchString,
         SearchDate = criteria.SearchDate.ToString()
     };
     return searchVM;
 }
开发者ID:TimHarrison1260,项目名称:THLibrary,代码行数:17,代码来源:MapSearchCriteriaToSearchViewModel.cs

示例12: GetBorrows

        public JsonResult GetBorrows(SearchCriteria[] searchCriteria, SortOrder[] sort, int page, int pageSize)
        {
            var dao = new BorrowService();

            int count;
            List<Borrow> list = dao.GetBorrows(searchCriteria, sort, page, pageSize, out count);

            var borrows = AutoMapper.Mapper.Map<List<Borrow>, List<BorrowLiteModel>>(list);

            return Json(new { Borrows = borrows, Count = count });
        }
开发者ID:sadowskima,项目名称:CityLibrary,代码行数:11,代码来源:BorrowController.cs

示例13: FromString

            public static SearchCriteria FromString(string mixed)
            {
                if (mixed.IndexOf(Core.Keyword_ahk, StringComparison.OrdinalIgnoreCase) == -1)
                    return new SearchCriteria { Title = mixed };

                var criteria = new SearchCriteria();
                var i = 0;
                var t = false;

                while ((i = mixed.IndexOf(Core.Keyword_ahk, i, StringComparison.OrdinalIgnoreCase)) != -1)
                {
                    if (!t)
                    {
                        var pre = i == 0 ? string.Empty : mixed.Substring(0, i).Trim(Core.Keyword_Spaces);

                        if (pre.Length != 0)
                            criteria.Title = pre;

                        t = true;
                    }

                    var z = mixed.IndexOfAny(Core.Keyword_Spaces, i);

                    if (z == -1)
                        break;

                    var word = mixed.Substring(i, z - i);

                    var e = mixed.IndexOf(Core.Keyword_ahk, ++i, StringComparison.OrdinalIgnoreCase);
                    var arg = (e == -1 ? mixed.Substring(z) : mixed.Substring(z, e - z)).Trim();
                    long n;

                    switch (word.ToLowerInvariant())
                    {
                        case Core.Keyword_ahk_class: criteria.ClassName = arg; break;
                        case Core.Keyword_ahk_group: criteria.Group = arg; break;

                        case Core.Keyword_ahk_id:
                            if (long.TryParse(arg, out n))
                                criteria.ID = new IntPtr(n);
                            break;

                        case Core.Keyword_ahk_pid:
                            if (long.TryParse(arg, out n))
                                criteria.PID = new IntPtr(n);
                            break;
                    }

                    i++;
                }

                return criteria;
            }
开发者ID:pschuegr,项目名称:IronAHK,代码行数:53,代码来源:SearchCriteria.cs

示例14: SearchControl

        public SearchControl(ITATSystem itatSystem, bool showTerm1, bool showTerm2, bool showTerm3, bool showTerm4, bool showTerm5, bool showTerm6, bool showTerm7, SearchCriteria searchCriteria)
        {
            this._itatSystem = itatSystem;
            this._displayTerm1 = showTerm1;
            this._displayTerm2 = showTerm2;
            this._displayTerm3 = showTerm3;
            this._displayTerm4 = showTerm4;
            this._displayTerm5 = showTerm5;
            this._displayTerm6 = showTerm6;
            this._displayTerm7 = showTerm7;

            this._searchCriteria=searchCriteria;
        }
开发者ID:dlnuckolls,项目名称:glorykidd-public,代码行数:13,代码来源:SearchControl.ascx.cs

示例15: FillSearchResults

 /// <summary>
 /// get a SearchCriteriaFormViewModel containing the criteria and the results of a search
 /// if results in cache
 ///     get it
 /// else
 ///     build searchcriteria from url
 ///     with this, search matchings localisations in repository
 ///     fill the session store with computed results
 /// and returns the results
 /// </summary>
 /// <param name="session">session to look up for results</param>
 /// <param name="parameters">parameters from which to build result of not in session</param>
 /// <returns>a object containing the criteria and the results of a search</returns>
 public SearchCriteriaFormViewModel FillSearchResults(SearchCriteria criteria)
 {
     var place = string.IsNullOrEmpty(criteria.Place) ? "" : criteria.Place.ToLower();
     if (MiscHelpers.SeoConstants.Places.ContainsKey(place))
     {
         var coor = MiscHelpers.SeoConstants.Places[place];
         criteria.LocalisationData.Latitude = coor.Latitude;
         criteria.LocalisationData.Longitude = coor.Longitude;
     }
     var criteriaViewModel = new SearchCriteriaFormViewModel(criteria, true);
     FillResults(criteriaViewModel);
     return criteriaViewModel;
 }
开发者ID:tah91,项目名称:eworkyWebSite,代码行数:26,代码来源:SearchService.cs


注:本文中的SearchCriteria类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。