protected QueryStringCollection CreateCustomerContactQueryStringCollection() { var id = AccountToEdit.GetAttributeValue <Guid>("accountid"); var queryStringCollection = new QueryStringCollection(string.Empty); queryStringCollection.Set("AccountID", id.ToString()); queryStringCollection.Set("ReturnToAccount", "true"); return(queryStringCollection); }
protected QueryStringCollection CreateCustomerContactQueryString() { var queryStringCollection = new QueryStringCollection(""); var oppId = OpenOpportunity.GetAttributeValue <Guid>("opportunityid"); var account = OpenOpportunity.GetAttributeValue <EntityReference>("customerid"); queryStringCollection.Set("OpportunityId", oppId.ToString()); if (account != null) { queryStringCollection.Set("AccountId", account.Id.ToString()); } return(queryStringCollection); }
/// <summary> /// Creates an query string for a facet /// </summary> /// <param name="facetQuery">The facet query.</param> /// <param name="facetName">Name of the facet.</param> /// <param name="facetValue">The facet value.</param> /// <returns>The query string for the facet.</returns> private static string GetFacetQueryString(string facetQuery, string facetName, string facetValue) { var facetCollection = new QueryStringCollection(); if (!string.IsNullOrEmpty(facetQuery)) { facetCollection.Parse(HttpUtility.UrlDecode(facetQuery)); } if (facetCollection.Contains(facetName)) { var facetQueryValues = facetCollection[facetName]; if (facetQueryValues.Contains(facetValue)) { var newFacetQueryValues = string.Empty; var facetValues = facetQueryValues.Split('|').Where(p => !string.Equals(p, facetValue, StringComparison.OrdinalIgnoreCase)).ToList(); if (facetValues.Count() > 0) { facetCollection.Set(facetName, string.Join("|", facetValues)); } else { facetCollection.Remove(facetName); } } else { facetCollection.Set(facetName, facetQueryValues + StorefrontConstants.QueryStrings.FacetsSeparator + facetValue); } } else { facetCollection.Add(facetName, facetValue); } return(facetCollection.ToString()); }
/// <summary> /// Creates an query string for a facet /// </summary> /// <param name="facetQuery">The facet query.</param> /// <param name="facetName">Name of the facet.</param> /// <param name="facetValue">The facet value.</param> /// <returns>The query string for the facet.</returns> private static string GetFacetQueryString(string facetQuery, string facetName, string facetValue) { var facetCollection = new QueryStringCollection(); if (!string.IsNullOrEmpty(facetQuery)) { facetCollection.Parse(HttpUtility.UrlDecode(facetQuery)); } if (facetCollection.Contains(facetName)) { var facetQueryValues = facetCollection[facetName]; if (facetQueryValues.Contains(facetValue)) { var newFacetQueryValues = string.Empty; var facetValues = facetQueryValues.Split('|').Where(p => !string.Equals(p, facetValue, StringComparison.OrdinalIgnoreCase)).ToList(); if (facetValues.Count() > 0) { facetCollection.Set(facetName, string.Join("|", facetValues)); } else { facetCollection.Remove(facetName); } } else { facetCollection.Set(facetName, facetQueryValues + StorefrontConstants.QueryStrings.FacetsSeparator + facetValue); } } else { facetCollection.Add(facetName, facetValue); } return facetCollection.ToString(); }