/// <summary> /// Builds the <see cref="ICmsContentQuery{TResult}"/>. /// </summary> /// <returns> /// The <see cref="ICmsContentQuery{TResult}"/>. /// </returns> protected override ICmsContentQuery <IProductContent> Build() { var sortBy = SortBy.ToString().ToLowerInvariant(); var query = new ProductContentQuery(_cachedQuery) { Page = Page, ItemsPerPage = ItemsPerPage, SortBy = sortBy, SortDirection = SortDirection, CollectionKeys = this.CollectionKeys, CollectionClusivity = this.CollectionClusivity }; if (!string.IsNullOrWhiteSpace(SearchTerm)) { query.SearchTerm = SearchTerm; } if (_hasPriceRangeFilter) { query.SetPriceRange(_minPrice, _maxPrice); } return(query); }
public string GetSortingString(string resourceUrl) { //If sorting is enabled, modify the Uri with the Locale resourceUrl = resourceUrl.Replace("help_center/", string.Format("help_center/{0}/", this.Locale)); return(string.Format("{0}?sort_by={1}&sort_order={2}", resourceUrl, SortBy.ToString().ToLower(), SortOrder.ToString().ToLower())); }
/// <summary> /// Description: Sort Dictionary On Sort Field And Convert Data Into JSON. /// </summary> /// <param name="dictionary">Dictionary Of CSV Data</param> /// <param name="sortType">Enumerator Value For specifying Sort Field</param> /// <param name="sortOrder">Enumerator Value For specifying Sort Order</param> /// <returns>Sorted List In JSON String</returns> public string SortAndConvertCensusToJSON(Dictionary <object, dynamic> dictionary, SortBy sortType, SortOrder sortOrder) { string sortField = this.textInfo.ToTitleCase(sortType.ToString().ToLower()).Replace("_", string.Empty); var sortedList = this.SortData(dictionary.Select(value => value.Value).ToList(), sortField, sortOrder); return(JsonConvert.SerializeObject(sortedList)); }
public string GetSortingString(string resourceUrl, string urlPrefix) { //If sorting is enabled, modify the Uri with the Locale resourceUrl = resourceUrl.Replace(urlPrefix, $"help_center/{Locale}/"); return($"{resourceUrl}?sort_by={SortBy.ToString().ToLower()}&sort_order={SortOrder.ToString().ToLower()}"); }
/// <summary> /// </summary> public override void Save() { Settings.Default.PlaylistTypes.Clear(); Settings.Default.PlaylistTypes.Add(PlaylistTypes.ToString()); Settings.Default.ChannelSortBy = SortBy.ToString(); Settings.Default.ChannelSortOrder = SortOrder.ToString(); }
public void OnPostSortBy(SortBy sortby, SortDirection sortDirection) { ClearValidationState(); SortByColumn = sortby.ToString(); SortByState = sortDirection.ToString(); SortByDirectionIcon = GetSortDirectionIcon(SortByState); RefreshPage(); }
public override string ToString() { var stb = new StringBuilder(); stb.Append("(").Append("DataType: ").Append(DataType.ToString()).Append("),"); stb.Append("(").Append("SortBy: ").Append(SortBy.ToString()).Append("),"); return(stb.ToString()); }
public void ToStringTest() { SortBy sortBy = new SortBy(); sortBy.By = ElementAttributeType.Name; string str = sortBy.ToString(); Assert.AreEqual("Sort by: Name", str, "Unexpected string representation."); }
public IEnumerable <Item> FilteredItems(int page, int pageSize, SortBy sort) { var propertyInfo = typeof(Item).GetProperty(sort.ToString()); return(item .OrderBy(product => propertyInfo.GetValue(product)) .ThenBy(product => product.Id) .Skip(page * pageSize) .Take(pageSize)); }
public string ToString(HL7Table.HL7Version version) { List <string> lst = new List <string>() { SortBy.ToString(version), Sequencing.Value() }; return(string.Join("^", lst)); }
public IEnumerable <Item> CartItems(int page, int pageSize, SortBy sortby) { var propertyInfo = typeof(Item).GetProperty(sortby.ToString()); return(items .Select(x => x.Value) .OrderBy(product => propertyInfo.GetValue(product)) .ThenBy(product => product.Id) .Skip(page * pageSize) .Take(pageSize)); }
/// <summary> /// Gets a list of VODs (Video on Demand) from a specified channel. /// Https://dev.twitch.tv/docs/v5/reference/channels/#get-channel-videos /// </summary> /// <param name="_channelId">Channel Id</param> /// <param name="_pagination">Pagination info <see cref="Helpers.Pagination"/></param> /// <param name="_broadcastType">Broadcast type <see cref="Enums.BroadcastType"/></param> /// <param name="_languages">Restrict VODs to specific language(s)</param> /// <param name="_sort">Sort by <see cref="Enums.SortBy"/></param> /// <returns></returns> public async Task <dynamic> GetChannelVideos(string _channelId, Pagination _pagination, BroadcastType _broadcastType = BroadcastType.highlight, List <string> _languages = default(List <string>), SortBy _sort = SortBy.time) { var request = httpHelperClient.CreateHttpRequest($"kraken/channels/{_channelId}/videos", HttpMethod.Get); httpHelperClient.AddQueryString(request, _pagination); httpHelperClient.AddQueryString(request, "broadcast_type", _broadcastType.ToString()); if (_languages != default(List <string>) && _languages.Count > 0) { httpHelperClient.AddQueryString(request, "language", string.Join(",", _languages)); } httpHelperClient.AddQueryString(request, "sort", _sort.ToString()); return(await httpHelperClient.ExecuteRequest(request)); }
/// <summary> /// Builds the <see cref="ICmsContentQuery{TResult}"/>. /// </summary> /// <returns> /// The <see cref="ICmsContentQuery{TResult}"/>. /// </returns> protected override ICmsContentQuery <IProductContent> Build() { var sortBy = SortBy.ToString().ToLowerInvariant(); return(new ProductContentQuery(_cachedQuery) { SearchTerm = _searchTerm, Page = Page, ItemsPerPage = ItemsPerPage, SortBy = sortBy, SortDirection = SortDirection, CollectionKeys = this.CollectionKeys, CollectionClusivity = this.CollectionClusivity }); }
public async Task <Pro.Model.Cryptocurrency.ListingsData> CryptocurrencyListingsHistoricalAsync( DateTime timestamp, int?start = 1, int?limit = 100, FiatCurrency convert = FiatCurrency.USD, SortBy sort = SortBy.market_cap, SortDirection sort_dir = SortDirection.desc, CryptocurrencyType cryptocurrency_type = CryptocurrencyType.all ) { HttpClient _httpClient = new HttpClient { BaseAddress = new Uri(Pro.Config.Cryptocurrency.CoinMarketCapProApiUrl) }; _httpClient.DefaultRequestHeaders.Add("X-CMC_PRO_API_KEY", this.ProApiKey); var url = QueryStringService.AppendQueryString(Pro.Config.Cryptocurrency.CryptocurrencyListingsHistorical, new Dictionary <string, string> { { "timestamp", timestamp.ToUnixTimeSeconds().ToString() }, { "start", start.HasValue && start.Value >= 1 ? start.Value.ToString() : null }, { "limit", limit.HasValue && limit.Value >= 1 ? limit.Value.ToString() : null }, { "convert", convert.ToString() }, { "sort", sort.ToString() }, { "sort_dir", sort_dir.ToString() }, { "cryptocurrency_type", cryptocurrency_type.ToString() }, }); var response = await _httpClient.GetAsync(url); Pro.Model.Cryptocurrency.ListingsData data = await JsonParserService.ParseResponse <Pro.Model.Cryptocurrency.ListingsData>(response); if (data == null) { data = new Pro.Model.Cryptocurrency.ListingsData { Data = null, Status = new Status { ErrorCode = int.MinValue }, Success = false }; } data.Success = data.Status.ErrorCode == 0; // Add to Status List this.statusList.Add(data.Status); return(data); }
/// <summary> /// Gets the top ranking users for the specified risk level. /// Results are paginated with a maximum of 10 results per /// page. /// </summary> /// <param name="sortBy">Defines how are sorted the user</param> /// <param name="riskLevel">Defines the risk level</param> /// <param name="period"> /// The period in days to calculate the ranking. /// (Default: 30 days) /// </param> /// <param name="pageNumber">The requested page. (Default: 1st page)</param> /// <returns> /// <see cref="RankingResult" /> /// </returns> public async Task <RankingResult> GetRankingAsync( SortBy sortBy, RiskLevel riskLevel, int period = 30, int pageNumber = 1) { var query = new Dictionary <string, string> { { "period", period.ToString() }, { "sort", sortBy.ToString() }, { "riskLevel", riskLevel.ToString() }, { "pageNumber", pageNumber.ToString() } }; return(await GetResult <RankingResult>(OpenbookUri.Rankings, query)); }
protected override bool ISend() { // We want this operation to happen in the background, so close the progress screen. progress.Complete(); Message_GetWorldPageRequest request = new Message_GetWorldPageRequest(); request.SiteId = SiteID.Instance.Value.ToString(); request.UserName = GetUserName(); request.Community = Program2.SiteOptions.Community; request.First = first; request.Count = count; request.SortBy = sortBy.ToString(); request.SortDir = sortDir.ToString(); request.GenreFilter = (int)genreFilter; return(SendBuffer(request.SaveToArray())); }
public CswDelimitedString ToDelimitedString() { CswDelimitedString ret = new CswDelimitedString(CswNbtView.delimiter); ret.Add(CswEnumNbtViewNodeType.CswNbtViewProperty.ToString()); ret.Add(Type.ToString()); ret.Add(NodeTypePropId.ToString()); ret.Add(Name.ToString()); ret.Add(ArbitraryId.ToString()); ret.Add(SortBy.ToString()); ret.Add(SortMethod.ToString()); if (FieldType != CswNbtResources.UnknownEnum) { ret.Add(FieldType.ToString()); } else { ret.Add(""); } if (Order != Int32.MinValue) { ret.Add(Order.ToString()); } else { ret.Add(""); } if (Width != Int32.MinValue) { ret.Add(Width.ToString()); } else { ret.Add(""); } ret.Add(ShowInGrid.ToString()); ret.Add(ObjectClassPropId.ToString()); return(ret); }
public virtual Dictionary <string, string> AsDictionary() { var result = new Dictionary <string, string>(16) { { PageSize.Key, PageSize.ToString() }, { PageNumber.Key, PageNumber.ToString() }, { Query.Key, Query.ToString() }, { SelectedFacetValues.Key, SelectedFacetValues.ToString() }, { ExcludedFacetValues.Key, ExcludedFacetValues.ToString() }, { SelectedFacetValuesSearchOperator.Key, SelectedFacetValuesSearchOperator.ToString() }, { ExcludedItemIds.Key, ExcludedItemIds.ToString() }, { SelectedTemplateIds.Key, SelectedTemplateIds.ToString() }, { Path.Key, Path.ToString() }, { Featured.Key, Featured.ToString() }, { SortBy.Key, SortBy.ToString() } }; return(result); }
public JProperty ToJson(string PName = null, bool FirstLevelOnly = false, bool ShowAtRuntimeOnly = false) { JObject FilterObj = new JObject(); if (string.IsNullOrEmpty(PName)) { PName = CswEnumNbtViewXmlNodeName.Property.ToString() + "_" + ArbitraryId; } JProperty PropertyProp = new JProperty(PName, new JObject( new JProperty("nodename", CswEnumNbtViewXmlNodeName.Property.ToString().ToLower()), new JProperty("type", Type.ToString()), new JProperty("nodetypepropid", NodeTypePropId.ToString()), new JProperty("objectclasspropid", ObjectClassPropId.ToString()), new JProperty("name", Name), new JProperty("arbitraryid", ArbitraryId), new JProperty("sortby", SortBy.ToString()), new JProperty("sortmethod", SortMethod.ToString()), new JProperty("fieldtype", (FieldType != CswNbtResources.UnknownEnum) ? FieldType.ToString() : ""), new JProperty("order", (Order != Int32.MinValue) ? Order.ToString() : ""), new JProperty("width", (Width != Int32.MinValue) ? Width.ToString() : ""), new JProperty("filters", FilterObj), new JProperty("showingrid", ShowInGrid), new JProperty("showdelete", true) //for ViewContentTree - always show "X" for Property nodes ) ); if (!FirstLevelOnly) { foreach (CswNbtViewPropertyFilter Filter in this.Filters) { if (false == ShowAtRuntimeOnly || Filter.ShowAtRuntime) { FilterObj.Add(Filter.ToJson()); } } } return(PropertyProp); }
/// <summary> /// Retrieve the arguments /// </summary> /// <param name="result"></param> /// <returns></returns> protected override string GetProcessArguments(IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); var coverageFile = string.IsNullOrEmpty(CoverageFile) ? "coverage.xml" : CoverageFile; buffer.AppendArgument(RootPath(coverageFile, true)); // Add all the NCover arguments buffer.AppendIf(ClearCoverageFilters, "//ccf"); foreach (var filter in CoverageFilters ?? new CoverageFilter[0]) { buffer.AppendArgument("//cf {0}", filter.ToParamString()); } foreach (var threshold in MinimumThresholds ?? new CoverageThreshold[0]) { buffer.AppendArgument("//mc {0}", threshold.ToParamString()); } buffer.AppendIf(UseMinimumCoverage, "//mcsc"); buffer.AppendIf(XmlReportFilter != NCoverReportFilter.Default, "//rdf {0}", XmlReportFilter.ToString()); foreach (var threshold in SatisfactoryThresholds ?? new CoverageThreshold[0]) { buffer.AppendArgument("//sct {0}", threshold.ToParamString()); } buffer.AppendIf(NumberToReport > 0, "//smf {0}", NumberToReport.ToString(CultureInfo.CurrentCulture)); buffer.AppendIf(!string.IsNullOrEmpty(TrendOutputFile), "//at \"{0}\"", RootPath(TrendOutputFile, false)); buffer.AppendArgument("//bi \"{0}\"", string.IsNullOrEmpty(BuildId) ? result.Label : BuildId); buffer.AppendIf(!string.IsNullOrEmpty(HideElements), "//hi \"{0}\"", HideElements); buffer.AppendIf(!string.IsNullOrEmpty(TrendInputFile), "//lt \"{0}\"", RootPath(TrendInputFile, false)); GenerateReportList(buffer); buffer.AppendIf(!string.IsNullOrEmpty(ProjectName), "//p \"{0}\"", ProjectName); buffer.AppendIf(SortBy != NCoverSortBy.None, "//so \"{0}\"", SortBy.ToString()); buffer.AppendIf(TopUncoveredAmount > 0, "//tu \"{0}\"", TopUncoveredAmount.ToString(CultureInfo.CurrentCulture)); buffer.AppendIf(MergeMode != NCoverMergeMode.Default, "//mfm \"{0}\"", MergeMode.ToString()); buffer.AppendIf(!string.IsNullOrEmpty(MergeFile), "//s \"{0}\"", RootPath(MergeFile, false)); buffer.AppendIf(!string.IsNullOrEmpty(WorkingDirectory), "//w \"{0}\"", RootPath(WorkingDirectory, false)); return(buffer.ToString()); }
public async Task <TickersData> TickersAsync(int?start, int?limit, SortBy sort = SortBy.id, FiatCurrency convert = FiatCurrency.USD) { TickersData data = new TickersData(); try { HttpClient _httpClient = new HttpClient { BaseAddress = new Uri(Endpoints.CoinMarketCapApiUrl) }; var url = QueryStringService.AppendQueryString(Endpoints.Ticker, new Dictionary <string, string> { { "start", start >= 1 ? start.ToString() : null }, { "limit", limit >= 1 ? limit.ToString() : null }, { "sort", sort.ToString() }, { "convert", convert.ToString() } }); var response = await _httpClient.GetAsync(url); data = await JsonParserService.ParseResponse <TickersData>(response); if (data == null) { data = new TickersData { Data = null, Metadata = new TickerMetadata { Error = int.MinValue }, Success = false }; } data.Success = data.Metadata.Error == null; } catch { } return(data); }
public static string ToValue(this SortBy value) { return(value.ToString().ToLower()); }
private static string GetQuery(List<FolderFilter> filters, int? limit, int? offset, SortBy? sortBy, SortOrder? sortOrder) { var uri = new UriBuilder(SkyDriveBaseUrl + SkyDriveConstants.GetFiles); var filterString = ParseFilters(filters); uri.SetQueryParam(SkyDriveConstants.Filters, filterString); if (limit.HasValue) { uri.SetQueryParam(LiveSdkConstants.Limit, limit.Value.ToString()); } if (offset.HasValue) { uri.SetQueryParam(LiveSdkConstants.Offset, offset.Value.ToString()); } if (sortBy.HasValue) { uri.SetQueryParam(SkyDriveConstants.SortBy, sortBy.ToString().ToLower()); } if (sortOrder.HasValue) { uri.SetQueryParam(SkyDriveConstants.SortOrder, sortBy.ToString().ToLower()); } return uri.Query; }
/// <summary> /// Generates user reputation object /// </summary> /// <param name="creator"></param> /// <param name="modClass"></param> /// <param name="userId"></param> /// <returns></returns> public static UserReputationList GetUserReputationList(IDnaDataReaderCreator creator, int modClassId, int modStatus, int days, int startIndex, int itemsPerPage, SortBy sortBy, SortDirection sortDirection) { UserReputationList userRepList = new UserReputationList() { days = days, modClassId = modClassId, modStatus = modStatus, startIndex = startIndex, itemsPerPage = itemsPerPage, sortBy = sortBy, sortDirection = sortDirection }; using (IDnaDataReader dataReader = creator.CreateDnaDataReader("getuserreputationlist")) { dataReader.AddParameter("modClassId", modClassId); dataReader.AddParameter("modStatus", modStatus); dataReader.AddParameter("startIndex", startIndex); dataReader.AddParameter("itemsPerPage", itemsPerPage); dataReader.AddParameter("days", days); dataReader.AddParameter("sortby", sortBy.ToString()); dataReader.AddParameter("sortdirection", sortDirection.ToString()); dataReader.Execute(); while(dataReader.Read()) { var userRep = new UserReputation(); userRep.UserId = dataReader.GetInt32NullAsZero("userid"); userRep.ModClass = ModerationClassListCache.GetObject().ModClassList.FirstOrDefault(x => x.ClassId == dataReader.GetInt32NullAsZero("modclassid")); userRep.CurrentStatus = (ModerationStatus.UserStatus)dataReader.GetInt32NullAsZero("currentstatus"); userRep.ReputationDeterminedStatus = (ModerationStatus.UserStatus)dataReader.GetInt32NullAsZero("ReputationDeterminedStatus"); userRep.ReputationScore = dataReader.GetInt16("accumulativescore"); userRep.LastUpdated = new DateElement(dataReader.GetDateTime("lastupdated")); userRep.UserName = dataReader.GetStringNullAsEmpty("UserName"); userRepList.Users.Add(userRep); userRepList.totalItems = dataReader.GetInt32NullAsZero("total"); } } return userRepList; }
public XmlNode ToXml(XmlDocument XmlDoc) { XmlNode NewPropNode = XmlDoc.CreateNode(XmlNodeType.Element, CswEnumNbtViewXmlNodeName.Property.ToString(), ""); XmlAttribute PropTypeAttribute = XmlDoc.CreateAttribute("type"); PropTypeAttribute.Value = Type.ToString(); NewPropNode.Attributes.Append(PropTypeAttribute); XmlAttribute NodeTypePropIdAttribute = XmlDoc.CreateAttribute("nodetypepropid"); NodeTypePropIdAttribute.Value = NodeTypePropId.ToString(); NewPropNode.Attributes.Append(NodeTypePropIdAttribute); XmlAttribute ObjectClassPropIdAttribute = XmlDoc.CreateAttribute("objectclasspropid"); ObjectClassPropIdAttribute.Value = ObjectClassPropId.ToString(); NewPropNode.Attributes.Append(ObjectClassPropIdAttribute); XmlAttribute PropNameAttribute = XmlDoc.CreateAttribute("name"); PropNameAttribute.Value = Name; NewPropNode.Attributes.Append(PropNameAttribute); XmlAttribute ArbitraryIdAttribute = XmlDoc.CreateAttribute("arbitraryid"); ArbitraryIdAttribute.Value = ArbitraryId; NewPropNode.Attributes.Append(ArbitraryIdAttribute); XmlAttribute SortByAttribute = XmlDoc.CreateAttribute("sortby"); SortByAttribute.Value = SortBy.ToString(); NewPropNode.Attributes.Append(SortByAttribute); XmlAttribute SortMethodAttribute = XmlDoc.CreateAttribute("sortmethod"); SortMethodAttribute.Value = SortMethod.ToString(); NewPropNode.Attributes.Append(SortMethodAttribute); XmlAttribute FieldTypeAttribute = XmlDoc.CreateAttribute("fieldtype"); if (FieldType != CswNbtResources.UnknownEnum) { FieldTypeAttribute.Value = FieldType.ToString(); } else { FieldTypeAttribute.Value = string.Empty; } NewPropNode.Attributes.Append(FieldTypeAttribute); XmlAttribute OrderAttribute = XmlDoc.CreateAttribute("order"); if (Order != Int32.MinValue) { OrderAttribute.Value = Order.ToString(); } else { OrderAttribute.Value = string.Empty; } NewPropNode.Attributes.Append(OrderAttribute); XmlAttribute WidthAttribute = XmlDoc.CreateAttribute("width"); if (Width != Int32.MinValue) { WidthAttribute.Value = Width.ToString(); } else { WidthAttribute.Value = string.Empty; } NewPropNode.Attributes.Append(WidthAttribute); XmlAttribute ShowInGridAttribute = XmlDoc.CreateAttribute("showingrid"); ShowInGridAttribute.Value = ShowInGrid.ToString(); NewPropNode.Attributes.Append(ShowInGridAttribute); foreach (CswNbtViewPropertyFilter Filter in this.Filters) { XmlNode FilterNode = Filter.ToXml(XmlDoc); NewPropNode.AppendChild(FilterNode); } return(NewPropNode); }
private string GetOrderByClause(SortBy sortBy, SortDirection sortDirection, string articleAlias) { if (sortBy == SortBy.None) { return String.Empty; } else { switch (sortBy) { case SortBy.DateCreated: case SortBy.DateModified: case SortBy.DateOnline: case SortBy.Title: return String.Format("order by {0}.{1} {2}", articleAlias, sortBy.ToString(), sortDirection.ToString()); case SortBy.Category: return String.Format("order by {0}.Category.Title {1}", articleAlias, sortDirection.ToString()); case SortBy.CreatedBy: return String.Format("order by {0}.CreatedBy.UserName {1}", articleAlias, sortDirection.ToString()); case SortBy.ModifiedBy: return String.Format("order by {0}.ModifiedBy.UserName {1}", articleAlias, sortDirection.ToString()); default: return String.Empty; } } }
private void Sort(bool descending) { LoggerController.Log("Case Type: " + CaseType.SF.ToString() + " Sort By: " + SortBy.ToString() + ((descending) ? " Descending" : " Ascending")); CaseControls.ToList().ForEach(o => o.CloseDetails()); _isBusySortCases = true; IOrderedEnumerable <IGrouping <object, CaseControlVM> > sorted = default(IOrderedEnumerable <IGrouping <object, CaseControlVM> >); if (descending) { sorted = CaseControls.OrderByDescending(Order(SortBy)).GroupBy(Group(GroupBy)).OrderBy(g => g.Key); } else { sorted = CaseControls.OrderBy(Order(SortBy)).GroupBy(Group(GroupBy)).OrderBy(g => g.Key); } UpdatedOrderedCases(sorted); _isBusySortCases = false; }