本文整理汇总了C#中ColumnCollection.OrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# ColumnCollection.OrderBy方法的具体用法?C# ColumnCollection.OrderBy怎么用?C# ColumnCollection.OrderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColumnCollection
的用法示例。
在下文中一共展示了ColumnCollection.OrderBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddColumns
/// <summary>
/// Adds the columns.
/// </summary>
/// <param name="columns">The columns.</param>
/// <param name="itemType">Type of the item.</param>
/// <param name="owner">The owner.</param>
/// <param name="prefix">The prefix.</param>
/// <param name="tableName">Name of the table.</param>
/// <param name="forFilter">if set to <c>true</c> [for filter].</param>
/// <param name="displayColumns">The display columns.</param>
/// <param name="columnOrder">The column order.</param>
public static void AddColumns(
this ColumnCollection columns,
Type itemType,
IRefreashable owner,
string prefix = null,
string tableName = null,
bool forFilter = false,
string[] displayColumns = null,
IList<string> columnOrder = null)
{
//aggregate own and parent's columns and return in default order
var columnsList = new ColumnCollection();
AddColumnsInternal(columnsList, itemType, owner, prefix, tableName, forFilter, displayColumns, columnOrder);
columns.AddRange(columnsList.OrderBy(c => c.DefaultOrder));
}
示例2: GetColumnNotInRelationships
public IEnumerable<Column> GetColumnNotInRelationships()
{
try
{
var inRelations = this.GetColumnInRelationships();
var retval = new ColumnCollection(this.Root);
foreach (var c in this.GetColumns())
{
if (!inRelations.Contains(c))
retval.Add(c);
}
return retval.OrderBy(x => x.Name);
}
catch (Exception ex)
{
throw;
}
}
示例3: GetColumns
/// <summary>
/// Returns the column for this table only (not hierarchy)
/// </summary>
/// <returns></returns>
public IEnumerable<Column> GetColumns()
{
try
{
var retval = new ColumnCollection(this.Root);
foreach (Reference r in this.Columns)
{
retval.Add((Column)r.Object);
}
return retval.OrderBy(x => x.Name);
}
catch (Exception ex)
{
throw;
}
}
示例4: AddDisplayListColumns
/// <summary>
/// Adds the display list columns.
/// </summary>
/// <param name="columns">The columns.</param>
/// <param name="itemType">Type of the item.</param>
/// <param name="owner">The owner.</param>
public static void AddDisplayListColumns(this ColumnCollection columns, Type itemType, IPageableList owner)
{
if (itemType == null)
return;
if (columns == null)
return;
var columnOut = new ColumnCollection();
var props = itemType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
foreach (var prop in props)
{
if (prop.Name.Equals("DLOrderId"))
continue;
var display = (DisplayAttribute)(from d in prop.GetCustomAttributes(typeof(DisplayAttribute), false) select d).FirstOrDefault();
if (display == null || string.IsNullOrEmpty(display.Name)) continue;
var column = ColumnFactory.CreateColumn(owner, columnOut);
column.Header = display.GetName();
column.ColumnName = prop.Name;
column.Property = prop;
var orderId = display.GetOrder() ?? 0;
column.Order = orderId;
columnOut.Add(column);
}
foreach (var columnItem in columnOut.OrderBy(d => d.Order))
{
columns.Add(columnItem);
}
}