本文整理汇总了C#中System.Linq.Expressions.Expression.AndAlso方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.AndAlso方法的具体用法?C# Expression.AndAlso怎么用?C# Expression.AndAlso使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.Expression
的用法示例。
在下文中一共展示了Expression.AndAlso方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public Expression<Func<Game, bool>> Execute(Expression<Func<Game, bool>> expression)
{
return expression.AndAlso(game => _platformTypes.Intersect(game.PlatformTypes.Select(pt => pt.PlatformTypeId)).Any());
}
示例2: Execute
public Expression<Func<Game, bool>> Execute(Expression<Func<Game, bool>> expression)
{
return expression.AndAlso(g => g.Price <= _to);
}
示例3: Execute
public Expression<Func<Game, bool>> Execute(Expression<Func<Game, bool>> expression)
{
DateTime filterTime = DateTime.UtcNow.AddDays(-_days);
return expression.AndAlso( g => g.PublicationDate >= filterTime );
}
示例4: Execute
public Expression<Func<Game, bool>> Execute(Expression<Func<Game, bool>> expression)
{
return expression.AndAlso(g => _genres.Intersect(g.Genres.Select(x => x.GenreId)).Any());
}
示例5: Execute
public Expression<Func<Game, bool>> Execute(Expression<Func<Game, bool>> expression)
{
return expression.AndAlso(g => g.Name.Contains(_name));
}
示例6: Execute
public Expression<Func<Game, bool>> Execute(Expression<Func<Game, bool>> expression)
{
return expression.AndAlso(game => _publishers.Any(p => p == game.Publisher.PublisherId));
}
示例7: CustomersSidesForm_Shown
private void CustomersSidesForm_Shown(object sender, EventArgs e)
{
MiniSplash_TF sp0 = new MiniSplash_TF(Resources.load4) {Text = @"Загрузка данных абонентов"};
sp0.WorkingFunction = () =>
{
sp0.StatusText = "Загрузка абонентов";
_cachedCustomers = _dataContexts.NumEquipmentEntities.Customers.Where(cust => cust.Visible.HasValue && cust.Visible.Value).ToList();
sp0.StatusText = "Загрузка адресов площадок";
_cachedCustomerSides = _dataContexts.AccEquipmentV2Entities.CustomerSides.ToList();
#region create where for phone numbers
ParameterExpression inputType = Expression.Parameter(typeof (Teleph));
var propertyCustomerId = Expression.Property(inputType, "Customer_Id");
var propertyUntilDate = Expression.Property(inputType, "UntilDate");
var propertyTelNum = Expression.Property(inputType, "TelNum");
var currWhere = Expression.Lambda<Func<Teleph, bool>>(
Expression.NotEqual(
propertyCustomerId,
Expression.Constant(null, typeof (string))), inputType);
_wherePhoneNumExpression = currWhere;
currWhere = Expression.Lambda<Func<Teleph, bool>>(
Expression.NotEqual(
propertyUntilDate,
Expression.Constant(null, typeof (DateTime?))), inputType);
_wherePhoneNumExpression = _wherePhoneNumExpression.AndAlso(currWhere);
var trimCustomerId = Expression.Call(propertyCustomerId, typeof (string).GetMethod("Trim", Type.EmptyTypes));
var notEmptyCustomerId = Expression.Not(Expression.Call(typeof (string), "IsNullOrEmpty", null, trimCustomerId));
currWhere = Expression.Lambda<Func<Teleph, bool>>(notEmptyCustomerId, inputType);
_wherePhoneNumExpression = _wherePhoneNumExpression.AndAlso(currWhere);
var trimPhoneNumber = Expression.Call(propertyTelNum, typeof (string).GetMethod("Trim", Type.EmptyTypes));
MethodInfo method = typeof (string).GetMethod("Contains", new[] {typeof (string)});
var constantNumberExpression = Expression.Property(Expression.Constant(this), "NumberTextData");
var containsPhoneNumber = Expression.Call(trimPhoneNumber, method, constantNumberExpression);
currWhere = Expression.Lambda<Func<Teleph, bool>>(containsPhoneNumber, inputType);
_wherePhoneNumExpression = _wherePhoneNumExpression.AndAlso(currWhere);
#endregion
_defaultOrder = cust => int.Parse(cust.Customer_id.Trim());
//Expression<Func<CustomerSide, Customer, bool>>
// currentSideFilter = (side, customer) =>
// String.Equals(side.CustomerId.ToString(), customer.Customer_id.Trim()) &
// side.Firmid == customer.FirmId;
};
sp0.ShowDialog(this);
Cursor = Cursors.WaitCursor;
//gvCustomers.DataSource = _cachedCustomers.Where(_compiledCurrentFirmFilter).OrderBy(_defaultOrder).ToList();
Cursor = Cursors.Default;
//if (FocusedCustomerInfo != null)
//{
// Firm custFirm = _cachedFirms.SingleOrDefault(firm => firm.FirmId == FocusedCustomerInfo.FirmId);
// if (custFirm == null)
// return;
// cbFirms.SelectedItem = custFirm;
// if (FilteredData)
// {
// gvCustomers.DataSource =
// _cachedCustomers.Where(_compiledCurrentFirmFilter)
// .Where(c => c.FirmId == FocusedCustomerInfo.FirmId & c.Customer_id.Trim() == FocusedCustomerInfo.CustomerId.ToString())
// .OrderBy(_defaultOrder)
// .ToList();
// gvCustomers.Rows[0].Selected = true;
// gvCustomers.BlinkRow(gvCustomers.Rows[0]);
// gvCustomers_SelectionChanged(gvCustomers, new EventArgs());
// }
// else
// {
// var selectedCustomerRow =
// gvCustomers.Rows.Cast<DataGridViewRow>()
// .SingleOrDefault(
// item =>
// {
// Customer checkCustomer = (Customer)item.DataBoundItem;
// return (Convert.ToInt32(checkCustomer.Customer_id.Trim()) == FocusedCustomerInfo.CustomerId) & (checkCustomer.FirmId == FocusedCustomerInfo.FirmId);
// });
// if (selectedCustomerRow != null)
// {
// gvCustomers.CurrentCell = gvCustomers.Rows[selectedCustomerRow.Index].Cells[0];
// selectedCustomerRow.Selected = true;
// gvCustomers.BlinkRow(selectedCustomerRow);
// }
// }
// if (FocusedSide != null)
// {
// var selectedCustomerSideRow =
// gvSides.Rows.Cast<DataGridViewRow>()
// .SingleOrDefault(
// item =>
// {
// CustomerSide checkSide = (CustomerSide)item.DataBoundItem;
// return checkSide.Id == FocusedSide.Id;
// });
// if (selectedCustomerSideRow != null)
// {
// gvSides.CurrentCell = gvSides.Rows[selectedCustomerSideRow.Index].Cells[0];
// selectedCustomerSideRow.Selected = true;
// gvSides.BlinkRow(selectedCustomerSideRow);
// }
// }
//}
}