本文整理汇总了C#中DataBase.GetRequestTest方法的典型用法代码示例。如果您正苦于以下问题:C# DataBase.GetRequestTest方法的具体用法?C# DataBase.GetRequestTest怎么用?C# DataBase.GetRequestTest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase.GetRequestTest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestList
public ActionResult TestList(int? pageIndex, string sort, string sortDirection)
{
ViewBag.sort = sort;
if (!pageIndex.HasValue)
{
pageIndex = 1;
}
if (string.IsNullOrEmpty(sort))
{
sort = "UpdateTime";
}
if (string.IsNullOrEmpty(sortDirection))
{
sortDirection = "descending";
}
ViewBag.sortDirection = (sortDirection == "ascending") ? "descending" : "ascending";
DataBase db = new DataBase();
List<RequestTestModels> TestRequestList = new List<RequestTestModels>();
TestRequestList = db.GetRequestTest(null, null, "", "", Session[SESSION_USERID].ToString());
PagerInfo pageInfo = new PagerInfo();
pageInfo.PageSize = PAGESIZE;
pageInfo.PageIndex = pageIndex.Value;
pageInfo.PageTotalCount = TestRequestList.Count;
var query = from tr in TestRequestList
orderby Utils.GetPropertyValue(tr, tr.TestModel, sort) descending
select tr;
if (sortDirection == "ascending")
{
query = from tr in TestRequestList
orderby Utils.GetPropertyValue(tr, tr.TestModel, sort) ascending
select tr;
}
//IEnumerable<RequestTestModels> data = TestRequestList.OrderByDescending(aa => aa.InsertDateTime).Skip(pageInfo.PageSize * (pageIndex.Value - 1)).Take(pageInfo.PageSize);
IEnumerable<RequestTestModels> data = query.Skip(pageInfo.PageSize * (pageIndex.Value - 1)).Take(pageInfo.PageSize);
PageQuery<PagerInfo, IEnumerable<RequestTestModels>> requestTestQuery = new PageQuery<PagerInfo, IEnumerable<RequestTestModels>>(pageInfo, data);
return View(requestTestQuery);
}