本文整理汇总了C#中OrderBy.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# OrderBy.ToString方法的具体用法?C# OrderBy.ToString怎么用?C# OrderBy.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderBy
的用法示例。
在下文中一共展示了OrderBy.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetReviewForumThreadList
/// <summary>
/// Gets the Review Forum Thread List
/// </summary>
/// <param name="numThreads"></param>
/// <param name="numSkipped"></param>
/// <param name="orderBy"></param>
/// <param name="ascending"></param>
public void GetReviewForumThreadList(int numThreads, int numSkipped, OrderBy orderBy, bool ascending)
{
if (!_initialised)
{
throw new DnaException("NOT INITIALISED - Tried to use review forum without initialising");
}
if (numThreads == 0)
{
throw new DnaException("ZERO THREADS - Stupid to not fetch any threads from forum");
}
string cachename = "RFT";
cachename += _reviewForumID.ToString() + "-" + orderBy.ToString() + "-" + ascending.ToString() + "-" + numSkipped.ToString() + "-" + (numSkipped + numThreads - 1).ToString() + ".txt";
string reviewForumXml = String.Empty;
DateTime lastDate;
//find out the cache dirty date
lastDate = CacheGetMostRecentReviewForumThreadDate(_reviewForumID);
//get it from the cache if you can
if (InputContext.FileCacheGetItem("reviewforums", cachename, ref lastDate, ref reviewForumXml))
{
// Create the review forums thread list from the cache
CreateAndInsertCachedXMLToANode(reviewForumXml, "REVIEWFORUMTHREADS", true, "REVIEWFORUM");
// Finally update the relative dates and return
UpdateRelativeDates();
return;
}
using (IDnaDataReader dataReader = InputContext.CreateDnaDataReader(GetReviewForumThreadsStoredProcedure(orderBy)))
{
dataReader.AddParameter("reviewforumid", _reviewForumID);
dataReader.AddParameter("ascending", ascending);
dataReader.Execute();
// Check to see if we found anything
if (dataReader.HasRows && dataReader.Read())
{
// Got a list, so let's skip the first NumSkipped threads
if (numSkipped > 0)
{
//Read/skip over the skip number of rows so that the row that the first row that in the do below is
//the one required
for (int i = 0; i < numSkipped; i++)
{
dataReader.Read();
}
}
int index = 0;
int forumID = dataReader.GetInt32NullAsZero("forumid");
//now lets build up the review forums threads xml
XmlElement reviewForumThreads = AddElementTag(_reviewForum, "REVIEWFORUMTHREADS");
AddAttribute(reviewForumThreads, "FORUMID", forumID);
AddAttribute(reviewForumThreads, "SKIPTO", numSkipped);
AddAttribute(reviewForumThreads, "COUNT", numThreads);
int totalThreads = dataReader.GetInt32NullAsZero("ThreadCount");
AddAttribute(reviewForumThreads, "TOTALTHREADS", totalThreads);
AddAttribute(reviewForumThreads, "ORDERBY", (int) orderBy);
AddAttribute(reviewForumThreads, "DIR", ascending);
do
{
int threadID = dataReader.GetInt32NullAsZero("ThreadID");
string subject = dataReader.GetStringNullAsEmpty("Subject");
DateTime datePosted = dataReader.GetDateTime("LastPosted");
DateTime dateEntered = dataReader.GetDateTime("DateEntered");
int H2G2ID = dataReader.GetInt32NullAsZero("h2g2id");
int authorID = dataReader.GetInt32NullAsZero("authorid");
int submitterID = dataReader.GetInt32NullAsZero("submitterid");
string userName = dataReader.GetStringNullAsEmpty("username");
XmlElement thread = AddElementTag(reviewForumThreads, "THREAD");
AddAttribute(thread, "INDEX", index);
AddIntElement(thread, "THREADID", threadID);
AddIntElement(thread, "H2G2ID", H2G2ID);
AddTextTag(thread, "SUBJECT", subject);
AddDateXml(datePosted, thread, "DATEPOSTED");
AddDateXml(dateEntered, thread, "DATEENTERED");
XmlElement authorElement = AddElementTag(thread, "AUTHOR");
XmlElement submitterElement = AddElementTag(thread, "SUBMITTER");
XmlElement user = AddElementTag(authorElement, "USER");
AddIntElement(user, "USERID", authorID);
AddTextTag(user, "USERNAME", userName);
XmlElement subuser = AddElementTag(submitterElement, "USER");
AddIntElement(subuser, "USERID", submitterID);
//.........这里部分代码省略.........
示例2: DoAdvancedSearch
public ActionResult DoAdvancedSearch(SearchFilter searchType, string searchString, int page, SearchBy searchBy, OrderBy orderBy, string universityId)
{
return JavaScript("window.top.location.href ='" + Url.Action(searchType.ToString() + "Advanced") + "?searchString=" + searchString + "&page=" + page + "&searchBy=" + searchBy.ToString() + "&orderBy=" + orderBy.ToString() + "&universityId=" + universityId + "';");
}
示例3: ParamYoutubeSearchPlaylists
public ParamYoutubeSearchPlaylists(String query, OrderBy orderBy, int startIndex, int maxResults)
: base(startIndex, maxResults)
{
Data["q"] = query;
Data["orderby"] = orderBy.ToString();
}
示例4: Search
public ActionResult Search(string searchTerm, SearchBy searchBy, OrderBy orderBy, bool showMyGroupsOnly)
{
if (!IsLoggedIn()) {
return RedirectToLogin();
}
IEnumerable<Group> myGroups = new List<Group>();
GroupSearchModel myGroupSearchModel = new GroupSearchModel() {
SearchResults = myGroups,
SearchByOptions = new SelectList(theGroupService.SearchByOptions(), "Value", "Key", searchBy.ToString()),
OrderByOptions = new SelectList(theGroupService.OrderByOptions(), "Value", "Key", orderBy.ToString())
};
try {
UserInformationModel<User> myUser = GetUserInformatonModel();
myGroups = theGroupService.GetGroups(myUser, searchTerm, searchBy, orderBy, showMyGroupsOnly);
if (myGroups.Count<Group>() == 0) {
ViewData["Message"] = MessageHelper.NormalMessage(NO_GROUPS);
}
myGroupSearchModel.SearchResults = myGroups;
} catch(CustomException anException) {
ViewData["Message"] = MessageHelper.ErrorMessage(anException.Message);
} catch (Exception myException) {
LogError(myException, GROUP_LIST_ERROR);
ViewData["Message"] = GROUP_LIST_ERROR;
}
return View("List", myGroupSearchModel);
}