本文整理汇总了C#中SortDirection类的典型用法代码示例。如果您正苦于以下问题:C# SortDirection类的具体用法?C# SortDirection怎么用?C# SortDirection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SortDirection类属于命名空间,在下文中一共展示了SortDirection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
private void Initialize(string sortExpression)
{
FieldName = string.Empty;
Direction = SortDirection.Ascending;
if (string.IsNullOrEmpty(sortExpression))
return;
var sortExp = sortExpression.Trim();
if (sortExp.EndsWith(" DESC"))
{
sortExp = sortExp.Remove(sortExp.LastIndexOf(" DESC"));
this.Direction = SortDirection.Descending;
}
else if (sortExp.EndsWith(" ASC"))
{
sortExp = sortExp.Remove(sortExp.LastIndexOf(" ASC"));
this.Direction = SortDirection.Ascending;
}
this.FullName = sortExp;
var separatorIndex = sortExp.IndexOf('.');
if (separatorIndex >= 0)
sortExp = sortExp.Substring(separatorIndex + 1);
this.FieldName = sortExp;
}
示例2: Search
public List<BRAND> Search(BRAND Brand, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, SortDirection SortDirection)
{
var result = Context.BRAND.AsQueryable();
if (Brand != null)
{
if (!String.IsNullOrEmpty(Brand.Name))
{
result = result.Where(b => b.Name.Contains(Brand.Name));
}
if (!String.IsNullOrEmpty(Brand.ShowName))
{
result = result.Where(b => b.ShowName.Contains(Brand.ShowName));
}
if (!String.IsNullOrEmpty(Brand.Description))
{
result = result.Where(b => b.Description.Contains(Brand.Description));
}
if (!String.IsNullOrEmpty(Brand.Email))
{
result = result.Where(b => b.Email.Contains(Brand.Email));
}
}
TotalRecords = result.Count();
GenericSorterCaller<BRAND> sorter = new GenericSorterCaller<BRAND>();
result = sorter.Sort(result, string.IsNullOrEmpty(OrderExp) ? DEFAULT_ORDER_EXP : OrderExp, SortDirection);
// pagination
return result.Skip(PageIndex * PageSize).Take(PageSize).ToList();
}
示例3: PagingInfo
public PagingInfo(
string sortTitle,
string sortExpression,
SortDirection sortDirection)
{
AddSortExpression(sortTitle, sortExpression, sortDirection);
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SetPageRibbon(StandardModuleRibbons.SetupRibbon());
SID.Text = Session["SID"] == null ? "" : Session["SID"].ToString();
if (SID.Text == "") Response.Redirect("SurveyList.aspx");
var s = Survey.FetchObject(int.Parse(SID.Text));
lblSurvey.Text = string.Format("{0} - {1}", s.Name, s.LongName);
if (s.Status > 1) ReadOnly.Text = "true";
}
MasterPage.RequiredPermission = 5200;
MasterPage.IsSecure = true;
MasterPage.PageTitle = string.Format("{0}", "Survey/Test Question List");
_mStrSortExp = String.Empty;
if (!IsPostBack)
{
_mStrSortExp = String.Empty;
}
else
{
if (null != ViewState["_SortExp_"])
{
_mStrSortExp = ViewState["_SortExp_"] as String;
}
if (null != ViewState["_Direction_"])
{
_mSortDirection = (SortDirection)ViewState["_Direction_"];
}
}
}
示例5: SortableField
public SortableField(string name, SortDirection sortDirection = SortDirection.Asc)
{
Ensure.That(name, "name").IsNotNullOrWhiteSpace();
Name = name;
SortDirection = sortDirection;
}
示例6: SortExpressionLink
public static MvcHtmlString SortExpressionLink(
this HtmlHelper helper,
string title,
string sortExpression,
SortDirection direction = SortDirection.Ascending,
object htmlAttributes = null)
{
var a = new TagBuilder("a");
if (htmlAttributes != null)
{
// get the attributes
IDictionary<string, object> attributes =
HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)
as IDictionary<string, object>;
// set the attributes
a.MergeAttributes(attributes);
}
var i = new TagBuilder("i");
i.MergeAttribute("class", "indicator");
a.AddCssClass("sort-expression-link");
a.MergeAttribute("title", title);
a.MergeAttribute("href", "#" + sortExpression);
a.MergeAttribute("data-sort-expression", sortExpression);
a.MergeAttribute("data-sort-direction", direction.ToString());
a.InnerHtml = title + i.ToString(TagRenderMode.Normal);
return
MvcHtmlString.Create(a.ToString(TagRenderMode.Normal));
}
示例7: Init
public void Init(ParsingContext context, ParseTreeNode parseNode)
{
if (HasChildNodes(parseNode))
{
if (parseNode.ChildNodes[3] != null && HasChildNodes(parseNode.ChildNodes[3]) && parseNode.ChildNodes[3].ChildNodes[0].Term.Name.ToUpper() == "DESC")
_OrderDirection = SortDirection.Desc;
else
_OrderDirection = SortDirection.Asc;
_OrderByAttributeList = new List<OrderByAttributeDefinition>();
foreach (ParseTreeNode treeNode in parseNode.ChildNodes[2].ChildNodes)
{
if (treeNode.AstNode != null && treeNode.AstNode is IDNode)
{
_OrderByAttributeList.Add(new OrderByAttributeDefinition(((IDNode)treeNode.AstNode).IDChainDefinition, null));
}
else
{
_OrderByAttributeList.Add(new OrderByAttributeDefinition(null, treeNode.Token.ValueString));
}
}
OrderByDefinition = new OrderByDefinition(_OrderDirection, _OrderByAttributeList);
}
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
MasterPage.RequiredPermission = 4500;
MasterPage.IsSecure = true;
MasterPage.PageTitle = string.Format("{0}", "Events List");
_mStrSortExp = String.Empty;
if (!IsPostBack)
{
SetPageRibbon(StandardModuleRibbons.SetupRibbon());
//if (WasFiltered())
//{
// GetFilterSessionValues();
//}
_mStrSortExp = String.Empty;
}
else
{
if (null != ViewState["_SortExp_"])
{
_mStrSortExp = ViewState["_SortExp_"] as String;
}
if (null != ViewState["_Direction_"])
{
_mSortDirection = (SortDirection)ViewState["_Direction_"];
}
}
}
示例9: OrderByField
/// <summary>
/// Creates new instance of OrderByField
/// </summary>
/// <param name="OrderField">Field to order by</param>
/// <param name="Direction">Sort direction</param>
public OrderByField(Field OrderField, SortDirection Direction)
{
if (OrderField == null)
throw new ArgumentNullException("OrderField");
this.Field = OrderField;
this.Direction = Direction;
}
示例10: GridView1_Sorting
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
DataTable dataTable = GridView1.DataSource as DataTable;
string sortExpression = e.SortExpression;
string direction = string.Empty;
if (dataTable != null)
{
DataView dataView = new DataView(dataTable);
if (SortDirection == SortDirection.Descending)
{
SortDirection = SortDirection.Ascending;
direction = " ASC";
}
else
{
SortDirection = SortDirection.Descending;
direction = " DESC";
}
DataTable table = GridView1.DataSource as DataTable;
table.DefaultView.Sort = sortExpression + direction;
GridView1.DataSource = table;
GridView1.DataBind();
}
}
示例11: ReportSortOptions
public ReportSortOptions(string criterium, SortDirection direction)
: base(criterium, direction)
{
var allowedCriteria = new string[] { "Operator.Name", "CreateDate" };
if (!allowedCriteria.Contains(criterium))
throw new ArgumentException("criterium");
}
示例12: IndexKeyColumn
public IndexKeyColumn(Column column, SortDirection sortDirection)
{
if (column == null) throw new ArgumentNullException("column");
Column = column;
SortDirection = sortDirection;
}
示例13: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
MasterPage.RequiredPermission = 4100;
MasterPage.IsSecure = true;
MasterPage.PageTitle = string.Format("{0}", "School and District Crosswalk");
if (!IsPostBack)
{
SetPageRibbon(StandardModuleRibbons.SettingsRibbon());
//LoadData();
}
_mStrSortExp = String.Empty;
if (!IsPostBack)
{
_mStrSortExp = String.Empty;
}
else
{
if (null != ViewState["_SortExp_"])
{
_mStrSortExp = ViewState["_SortExp_"] as String;
}
if (null != ViewState["_Direction_"])
{
_mSortDirection = (SortDirection)ViewState["_Direction_"];
}
}
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
MasterPage.RequiredPermission = 4400;
MasterPage.IsSecure = true;
if (!IsPostBack)
{
SetPageRibbon(StandardModuleRibbons.SetupRibbon());
lblPK.Text = Session["BLL"] == null ? "" : Session["BLL"].ToString(); //Session["BLL"]= string.Empty;
var bl = BookList.FetchObject(int.Parse(lblPK.Text));
MasterPage.PageTitle = string.Format("Tasks in the \"{0}\" Challenge", bl.AdminName);
}
_mStrSortExp = String.Empty;
if (!IsPostBack)
{
_mStrSortExp = String.Empty;
}
else
{
if (null != ViewState["_SortExp_"])
{
_mStrSortExp = ViewState["_SortExp_"] as String;
}
if (null != ViewState["_Direction_"])
{
_mSortDirection = (SortDirection)ViewState["_Direction_"];
}
}
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
MasterPage.RequiredPermission = 8000;
MasterPage.IsSecure = true;
MasterPage.PageTitle = string.Format("{0}", "Organization List");
if (!(bool)CRIsMasterTenant)
{
Response.Redirect("MyTenantAccount.aspx");
}
_mStrSortExp = String.Empty;
if (!IsPostBack)
{
SetPageRibbon(StandardModuleRibbons.MasterTenantRibbon());
_mStrSortExp = String.Empty;
}
else
{
if (null != ViewState["_SortExp_"])
{
_mStrSortExp = ViewState["_SortExp_"] as String;
}
if (null != ViewState["_Direction_"])
{
_mSortDirection = (SortDirection)ViewState["_Direction_"];
}
}
}