本文整理汇总了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;
}