本文整理汇总了C#中Sort.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Sort.ToString方法的具体用法?C# Sort.ToString怎么用?C# Sort.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sort
的用法示例。
在下文中一共展示了Sort.ToString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGallery
public static async Task<Response<List<Image>>> GetGallery(Section? section = null, Sort? sort = null, Window? window = null, bool? showViral = null, int? page = null)
{
string uri = "gallery";
if (section != null)
{
uri += "/" + section.ToString().ToLower();
if(sort != null)
{
uri += "/" + sort.ToString().ToLower();
if(window != null)
{
uri += "/" + window.ToString().ToLower();
if (showViral != null)
{
uri += "/" + showViral.ToString();
if (page != null)
{
uri += "/" + page;
}
}
}
}
}
return await NetworkHelper.GetRequest<List<Image>>(uri);
}
示例2: GetSubreddditGallery
public static async Task<Response<List<Image>>> GetSubreddditGallery(string subreddit, Sort? sort = null, Window? window = null, int? page = null)
{
//{ subreddit}/{ sort}/{ window}/{ page}
string uri = "gallery/r/" + subreddit;
if (sort != null)
{
uri += "/" + sort.ToString().ToLower();
if (window != null)
{
uri += "/" + window.ToString().ToLower();
if (page != null)
{
uri += "/" + page;
}
}
}
return await NetworkHelper.GetRequest<List<Image>>(uri);
}
示例3: GetTopicGallery
public static async Task<Response<List<Image>>> GetTopicGallery(int topicId, Sort? sort = null, Window? window = null, int? page = null)
{
//{topicId}/{sort}/{window}/{page}
string uri = "topics/" + topicId;
if (sort != null)
{
uri += "/" + sort.ToString().ToLower();
if (window != null)
{
uri += "/" + window.ToString().ToLower();
if (page != null)
{
uri += "/" + page;
}
}
}
return await NetworkHelper.GetRequest<List<Image>>(uri);
}
示例4: SearchGallery
public static async Task<Response<List<Image>>> SearchGallery(string query, Sort? sort = null, int? page = null )
{
//gallery/search/{sort}/{page}
string uri = "gallery/search";
if (sort != null)
{
uri += "/" + sort.ToString().ToLower();
if (page != null)
{
uri += "/" + page;
}
}
uri = $"{uri}?q={query}";
return await NetworkHelper.GetRequest<List<Image>>(uri);
}
示例5: GetComments
public static async Task<Response<List<Comment>>> GetComments(string imageId, Sort sort = Sort.Best)
{
//gallery/{id}/comments/{sort}
string uri = "gallery/" + imageId + "/comments/" + sort.ToString().ToLower();
return await NetworkHelper.GetRequest<List<Comment>>(uri);
}
示例6: AddSortField
/// <summary>
/// Adds the sort field to the request.
/// </summary>
/// <param name="sortField">The sort field.</param>
/// <param name="AorD">Ascending or Descending sort enumerator (FMSAxml.sort).</param>
public void AddSortField(String sortField, Sort AorD)
{
sortCounter++;
theRequest += "&-sortfield." + sortCounter + "=" + Uri.EscapeUriString(sortField) + "&-sortorder." + sortCounter + "=" + AorD.ToString().ToLower();
}
示例7: AddSortField
/// <summary>
/// Adds the sort field to the request.
/// </summary>
/// <param name="sortField">The sort field.</param>
/// <param name="AorD">Ascending or Descending sort enumerator (FMSAxml.sort).</param>
public void AddSortField(String sortField, Sort AorD)
{
// 2nd overload, sort either ascending or descending
if (findCommand == "&-findany")
return;
sortCounter++;
theRequest += "&-sortfield." + sortCounter + "=" + Uri.EscapeUriString(sortField) + "&-sortorder." + sortCounter + "=" + AorD.ToString().ToLower();
}
示例8: GetHairShops
public List<HairShop> GetHairShops(int count, string selectCondition, OrderKey ok,Sort sort)
{
List<HairShop> list = new List<HairShop>();
string orderKey = " order by ";
switch (ok)
{
case OrderKey.ID:
orderKey += "hs.HairShopID";
break;
case OrderKey.CommentNum:
orderKey += "hs.HairShopGood+hs.HairShopBad";
break;
case OrderKey.RecommandNum:
orderKey += "hs.HairShopRecommandNum";
break;
case OrderKey.HitNum:
orderKey += "hs.HairShopVisitNum";
break;
case OrderKey.OrderNum:
orderKey += "hs.HairShopOrderNum";
break;
default:
orderKey += "hs.HairShopID";
break;
}
string commText = "";
switch (count)
{
case 0:
commText = "select * from HairShop hs left join City c on hs.HairShopCityID=c.cityID left join MapZone m on hs.HairShopMapZoneID = m.MapZoneID left join HotZone h on hs.HairShopHotZoneID = h.HotZoneID left join TypeTable tt on hs.TypeID=tt.TypeID " + selectCondition + orderKey + " " + sort.ToString();
break;
default:
commText = "select top " + count.ToString() + " * from HairShop hs left join City c on hs.HairShopCityID=c.cityID left join MapZone m on hs.HairShopMapZoneID = m.MapZoneID left join HotZone h on hs.HairShopHotZoneID = h.HotZoneID left join TypeTable tt on hs.TypeID=tt.TypeID " + selectCondition + orderKey + " " + sort.ToString();
break;
}
using (SqlConnection conn = new SqlConnection(DataHelper2.SqlConnectionString))
{
{
using (SqlCommand comm = new SqlCommand())
{
comm.Connection = conn;
comm.CommandText = commText;
conn.Open();
using (SqlDataReader sdr = comm.ExecuteReader())
{
while (sdr.Read())
{
HairShop hairShop = new HairShop();
hairShop.HairShopID = int.Parse(sdr["HairShopID"].ToString());
hairShop.HairShopName = sdr["HairShopName"].ToString();
hairShop.HairShopCityID = int.Parse(sdr["HairShopCityID"].ToString());
hairShop.HairShopCityName = sdr["CityName"].ToString();
hairShop.HairShopMapZoneID = int.Parse(sdr["HairShopMapZoneID"].ToString());
hairShop.HairShopMapZoneName = sdr["MapZoneName"].ToString();
hairShop.HairShopHotZoneID = int.Parse(sdr["HairShopHotZoneID"].ToString());
hairShop.HairShopHotZoneName = sdr["HotZoneName"].ToString();
hairShop.HairShopAddress = sdr["HairShopAddress"].ToString();
hairShop.HairShopPhoneNum = sdr["HairShopPhoneNum"].ToString();
//hairShop.HairShopPictureStoreIDs = sdr["HairShopPictureStoreIDs"].ToString();
//hairShop.HairShopMainIDs = sdr["HairShopMainIDs"].ToString();
//hairShop.HairShopPartialIDs = sdr["HairShopPartialIDs"].ToString();
hairShop.HairShopEngineerNum = int.Parse(sdr["HairShopEngineerNum"].ToString());
hairShop.HairShopOpenTime = sdr["HairShopOpenTime"].ToString();
//hairShop.HairShopOrderNum = int.Parse(sdr["HairShopOrderNum"].ToString());
hairShop.HairShopVisitNum = int.Parse(sdr["HairShopVisitNum"].ToString());
//hairShop.WorkRangeIDs = sdr["WorkRangeIDs"].ToString();
hairShop.HairShopWebSite = sdr["HairShopWebSite"].ToString();
hairShop.HairShopEmail = sdr["HairShopEmail"].ToString();
hairShop.HairShopDiscount = sdr["HairShopDiscount"].ToString();
hairShop.HairShopLogo = sdr["HairShopLogo"].ToString();
hairShop.TravelInfo = sdr["TravelInfo"].ToString();
//try
//{
// hairShop.HairShopRecommandNum = int.Parse(sdr["HairShopRecommandNum"].ToString());
//}
//catch
//{
// hairShop.HairShopRecommandNum = 0;
//}
hairShop.HairShopCreateTime = sdr["HairShopCreateTime"].ToString();
hairShop.HairShopDescription = sdr["HairShopDescription"].ToString();
hairShop.ProductIDs = sdr["ProductIDs"].ToString();
hairShop.HairShopTagIDs = sdr["HairShopTagIDs"].ToString();
hairShop.HairShopShortName = sdr["HairShopShortName"].ToString();
//hairShop.IsBest = bool.Parse(sdr["IsBest"].ToString());
hairShop.IsJoin = bool.Parse(sdr["IsJoin"].ToString());
hairShop.TypeID = int.Parse(sdr["TypeID"].ToString());
hairShop.TypeName = sdr["TypeName"].ToString();
hairShop.IsPostStation = bool.Parse(sdr["IsPostStation"].ToString());
hairShop.IsPostMachine = bool.Parse(sdr["IsPostMachine"].ToString());
hairShop.HairShopGood = int.Parse(sdr["HairShopGood"].ToString());
hairShop.HairShopBad = int.Parse(sdr["HairShopBad"].ToString());
try
{
//.........这里部分代码省略.........
示例9: ListMapVariants
public static Uri ListMapVariants(string gamertag, int start = 0, int count = 25, Sort sort = Sort.Modified, Order order = Order.Desc)
{
var values = new NameValueCollection();
if (sort != Sort.Modified)
{
values.Add("sort", sort.ToString());
}
if (order != Order.Desc)
{
values.Add("order", order.ToString());
}
if (start > 0)
{
values.Add("start", start.ToString());
}
if (count > 0 && count < 25)
{
values.Add("count", count.ToString());
}
string baseUrl = string.Format("{0}/{1}/{2}/players/{3}/mapvariants?", MajorPrefix, MinorPrefix, Title, gamertag);
return values.BuildUri(baseUrl);
}
示例10: GetRoles
public List<RolePrivilegeModel> GetRoles(int page, int pageSize, out int recordCount, FilterLinked filterLinked = null, Sort sort = null)
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
string condition = string.Empty, order = string.Empty;
if (filterLinked != null)
{
condition = filterLinked.ToString(parameters);
}
if (sort != null)
{
order = sort.ToString();
}
//string dynamicConditions = this.ParseDynamicConditions(e, parameters, fieldMap);
var list2 = this._privilegeBase.GetRoles(page, pageSize, condition, order, out recordCount, parameters.Values.ToArray()).ToList();
list2.ForEach(delegate(RolePrivilegeModel role)
{
if (role.Name == this._privilegeBase.SystemRoleName)
{
role.Privileges = "全部权限";
}
});
return list2;
}
示例11: WithSort
public SearchQuery WithSort(Sort sort)
{
_sort = sort.ToString().ToLower();
return this;
}
示例12: GetUsers
public IList<UserRoleDetailInfo> GetUsers(int page, int pageSize, out int recordCount, FilterLinked filterLinked = null, Sort sort = null)
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
string condition = null, order = null;
if (filterLinked != null)
{
condition = filterLinked.ToString(parameters);
}
if (sort != null)
{
order = sort.ToString();
}
return _privilegeBase.GetUsers(page, pageSize, out recordCount, condition, order, parameters.Values.ToArray());
}