本文整理汇总了C#中WhereCondition.WhereContains方法的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition.WhereContains方法的具体用法?C# WhereCondition.WhereContains怎么用?C# WhereCondition.WhereContains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhereCondition
的用法示例。
在下文中一共展示了WhereCondition.WhereContains方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: GetPhoneWhereCondition
private WhereCondition GetPhoneWhereCondition()
{
var phoneWhere = new WhereCondition();
if (!String.IsNullOrEmpty(CurrentAccount.AccountPhone))
{
phoneWhere.WhereContains("AccountPhone", CurrentAccount.AccountPhone);
}
if (!String.IsNullOrEmpty(CurrentAccount.AccountFax))
{
phoneWhere.Or().WhereContains("AccountFax", CurrentAccount.AccountFax);
}
return phoneWhere;
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:13,代码来源:FilterSuggest.ascx.cs
示例3: GetWhereCondition
/// <summary>
/// Merges given where condition with additional settings.
/// </summary>
/// <param name="where">Original where condition</param>
/// <returns>New where condition</returns>
private WhereCondition GetWhereCondition(WhereCondition where)
{
// Create version condition
var condition = new WhereCondition().WhereNotNull("VersionDeletedWhen");
// Add recycle bin condition (ensure correct parentheses wrapping)
condition.Where(where);
// Filter by object name
if (!string.IsNullOrEmpty(ObjectDisplayName))
{
condition.WhereContains("VersionObjectDisplayName", ObjectDisplayName);
}
// Filter by object type
if (!String.IsNullOrEmpty(ObjectType))
{
condition.WhereContains("VersionObjectType", ObjectType);
}
return condition;
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:27,代码来源:ObjectsRecycleBin.ascx.cs
示例4: AddOutdatedWhereCondition
/// <summary>
/// Gets where condition based on value of given controls.
/// </summary>
/// <param name="where">Where condition</param>
/// <param name="column">Column to compare</param>
/// <param name="drpOperator">List control with operator</param>
/// <param name="valueBox">Text control with value</param>
/// <returns>Where condition for outdated documents</returns>
private void AddOutdatedWhereCondition(WhereCondition where, string column, ListControl drpOperator, ITextControl valueBox)
{
var value = TextHelper.LimitLength(valueBox.Text, 100);
if (!String.IsNullOrEmpty(value))
{
string condition = drpOperator.SelectedValue;
// Create condition based on operator
switch (condition)
{
case WhereBuilder.LIKE:
where.WhereContains(column, value);
break;
case WhereBuilder.NOT_LIKE:
where.WhereNotContains(column, value);
break;
case WhereBuilder.EQUAL:
where.WhereEquals(column, value);
break;
case WhereBuilder.NOT_EQUAL:
where.WhereNotEquals(column, value);
break;
}
}
}
示例5: GetWhereCondition
private string GetWhereCondition()
{
var where = new WhereCondition();
// Display name/Code name
string displayName = txtClassDisplayName.Text.Trim();
if (!String.IsNullOrEmpty(displayName))
{
where
.Where(w =>
w.WhereContains("ClassDisplayName", displayName)
.Or()
.WhereContains("ClassName", displayName));
}
// Table name
string tableName = txtClassTableName.Text.Trim();
if (!String.IsNullOrEmpty(tableName))
{
where
.WhereContains("ClassTableName", tableName);
}
return where.ToString(true);
}
示例6: FilterData
/// <summary>
/// Creates filter condition and raise filter change event.
/// </summary>
private void FilterData()
{
WhereCondition where = new WhereCondition();
int paging = 0;
string order = string.Empty;
// Build where condition according to drop-downs settings
if (statusSelector.SelectedID > 0)
{
where.WhereEquals("SKUPublicStatusID", statusSelector.SelectedID);
}
if (manufacturerSelector.SelectedID > 0)
{
where.WhereEquals("SKUManufacturerID", manufacturerSelector.SelectedID);
}
if (chkStock.Checked)
{
where.Where(w => w.WhereNull("SKUTrackInventory")
.Or()
.WhereGreaterThan("SKUAvailableItems", 0)
.Or()
.WhereIn("SKUID", new IDQuery<SKUInfo>("SKUParentSKUID").WhereGreaterThan("SKUAvailableItems", 0)));
}
if (!string.IsNullOrEmpty(txtSearch.Text))
{
where.WhereContains("SKUName", txtSearch.Text);
}
// Process drpSort drop-down
if (ValidationHelper.GetInteger(drpPaging.SelectedValue, 0) > 0)
{
paging = ValidationHelper.GetInteger(drpPaging.SelectedValue, 0);
}
if (!string.IsNullOrEmpty(drpSort.SelectedValue))
{
order = drpSort.SelectedValue;
}
// Set where condition
WhereCondition = where.ToString(true);
if (paging > 0)
{
// Set paging
PageSize = paging;
}
if (!string.IsNullOrEmpty(order))
{
// Set sorting
OrderBy = GetOrderBy(order);
}
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:60,代码来源:ProductFilter.ascx.cs
示例7: GetWhereCondition
/// <summary>
/// Merges given where condition with additional settings.
/// </summary>
/// <param name="where">Original where condition</param>
/// <returns>New where condition</returns>
private string GetWhereCondition(string where)
{
// Add recycle bin condition
var condition = new WhereCondition(where)
.WhereNotNull("VersionDeletedWhen");
// Filter by object name
if (!string.IsNullOrEmpty(ObjectDisplayName))
{
condition.WhereContains("VersionObjectDisplayName", ObjectDisplayName);
}
// Filter by object type
if (!String.IsNullOrEmpty(ObjectType))
{
condition.WhereContains("VersionObjectType", ObjectType);
}
return condition.ToString(true);
}
示例8: 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;
}