本文整理汇总了C#中SortBy.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SortBy.ToString方法的具体用法?C# SortBy.ToString怎么用?C# SortBy.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortBy
的用法示例。
在下文中一共展示了SortBy.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: GetOrderByClause
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;
}
}
}
示例3: GetQuery
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;
}