当前位置: 首页>>代码示例>>C#>>正文


C# ColumnCollection.OrderBy方法代码示例

本文整理汇总了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));
        }
开发者ID:mparsin,项目名称:Elements,代码行数:28,代码来源:ColumnsExtensions.cs

示例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;
     }
 }
开发者ID:nHydrate,项目名称:nHydrate,代码行数:18,代码来源:Table.cs

示例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;
			}
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:20,代码来源:TableComponent.cs

示例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);
            }
        }
开发者ID:mparsin,项目名称:Elements,代码行数:41,代码来源:ColumnsExtensions.cs


注:本文中的ColumnCollection.OrderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。