當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。