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


C# Expression.AndAlso方法代码示例

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

示例2: Execute

 public Expression<Func<Game, bool>> Execute(Expression<Func<Game, bool>> expression)
 {
     return expression.AndAlso(g => g.Price <= _to);
 }
开发者ID:MaxShustov,项目名称:GameStore,代码行数:4,代码来源:ToPriceFilter.cs

示例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 );
 }
开发者ID:MaxShustov,项目名称:GameStore,代码行数:5,代码来源:DateFilter.cs

示例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());
 }
开发者ID:MaxShustov,项目名称:GameStore,代码行数:4,代码来源:GenreFilter.cs

示例5: Execute

 public Expression<Func<Game, bool>> Execute(Expression<Func<Game, bool>> expression)
 {
     return expression.AndAlso(g => g.Name.Contains(_name));
 }
开发者ID:MaxShustov,项目名称:GameStore,代码行数:4,代码来源:NameFilter.cs

示例6: Execute

 public Expression<Func<Game, bool>> Execute(Expression<Func<Game, bool>> expression)
 {
     return expression.AndAlso(game => _publishers.Any(p => p == game.Publisher.PublisherId));
 }
开发者ID:MaxShustov,项目名称:GameStore,代码行数:4,代码来源:PublisherFilter.cs

示例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);
            //        }
            //    }
            //}
        }
开发者ID:Winsor,项目名称:ITInfra,代码行数:99,代码来源:CustomersTelephSelectionForm.cs


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