本文整理汇总了C#中IQueryable.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# IQueryable.ToArray方法的具体用法?C# IQueryable.ToArray怎么用?C# IQueryable.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQueryable
的用法示例。
在下文中一共展示了IQueryable.ToArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormEditOrder
public FormEditOrder(ref res.Employee curEmpl)
{
InitializeComponent();
mode = (short)OrderMode.mode_new;
curEmployee = curEmpl;
lbl_num.Text = "Новый";
#region database context & entities filling
database = new res.Model1Container(RegistryInteractor.GetFromReg("Connection String"));
curPositions = new List<PositionForOrder>();
curOrder = res.Order.CreateOrder(-1, DateTime.Now, "Обработка", -1, -1);
Items = from it in database.ItemSet select it;
Categories = from cat in database.ItemCategorySet select cat;
#endregion
#region data sources
cb_itemType.DataSource = Categories.ToArray();
cb_itemType.DisplayMember = "name";
cb_itemType.ValueMember = "id";
DGV.DataSource = DGV_contentsT;
#endregion
#region event_bindings
cb_itemType.SelectedValueChanged += new EventHandler(btn_addPos_check);
cb_itemType.SelectedValueChanged += new EventHandler(this.cb_itemType_SelectedIndexChanged);
cb_itemDesignation.SelectedIndexChanged += new EventHandler(this.cb_itemDesignation_SelectedIndexChanged);
cb_itemDesignation.SelectedValueChanged += new EventHandler(this.num_itemCount_check);
cb_itemDesignation.SelectedValueChanged += new EventHandler(btn_addPos_check);
cb_itemDesignation.SelectedValueChanged += new EventHandler(num_itemCount_anull);
num_itemCount.ValueChanged += new EventHandler(btn_addPos_check);
num_itemCount.ValueChanged += new EventHandler(num_itemCount_ValueChanged);
btn_addItem.Click += new EventHandler(btn_addItem_Click);
btn_addItem.Click += new EventHandler(btn_rmItem_check);
btn_addItem.Click += new EventHandler(DGV_contentsT_Refill);
btn_addItem.Click += new EventHandler(this.btn_accept_check);
btn_rmItem.Click += new EventHandler(btn_rmItem_Click);
btn_rmItem.Click += new EventHandler(btn_rmItem_check);
btn_rmItem.Click += new EventHandler(DGV_contentsT_Refill);
btn_rmItem.Click += new EventHandler(this.btn_accept_check);
btn_accept.Click += new EventHandler(btn_accept_Click);
tb_Name.TextChanged += new EventHandler(this.btn_accept_check);
tb_phone.TextChanged += new EventHandler(this.btn_accept_check);
DGV.SelectionChanged += new EventHandler(btn_rmItem_check);
DGV.CellValueChanged += new DataGridViewCellEventHandler(DGV_CellValueChanged);
DGV.CellValueChanged += new DataGridViewCellEventHandler(DGV_contentsT_Refill);
DGV.DataError += new DataGridViewDataErrorEventHandler(DGV_DataError);
#endregion
}
示例2: Execute
protected virtual object Execute(IQueryable<TextContent> queryable, IEnumerable<OrderExpression> orders, CallType callType, int? skip, int? take)
{
#region Order query
IOrderedQueryable<TextContent> ordered = null;
foreach (var orderItem in orders)
{
if (!orderItem.Descending)
{
if (ordered == null)
{
ordered = queryable.OrderBy(orderItem.OrderExprssion);
}
else
{
ordered = ordered.ThenBy(orderItem.OrderExprssion);
}
}
else
{
if (ordered == null)
{
ordered = queryable.OrderByDescending(orderItem.OrderExprssion);
}
else
{
ordered = ordered.ThenByDescending(orderItem.OrderExprssion);
}
}
}
if (ordered != null)
{
queryable = ordered;
}
#endregion
if (skip.HasValue)
{
queryable = queryable.Skip(skip.Value);
}
if (take.HasValue)
{
queryable = queryable.Take(take.Value);
}
switch (callType)
{
case Kooboo.CMS.Content.Query.Expressions.CallType.Count:
return queryable.Count();
case Kooboo.CMS.Content.Query.Expressions.CallType.First:
return queryable.First();
case Kooboo.CMS.Content.Query.Expressions.CallType.Last:
return queryable.Last();
case Kooboo.CMS.Content.Query.Expressions.CallType.LastOrDefault:
return queryable.LastOrDefault();
case Kooboo.CMS.Content.Query.Expressions.CallType.FirstOrDefault:
return queryable.FirstOrDefault();
case Kooboo.CMS.Content.Query.Expressions.CallType.Unspecified:
default:
return queryable.ToArray();
}
}
示例3: BindToDataGridView
/// <summary>
///
/// </summary>
/// <param name="r"></param>
private void BindToDataGridView(IQueryable<tblFlow> r)
{
FlowData[] fs = FlowConverter.Convert(r.ToArray());
DataTable tbl = FlowConverter.Convert(fs);
this.dataGridView1.DataSource = tbl;
}
示例4: FillCategories
private void FillCategories()
{
Categories = from cats in database.ItemCategorySet select cats;
cb_type.DataSource = Categories.ToArray<res.ItemCategory>();
cb_type.DisplayMember = "name";
cb_type.ValueMember = "id";
cb_type.IsAccessible = true;
}