本文整理汇总了C#中WhereCondition.WhereGreaterOrEquals方法的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition.WhereGreaterOrEquals方法的具体用法?C# WhereCondition.WhereGreaterOrEquals怎么用?C# WhereCondition.WhereGreaterOrEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhereCondition
的用法示例。
在下文中一共展示了WhereCondition.WhereGreaterOrEquals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWhereCondition
/// <summary>
/// Returns where condition based on webpart fields.
/// </summary>
private WhereCondition GetWhereCondition()
{
var where = new WhereCondition().WhereEquals("SKUSiteID", SiteContext.CurrentSiteID);
// Show products only from current site or global too, based on setting
if (ECommerceSettings.AllowGlobalProducts(SiteContext.CurrentSiteName))
{
where.Where(w => w.WhereEquals("SKUSiteID", SiteContext.CurrentSiteID).Or().WhereNull("SKUSiteID"));
}
// Show/hide product variants - it is based on type of inventory tracking for parent product
string trackByVariants = TrackInventoryTypeEnum.ByVariants.ToStringRepresentation();
where.Where(v => v.Where(w => w.WhereNull("SKUParentSKUID").And().WhereNotEquals("SKUTrackInventory", trackByVariants))
.Or()
.Where(GetParentProductWhereCondition(new WhereCondition().WhereEquals("SKUTrackInventory", trackByVariants))));
// Product type filter
if (!string.IsNullOrEmpty(ProductType) && (ProductType != FILTER_ALL))
{
if (ProductType == PRODUCT_TYPE_PRODUCTS)
{
where.WhereNull("SKUOptionCategoryID");
}
else if (ProductType == PRODUCT_TYPE_PRODUCT_OPTIONS)
{
where.WhereNotNull("SKUOptionCategoryID");
}
}
// Representing filter
if (!string.IsNullOrEmpty(Representing) && (Representing != FILTER_ALL))
{
SKUProductTypeEnum productTypeEnum = Representing.ToEnum<SKUProductTypeEnum>();
string productTypeString = productTypeEnum.ToStringRepresentation();
where.WhereEquals("SKUProductType", productTypeString);
}
// Product number filter
if (!string.IsNullOrEmpty(ProductNumber))
{
where.WhereContains("SKUNumber", ProductNumber);
}
// Department filter
DepartmentInfo di = DepartmentInfoProvider.GetDepartmentInfo(Department, CurrentSiteName);
di = di ?? DepartmentInfoProvider.GetDepartmentInfo(Department, null);
if (di != null)
{
where.Where(GetColumnWhereCondition("SKUDepartmentID", new WhereCondition().WhereEquals("SKUDepartmentID", di.DepartmentID)));
}
// Manufacturer filter
ManufacturerInfo mi = ManufacturerInfoProvider.GetManufacturerInfo(Manufacturer, CurrentSiteName);
mi = mi ?? ManufacturerInfoProvider.GetManufacturerInfo(Manufacturer, null);
if (mi != null)
{
where.Where(GetColumnWhereCondition("SKUManufacturerID", new WhereCondition().WhereEquals("SKUManufacturerID", mi.ManufacturerID)));
}
// Supplier filter
SupplierInfo si = SupplierInfoProvider.GetSupplierInfo(Supplier, CurrentSiteName);
si = si ?? SupplierInfoProvider.GetSupplierInfo(Supplier, null);
if (si != null)
{
where.Where(GetColumnWhereCondition("SKUSupplierID", new WhereCondition().WhereEquals("SKUSupplierID", si.SupplierID)));
}
// Needs shipping filter
if (!string.IsNullOrEmpty(NeedsShipping) && (NeedsShipping != FILTER_ALL))
{
if (NeedsShipping == NEEDS_SHIPPING_YES)
{
where.Where(GetColumnWhereCondition("SKUNeedsShipping", new WhereCondition().WhereTrue("SKUNeedsShipping")));
}
else if (NeedsShipping == NEEDS_SHIPPING_NO)
{
where.Where(GetColumnWhereCondition("SKUNeedsShipping", new WhereCondition().WhereFalse("SKUNeedsShipping").Or().WhereNull("SKUNeedsShipping")));
}
}
// Price from filter
if (PriceFrom > 0)
{
where.WhereGreaterOrEquals("SKUPrice", PriceFrom);
}
// Price to filter
if (PriceTo > 0)
{
where.WhereLessOrEquals("SKUPrice", PriceTo);
}
// Public status filter
PublicStatusInfo psi = PublicStatusInfoProvider.GetPublicStatusInfo(PublicStatus, CurrentSiteName);
if (psi != null)
//.........这里部分代码省略.........
示例2: GetFilterWhereCondition
/// <summary>
/// Builds a SQL condition for filtering the order list, and returns it.
/// </summary>
/// <returns>A SQL condition for filtering the order list.</returns>
private WhereCondition GetFilterWhereCondition()
{
var condition = new WhereCondition();
// Order status
if (statusSelector.SelectedID > 0)
{
condition.WhereEquals("OrderStatusID", statusSelector.SelectedID);
}
// Order site
if (FilterSiteID > 0)
{
condition.WhereEquals("OrderSiteID", FilterSiteID);
}
// Order identifier
string filterOrderId = txtOrderId.Text.Trim().Truncate(txtOrderId.MaxLength);
if (filterOrderId != String.Empty)
{
int orderId = ValidationHelper.GetInteger(filterOrderId, 0);
// Include also an invoice number
condition.Where(w => w.WhereEquals("OrderID", orderId).Or().WhereContains("OrderInvoiceNumber", filterOrderId));
}
// Customer's properties, applicable only if a valid customer is not specified
if (CustomerFilterEnabled)
{
// First, Last name and Company search
string customerNameOrCompany = txtCustomerNameOrCompany.Text.Trim().Truncate(txtCustomerNameOrCompany.MaxLength);
if (customerNameOrCompany != String.Empty)
{
condition.WhereIn("OrderCustomerID", new IDQuery<CustomerInfo>("CustomerID").WhereContains("CustomerFirstName", customerNameOrCompany)
.Or()
.WhereContains("CustomerLastName", customerNameOrCompany)
.Or()
.WhereContains("CustomerCompany", customerNameOrCompany));
}
}
// Order is paid
switch (drpOrderIsPaid.SelectedValue)
{
case "0":
condition.Where("ISNULL(OrderIsPaid, 0) = 0");
break;
case "1":
condition.Where("ISNULL(OrderIsPaid, 0) = 1");
break;
}
// Advanced Filter
if (AdvancedFilterEnabled)
{
// Specific currency was selected
if (CurrencySelector.SelectedID > 0)
{
condition.WhereEquals("OrderCurrencyID", CurrencySelector.SelectedID);
}
// Specific payment method was selected
if (PaymentSelector.SelectedID > 0)
{
condition.WhereEquals("OrderPaymentOptionID", PaymentSelector.SelectedID);
}
// Specific shipping option was selected
if (ShippingSelector.SelectedID > 0)
{
condition.WhereEquals("OrderShippingOptionID", ShippingSelector.SelectedID);
}
// Specific tracking number was provided
var trackingNumber = txtTrackingNumber.Text.Truncate(txtTrackingNumber.MaxLength);
if (trackingNumber != string.Empty)
{
condition.WhereContains("OrderTrackingNumber", trackingNumber);
}
// Specific created date was selected
if ((dtpCreatedTo.SelectedDateTime < dtpCreatedTo.MaxDate) && (dtpCreatedTo.SelectedDateTime > dtpCreatedTo.MinDate))
{
condition.WhereLessOrEquals("OrderDate", dtpCreatedTo.SelectedDateTime);
}
// Specific from date was selected
if ((dtpFrom.SelectedDateTime < dtpFrom.MaxDate) && (dtpFrom.SelectedDateTime > dtpFrom.MinDate))
{
condition.WhereGreaterOrEquals("OrderDate", dtpFrom.SelectedDateTime);
}
}
return condition;
}