本文整理汇总了C#中WhereCondition.WhereNotNull方法的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition.WhereNotNull方法的具体用法?C# WhereCondition.WhereNotNull怎么用?C# WhereCondition.WhereNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhereCondition
的用法示例。
在下文中一共展示了WhereCondition.WhereNotNull方法的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: GenerateWhereCondition
/// <summary>
/// Generates complete filter where condition.
/// </summary>
private string GenerateWhereCondition()
{
var whereCondition = new WhereCondition();
// Create WHERE condition for basic filter
int contactStatus = ValidationHelper.GetInteger(fltContactStatus.Value, -1);
if (fltContactStatus.Value == null)
{
whereCondition = whereCondition.WhereNull("ContactStatusID");
}
else if (contactStatus > 0)
{
whereCondition = whereCondition.WhereEquals("ContactStatusID", contactStatus);
}
whereCondition = whereCondition
.Where(fltFirstName.GetCondition())
.Where(fltLastName.GetCondition())
.Where(fltEmail.GetCondition());
// Only monitored contacts
if (radMonitored.SelectedIndex == 1)
{
whereCondition = whereCondition.WhereTrue("ContactMonitored");
}
// Only not monitored contacts
else if (radMonitored.SelectedIndex == 2)
{
whereCondition = whereCondition.WhereEqualsOrNull("ContactMonitored", 0);
}
// Only contacts that were replicated to SalesForce leads
if (radSalesForceLeadReplicationStatus.SelectedIndex == 1)
{
whereCondition = whereCondition.WhereNotNull("ContactSalesForceLeadID");
}
// Only contacts that were not replicated to SalesForce leads
else if (radSalesForceLeadReplicationStatus.SelectedIndex == 2)
{
whereCondition = whereCondition.WhereNull("ContactSalesForceLeadID");
}
// Create WHERE condition for advanced filter (id needed)
if (IsAdvancedMode)
{
whereCondition = whereCondition
.Where(fltMiddleName.GetCondition())
.Where(fltCity.GetCondition())
.Where(fltPhone.GetCondition())
.Where(fltCreated.GetCondition())
.Where(GetOwnerCondition(fltOwner))
.Where(GetCountryCondition(fltCountry))
.Where(GetStateCondition(fltState));
if (!String.IsNullOrEmpty(txtIP.Text))
{
var nestedIpQuery = IPInfoProvider.GetIps().WhereLike("IPAddress", SqlHelper.EscapeLikeText(SqlHelper.EscapeQuotes(txtIP.Text)));
whereCondition = whereCondition.WhereIn("ContactID", nestedIpQuery.Column("IPOriginalContactID")).Or().WhereIn("ContactID", nestedIpQuery.Column("IPActiveContactID"));
}
}
// When "merged/not merged" filter is hidden or in advanced mode display contacts according to filter or in basic mode don't display merged contacts
if ((HideMergedFilter && NotMerged) ||
(IsAdvancedMode && !HideMergedFilter && !chkMerged.Checked) ||
(!HideMergedFilter && !NotMerged && !IsAdvancedMode))
{
whereCondition = whereCondition
.Where(
new WhereCondition(
new WhereCondition()
.WhereNull("ContactMergedWithContactID")
.WhereGreaterOrEquals("ContactSiteID", 0)
)
.Or(
new WhereCondition()
.WhereNull("ContactGlobalContactID")
.WhereNull("ContactSiteID")
));
}
// Hide contacts merged into global contact when displaying list of available contacts for global contact
if (HideMergedIntoGlobal)
{
whereCondition = whereCondition.WhereNull("ContactGlobalContactID");
}
if (!DisableGeneratingSiteClause)
{
// Filter by site
if (!plcSite.Visible)
{
// Filter site objects
if (SiteID > 0)
{
whereCondition = whereCondition.WhereEquals("ContactSiteID", SiteID);
}
//.........这里部分代码省略.........