本文整理汇总了C#中SortBy类的典型用法代码示例。如果您正苦于以下问题:C# SortBy类的具体用法?C# SortBy怎么用?C# SortBy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SortBy类属于命名空间,在下文中一共展示了SortBy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCandidatesListBySearchModelAsync
public async Task<List<CandidateUser>> GetCandidatesListBySearchModelAsync(int? minSalary, int? maxSalary, int? minExperienceInYears, int? maxExperienceInYears, SortBy sortBy, List<Skill> skills)
{
var filter = GetSalaryExperienceFilter(minSalary, maxSalary, minExperienceInYears, maxExperienceInYears);
var skillsName = skills.Select(r => r.NameToLower).ToList();
var matchBson = GetMatchedSkillsStageBson(skillsName);
var projectBson = GetCandidateProjectionBson(skillsName, skills.Count);
var sortDefinition = GetCandidateSortDefinition(sortBy);
var candidatesQuery = dbContext.CandidateUsers
.Aggregate()
.Match(filter)
.Match(new BsonDocumentFilterDefinition<CandidateUser>(matchBson))
.Project(new BsonDocumentProjectionDefinition<CandidateUser, BsonDocument>(projectBson))
.Match(new BsonDocumentFilterDefinition<BsonDocument>(new BsonDocument("Matched", true)))
.Project(new BsonDocumentProjectionDefinition<BsonDocument, CandidateUser>(new BsonDocument("Skills", 1).Add("Salary", 1).Add("ExperienceInYears", 1).Add("Name", 1).Add("ModificationDate",1).Add("ExperienceDescription", 1)));
if (sortDefinition != null)
{
candidatesQuery = candidatesQuery.Sort(sortDefinition);
}
var candidates = await candidatesQuery.ToListAsync();
return candidates;
}
示例2: GetParametersString
public static string GetParametersString(int page, SortBy sort, OrderBy direction)
{
return string.Format("page={0}&sort={1}&direction={2}",
page,
sort.GetText(),
direction.GetText());
}
示例3: FindAllPlaylists
/// <summary>
/// Find all playlists in this account.
/// </summary>
/// <param name="pageSize">Number of playlists returned per page. A page is a subset of all of the playlists that
/// satisfy the request. The maximum page size is 50.</param>
/// <param name="pageNumber">The zero-indexed number of the page to return.</param>
/// <param name="sortBy">The property that you'd like to sort the results by.</param>
/// <param name="sortOrder">The order that you'd like the results sorted - ascending or descending.</param>
/// <param name="videoFields">A list of the fields you wish to have populated in the Videos
/// contained in the playlists. If you omit this parameter, the method returns the following fields of the
/// Video: id, name, shortDescription, longDescription, creationDate, publisheddate, lastModifiedDate, linkURL,
/// linkText, tags, videoStillURL, thumbnailURL, referenceId, length, economics, playsTotal, playsTrailingWeek.
/// If you use a token with URL access, this method also returns the Videos' FLVURL, renditions, FLVFullLength,
/// videoFullLength.</param>
/// <param name="playlistFields">A list of the fields you wish to have populated in the Playlists
/// contained in the returned object. If you omit this parameter, all playlist fields are returned.</param>
/// <param name="customFields">A list of the custom fields you wish to have populated in the videos
/// contained in the returned object. If you omit this parameter, no custom fields are returned, unless you include
/// the value 'customFields' in the video_fields parameter.</param>
/// <param name="getItemCount">If true, also return how many total results there are.</param>
/// <returns>A collection of Playlists that is the specified subset of all the playlists in this account.</returns>
public BrightcoveItemCollection<BrightcovePlaylist> FindAllPlaylists(int pageSize, int pageNumber, SortBy sortBy, SortOrder sortOrder, IEnumerable<string> videoFields,
IEnumerable<string> playlistFields, IEnumerable<string> customFields, bool getItemCount)
{
NameValueCollection parms = BuildBasicReadParams("find_all_playlists");
parms.Add("page_size", pageSize.ToString());
parms.Add("page_number", pageNumber.ToString());
parms.Add("sort_by", sortBy.ToBrightcoveName());
parms.Add("sort_order", sortOrder.ToBrightcoveName());
parms.Add("get_item_count", getItemCount.ToString().ToLower());
if (videoFields != null)
{
parms.AddRange("video_fields", videoFields);
}
if (playlistFields != null)
{
parms.AddRange("playlist_fields", playlistFields);
}
if (customFields != null)
{
parms.AddRange("custom_fields", customFields);
}
return RunQuery<BrightcoveItemCollection<BrightcovePlaylist>>(parms);
}
示例4: QueryStringFactoryTestsWithSort
public QueryStringFactoryTestsWithSort(SortBy sortBy, Order order, string expectedSortBy, string expectedOrder)
{
_sortBy = sortBy;
_order = order;
_expectedSortBy = expectedSortBy;
_expectedOrder = expectedOrder;
}
示例5: GetAllArticlesBySection
/// <summary>
/// Get all articles for a given section.
/// </summary>
/// <param name="section"></param>
/// <param name="sortBy"></param>
/// <param name="sortDirection"></param>
/// <returns></returns>
public IList GetAllArticlesBySection(Section section, SortBy sortBy, SortDirection sortDirection)
{
string hql = "from Article a left join fetch a.Category where a.Section.Id = :sectionId "
+ GetOrderByClause(sortBy, sortDirection, "a");
IQuery q = this._sessionManager.OpenSession().CreateQuery(hql);
q.SetInt32("sectionId", section.Id);
return q.List();
}
示例6: GetSorter
public static ContactSorter GetSorter(SortBy sortBy)
{
switch (sortBy)
{
case SortBy.FirstName:
return new FirstNameSorter();
break;
case SortBy.LastName:
return new LastNameSorter();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
示例7: UserSettings
public UserSettings()
{
Timeout = new List<string>()
{
"10 seconds","20 seconds","30 seconds"
};
KeepItemsFor = new List<string>()
{
"6 hours","12 hours","1 day"
};
_ignoreReadItems = true;
_imagesEnabled = true;
_sortItemsBy = SortBy.Date;
}
示例8: SortOrder
public static IComparer SortOrder(SortBy s)
{
if (s == SortBy.FruitName)
{
return new SortByName();
}
else if (s == SortBy.FruitPrice)
{
return new SortByPrice();
}
else
{
//default order
return new SortByName();
}
}
示例9: FindAllAudioTracks
/// <summary>
/// Find all audio tracks in the Brightcove media library for this account.
/// </summary>
/// <param name="pageSize">Number of items returned per page. Maximum page size is 100.</param>
/// <param name="pageNumber">The zero-indexed number of the page to return.</param>
/// <param name="sortBy">The field by which to sort the results.</param>
/// <param name="sortOrder">How to order the results: ascending or descending.</param>
/// <param name="audioTrackFields">A list of the fields you wish to have populated in the audiotracks
/// contained in the returned object.</param>
/// <param name="getItemCount">If true, also return how many total results there are.</param>
/// <returns>A collection of audio tracks matching the specified search criteria.</returns>
public BrightcoveItemCollection<BrightcoveAudioTrack> FindAllAudioTracks(int pageSize, int pageNumber, SortBy sortBy, SortOrder sortOrder, IEnumerable<string> audioTrackFields, bool getItemCount)
{
NameValueCollection parms = BuildBasicReadParams("find_all_audiotracks");
parms.Add("get_item_count", getItemCount.ToString().ToLower());
parms.Add("page_size", pageSize.ToString());
parms.Add("page_number", pageNumber.ToString());
parms.Add("sort_by", sortBy.ToBrightcoveName());
parms.Add("sort_order", sortOrder.ToBrightcoveName());
if (audioTrackFields != null)
{
parms.AddRange("audiotrack_fields", audioTrackFields);
}
return RunQuery<BrightcoveItemCollection<BrightcoveAudioTrack>>(parms);
}
示例10: GetUserReputationList
/// <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;
}
示例11: GetParameters
private void GetParameters()
{
_modClassId = 0;
if(InputContext.DoesParamExist("s_modclassid", "s_modclassid"))
{
_modClassId = InputContext.GetParamIntOrZero("s_modclassid", "s_modclassid");
}
_modStatus = (int)BBC.Dna.Moderation.Utils.ModerationStatus.UserStatus.Restricted;
if(InputContext.DoesParamExist("s_modstatus", "s_modstatus"))
{
_modStatus = (int)Enum.Parse(typeof(BBC.Dna.Moderation.Utils.ModerationStatus.UserStatus), InputContext.GetParamStringOrEmpty("s_modstatus", "s_modstatus")); ;
}
_days =1;
if(InputContext.DoesParamExist("s_days", "s_days"))
{
_days = InputContext.GetParamIntOrZero("s_days", "s_days");
}
_startIndex = 0;
if (InputContext.DoesParamExist("s_startIndex", "startIndex"))
{
_startIndex = InputContext.GetParamIntOrZero("s_startIndex", "s_startIndex");
}
if (InputContext.DoesParamExist("s_sortby", "sortby"))
{
sortBy = (SortBy)Enum.Parse(typeof(SortBy), InputContext.GetParamStringOrEmpty("s_sortby", ""));
}
if (InputContext.DoesParamExist("s_sortdirection", "sortdirection"))
{
sortDirection = (SortDirection)Enum.Parse(typeof(SortDirection), InputContext.GetParamStringOrEmpty("s_sortdirection", "s_sortdirection"));
}
}
示例12: AdvancedSearch
/// <summary>
/// Advanced Search
/// </summary>
/// <param name="advancedSearch"> Object advandced search</param>
/// <returns></returns>
public List<SearchDocumentResult> AdvancedSearch(AdvancedSearchDto advancedSearch, SortBy sortBy)
{
var result = new List<SearchDocumentResult>();
if (advancedSearch != null)
{
try
{
string strResponse = string.Empty;
// String search query
string strQuery = BuildSearchQuery(advancedSearch);
// String search option
string strOption = BuildSearchOption(SearchOptionConst.And, false);
// Call Amazon Cloud Search API Service
AmazonCloudSearcher ObjCloudSearch = new AmazonCloudSearcher();
strResponse = ObjCloudSearch.SearchRequest(ApiEndpoint,
ApiVersion,
strQuery,
strOption,
"_all_fields,_score",
SearchOptionConst.SortByScoreDesc,
DataFormat.Json);
result = GetSearchDocumentList(strResponse);
return result;
}
catch (Exception e)
{
Log.Error("Advanced search error. Message: " + e.Message + " Stack trace: " + e.StackTrace);
}
}
return null;
}
示例13: GetOffersByOfferSearchModelAsync
public async Task<List<JobOffer>> GetOffersByOfferSearchModelAsync(List<Skill> skills, int? minSalary, int? maxSalary, string name, SortBy sortBy)
{
var filter = GetSalaryNameFilter(minSalary, maxSalary, name);
var skillsName = skills.Select(r => r.NameToLower).ToList();
var matchBson = GetMatchedSkillsStageBson(skillsName);
var projectBson = GetOfferProjectionBson(skillsName, skills.Count);
var sortDefinition = GetSortDefinition(sortBy);
var offersQuery = dbContext.JobOffers
.Aggregate()
.Match(filter)
.Match(new BsonDocumentFilterDefinition<JobOffer>(matchBson))
.Project(new BsonDocumentProjectionDefinition<JobOffer, BsonDocument>(projectBson))
.Match(new BsonDocumentFilterDefinition<BsonDocument>(new BsonDocument("Matched", true)))
.Project(new BsonDocumentProjectionDefinition<BsonDocument, JobOffer>(new BsonDocument("RecruiterId", 1).Add("Salary", 1).Add("Name", 1).Add("Skills", 1).Add("ModificationDate", 1).Add("Description", 1)));
if (sortDefinition!=null)
{
offersQuery = offersQuery.Sort(sortDefinition);
}
var offers = await offersQuery.ToListAsync();
return offers;
}
示例14: SearchVideos
/// <summary>
/// Searches videos according to the criteria provided by the user.
/// </summary>
/// <param name="all">Specifies the field:value pairs for search criteria that MUST be present in
/// the index in order to return a hit in the result set. If the field's name is not present, it is
/// assumed to be name and shortDescription.</param>
/// <param name="any">Specifies the field:value pairs for search criteria AT LEAST ONE of which
/// must be present to return a hit in the result set. If the field's name is not present, it is
/// assumed to be name and shortDescription.</param>
/// <param name="none">Specifies the field:value pairs for search criteria that MUST NOT be present
/// to return a hit in the result set. If the field's name is not present, it is assumed to be
/// name and shortDescription.</param>
/// <param name="pageSize">Number of items returned per page. (max 100)</param>
/// <param name="pageNumber">The zero-indexed number of the page to return.</param>
/// <param name="exact">If true, disables fuzzy search and requires an exact match of search terms.
/// A fuzzy search does not require an exact match of the indexed terms, but will return a hit for
/// terms that are closely related based on language-specific criteria. The fuzzy search is
/// available only if your account is based in the United States.</param>
/// <param name="sortBy">Specifies the field by which to sort results.</param>
/// <param name="sortOrder">Specifies the direction in which to sort results</param>
/// <param name="videoFields">A list of the fields you wish to have populated in the Videos contained
/// in the returned object. If you omit this parameter, the method returns the following fields of
/// the video: id, name, shortDescription, longDescription, creationDate, publisheddate, lastModifiedDate,
/// linkURL, linkText, tags, videoStillURL, thumbnailURL, referenceId, length, economics, playsTotal,
/// playsTrailingWeek. If you use a token with URL access, this method also returns FLVURL, renditions,
/// FLVFullLength, videoFullLength.</param>
/// <param name="customFields">A list of the custom fields you wish to have populated in the videos
/// contained in the returned object. If you omit this parameter, no custom fields are returned, unless you
/// include the value 'customFields' in the video_fields parameter.</param>
/// <returns>A collection of videos matching the specified criteria.</returns>
public BrightcoveItemCollection<BrightcoveVideo> SearchVideos(IEnumerable<FieldValuePair> all, IEnumerable<FieldValuePair> any, IEnumerable<FieldValuePair> none,
int pageSize, int pageNumber, bool exact, SortBy sortBy, SortOrder sortOrder,
IEnumerable<string> videoFields, IEnumerable<string> customFields)
{
return SearchVideos(all, any, none, pageSize, pageNumber, exact, sortBy, sortOrder, videoFields, customFields, true);
}
示例15: nextSort
/// <summary>
/// Selects the next sorting mechanism
/// </summary>
private void nextSort()
{
currentSort = currentSort.Next ();
if (currentSort == SortBy.PACKAGE_ORDER && !currentPackage.ownOrder) {
currentSort = currentSort.Next ();
}
}