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


C# WhereCondition.WhereNotEmpty方法代码示例

本文整理汇总了C#中WhereCondition.WhereNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition.WhereNotEmpty方法的具体用法?C# WhereCondition.WhereNotEmpty怎么用?C# WhereCondition.WhereNotEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WhereCondition的用法示例。


在下文中一共展示了WhereCondition.WhereNotEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetWhereCondition

    /// <summary>
    /// Returns where condition based on webpart fields.
    /// </summary>
    private WhereCondition GetWhereCondition()
    {
        // Orders from current site
        var where = new WhereCondition()
            .WhereEquals("OrderSiteID", SiteContext.CurrentSiteID);

        // Order status filter
        var status = OrderStatusInfoProvider.GetOrderStatusInfo(OrderStatus, SiteContext.CurrentSiteName);
        if (status != null)
        {
            where.WhereEquals("OrderStatusID", status.StatusID);
        }

        // Customer or company like filter
        if (!string.IsNullOrEmpty(CustomerOrCompany))
        {
            where.WhereIn("OrderCustomerID", new IDQuery<CustomerInfo>()
                .Where("CustomerFirstName + ' ' + CustomerLastName + ' ' + CustomerFirstName LIKE N'%"+ SqlHelper.EscapeLikeText(SqlHelper.EscapeQuotes(CustomerOrCompany)) + "%'")
                .Or()
                .WhereContains("CustomerCompany", CustomerOrCompany));
        }

        // Filter for orders with note
        if (HasNote)
        {
            where.WhereNotEmpty("OrderNote");
        }

        // Payment method filter
        var payment = PaymentOptionInfoProvider.GetPaymentOptionInfo(PaymentMethod, SiteContext.CurrentSiteName);
        if (payment != null)
        {
            where.WhereEquals("OrderPaymentOptionID", payment.PaymentOptionID);
        }

        // Payment status filter
        switch (PaymentStatus.ToLowerCSafe())
        {
            case PAY_STATUS_NOT_PAID:
                where.Where(new WhereCondition().WhereFalse("OrderIsPaid").Or().WhereNull("OrderIsPaid"));
                break;

            case PAY_STATUS_PAID:
                where.WhereTrue("OrderIsPaid");
                break;
        }

        // Currency filter
        var currencyObj = CurrencyInfoProvider.GetCurrencyInfo(Currency, SiteContext.CurrentSiteName);
        if (currencyObj != null)
        {
            where.WhereEquals("OrderCurrencyID", currencyObj.CurrencyID);
        }

        // Min price in main currency filter
        if (MinPriceInMainCurrency > 0)
        {
            where.Where("OrderTotalPriceInMainCurrency", QueryOperator.LargerOrEquals, MinPriceInMainCurrency);
        }

        // Max price in main currency filter
        if (MaxPriceInMainCurrency > 0)
        {
            where.Where("OrderTotalPriceInMainCurrency", QueryOperator.LessOrEquals, MaxPriceInMainCurrency);
        }

        // Shipping option filter
        var shipping = ShippingOptionInfoProvider.GetShippingOptionInfo(ShippingOption, SiteContext.CurrentSiteName);
        if (shipping != null)
        {
            where.WhereEquals("OrderShippingOptionID", shipping.ShippingOptionID);
        }

        // Shipping country filter
        if (!string.IsNullOrEmpty(ShippingCountry) && ShippingCountry != "0")
        {
            AddCountryWhereCondition(where);
        }

        // Date filter
        AddDateWhereCondition(where);

        return where;
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:87,代码来源:Orders.ascx.cs


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