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


C# Query.ToFhParams方法代码示例

本文整理汇总了C#中Query.ToFhParams方法的典型用法代码示例。如果您正苦于以下问题:C# Query.ToFhParams方法的具体用法?C# Query.ToFhParams怎么用?C# Query.ToFhParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Query的用法示例。


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

示例1: CloseLink

 public static MvcHtmlString CloseLink(this HtmlHelper helper)
 {
     TagBuilder builder = new TagBuilder("a");
     string absolutePath = helper.ViewContext.HttpContext.Request.Url.AbsolutePath;
     builder.MergeAttribute("class", "icon close");
     builder.SetInnerText(helper.GetResource("RemoveFilter"));
     string facet = helper.ViewContext.RouteData.Values.GetLevel1BrandFacet();
     string facetValue = helper.ViewContext.RouteData.Values.GetLevel1BrandFacetValueDelimeted();
     if (!string.IsNullOrEmpty(helper.ViewContext.HttpContext.Request["fh_params"]))
     {
         Query query = new Query();
         query.ParseQuery(helper.ViewContext.HttpContext.Request["fh_params"]);
         Location location = new Location(FredHopperExtensions.RemoveFacetValues(query.getLocation().toString(), facet, facetValue));
         query.setLocation(location);
         absolutePath = absolutePath + query.ToFhParams();
     }
     else
     {
         absolutePath = absolutePath + "?clear=true";
     }
     UrlHelper helper2 = new UrlHelper(helper.ViewContext.RequestContext);
     builder.MergeAttribute("href", helper2.Content(absolutePath.AddApplicationRoot()));
     return MvcHtmlString.Create(builder.ToString());
 }
开发者ID:pjbeemster,项目名称:scratchpad,代码行数:24,代码来源:FacetKeywordHelper.cs

示例2: SetHrefLinks

 public void SetHrefLinks(Query query)
 {
     Location location = new Location(query.getLocation());
     int offset = query.getListStartIndex();
     query.removeListStartIndex();
     int num2 = this.Facets.Count<FacetItem>(f => f.Selected);
     string ticked = HttpContext.Current.Request["fh_ticked"] ?? "";
     foreach (FacetItem item in this.Facets)
     {
         Location location2 = new Location(location);
         MultiValuedCriterion mvc = location2.getCriterion("schematitle") as MultiValuedCriterion;
         if (mvc != null)
         {
             (from f in this.Facets
                 where !f.Enabled
                 select f).ToList<FacetItem>().ForEach(f => mvc.getGreaterThan().remove(f.Value));
             if (string.IsNullOrEmpty(ticked))
             {
                 if (num2 == mvc.getGreaterThan().valueSet().size())
                 {
                     item.Selected = false;
                     mvc.getGreaterThan().clear().add(item.Value);
                 }
             }
             else
             {
                 if (ticked.Split(new char[] { ',' }).Contains<string>(item.Value))
                 {
                     mvc.getGreaterThan().remove(item.Value);
                 }
                 else
                 {
                     mvc.getGreaterThan().add(item.Value);
                 }
                 if (mvc.getGreaterThan().isEmpty())
                 {
                     location2.removeCriteria("schematitle");
                 }
             }
             query.setLocation(location2);
             item.Href = query.ToFhParams();
             if (string.IsNullOrEmpty(ticked))
             {
                 item.Href = item.Href + "&fh_ticked=" + item.Value;
             }
             else
             {
                 List<string> items = ticked.Split(new char[] { ',' }).ToList<string>();
                 (from f in this.Facets
                     where !f.Enabled
                     select f).ToList<FacetItem>().ForEach(f => items.Remove(f.Value));
                 if (items.Contains(item.Value))
                 {
                     items.Remove(item.Value);
                 }
                 else
                 {
                     items.Add(item.Value);
                 }
                 item.Href = Regex.Replace(item.Href, @"&fh_ticked=[\w|,]+", "");
                 if (items.Count > 0)
                 {
                     item.Href = item.Href + "&fh_ticked=" + string.Join(",", items);
                 }
             }
         }
     }
     query.setLocation(location);
     query.setListStartIndex(offset);
     this.Facets.ToList<FacetItem>().ForEach(delegate (FacetItem f) {
         if (f.Enabled)
         {
             f.Selected = false;
         }
         List<string> list = ticked.Split(new char[] { ',' }).ToList<string>();
         if (f.Enabled && list.Contains(f.Value))
         {
             f.Selected = true;
         }
     });
 }
开发者ID:pjbeemster,项目名称:scratchpad,代码行数:81,代码来源:FacetSection.cs

示例3: getFacetItem

 public static FacetItem getFacetItem(filtersection fs, string fh_location, filter f)
 {
     FacetItem item = new FacetItem {
         FHId = fs.value.Value,
         NumItems = fs.nr,
         Selected = fs.selected
     };
     link link = fs.link;
     item.Text = link.name;
     Query query = new Query();
     query.ParseQuery(link.urlparams);
     query.removeListStartIndex();
     string urlParams = string.Empty;
     if (fs.selected)
     {
         string str2 = query.getLocation().getLastCriterion().toString();
         string facetValue = str2.Substring(str2.IndexOf('{') + 1).Replace("}", "");
         urlParams = RemoveFacetValues(fh_location, query.getLocation().getLastCriterion().getAttributeName(), facetValue);
     }
     else
     {
         Location location = new Location(fh_location);
         location.addCriterion(query.getLocation().getLastCriterion());
         urlParams = location.toString();
         if ((f.customfields != null) && (f.customfields.SingleOrDefault<customfield>(c => (c.name == "RefineMethod")).Value == "CombineFacets"))
         {
             urlParams = CreateOrCondition(urlParams);
         }
     }
     Location location2 = new Location(urlParams);
     query.setLocation(location2);
     item.Value = query.ToFhParams();
     return item;
 }
开发者ID:pjbeemster,项目名称:scratchpad,代码行数:34,代码来源:FredHopperExtensions.cs


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