本文整理汇总了C#中WhereCondition.WhereEqualsOrNull方法的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition.WhereEqualsOrNull方法的具体用法?C# WhereCondition.WhereEqualsOrNull怎么用?C# WhereCondition.WhereEqualsOrNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhereCondition
的用法示例。
在下文中一共展示了WhereCondition.WhereEqualsOrNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWhereCondition
//.........这里部分代码省略.........
// 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)
{
where.Where(GetColumnWhereCondition("SKUPublicStatusID", new WhereCondition().WhereEquals("SKUPublicStatusID", psi.PublicStatusID)));
}
// Internal status filter
InternalStatusInfo isi = InternalStatusInfoProvider.GetInternalStatusInfo(InternalStatus, CurrentSiteName);
if (isi != null)
{
where.Where(GetColumnWhereCondition("SKUInternalStatusID", new WhereCondition().WhereEquals("SKUInternalStatusID", isi.InternalStatusID)));
}
// Allow for sale filter
if (!string.IsNullOrEmpty(AllowForSale) && (AllowForSale != FILTER_ALL))
{
if (AllowForSale == ALLOW_FOR_SALE_YES)
{
where.WhereTrue("SKUEnabled");
}
else if (AllowForSale == ALLOW_FOR_SALE_NO)
{
where.WhereEqualsOrNull("SKUEnabled", false);
}
}
// Available items filter
if (!string.IsNullOrEmpty(AvailableItems))
{
int value = ValidationHelper.GetInteger(AvailableItems, int.MaxValue);
where.WhereLessOrEquals("SKUAvailableItems", value);
}
// Needs to be reordered filter
if (NeedsToBeReordered)
{
where.Where(w => w.Where(v => v.WhereNull("SKUReorderAt").And().WhereLessOrEquals("SKUAvailableItems", 0))
.Or()
.Where(z => z.WhereNotNull("SKUReorderAt").And().WhereLessOrEquals("SKUAvailableItems".AsColumn(), "SKUReorderAt".AsColumn())));
}
return where;
}
示例2: ReloadData
/// <summary>
/// Reloads control.
/// </summary>
public void ReloadData()
{
var where = new WhereCondition(WhereCondition);
var siteName = SiteID > 0 ? SiteInfoProvider.GetSiteName(SiteID) : SiteContext.CurrentSiteName;
var allowGlobal = SettingsKeyInfoProvider.GetBoolValue(siteName + ".cmscmglobalconfiguration");
uniselector.AllowAll = AllowAllItem;
if (DisplayAll || DisplaySiteOrGlobal)
{
// Display all site and global statuses
if (DisplayAll && allowGlobal)
{
// No WHERE condition required
}
// Display current site and global statuses
else if (DisplaySiteOrGlobal && allowGlobal && (SiteID > 0))
{
where.WhereEqualsOrNull("AccountStatusSiteID", SiteID);
}
// Current site
else if (SiteID > 0)
{
where.WhereEquals("AccountStatusSiteID", SiteID);
}
// Display global statuses
else if (allowGlobal)
{
where.WhereNull("AccountStatusSiteID");
}
// Don't display anything
if (String.IsNullOrEmpty(where.WhereCondition) && !DisplayAll)
{
where.NoResults();
}
}
// Display either global or current site statuses
else
{
// Current site
if (SiteID > 0)
{
where.WhereEquals("AccountStatusSiteID", SiteID);
}
// Display global statuses
else if (((SiteID == UniSelector.US_GLOBAL_RECORD) || (SiteID == UniSelector.US_NONE_RECORD)) && allowGlobal)
{
where.WhereNull("AccountStatusSiteID");
}
// Don't display anything
if (String.IsNullOrEmpty(where.WhereCondition))
{
where.NoResults();
}
}
// Do not add condition to empty condition which allows everything
if (!String.IsNullOrEmpty(where.WhereCondition))
{
string status = ValidationHelper.GetString(Value, "");
if (!String.IsNullOrEmpty(status))
{
where.Or().WhereEquals(uniselector.ReturnColumnName, status);
}
}
uniselector.WhereCondition = where.ToString(expand: true);
uniselector.Reload(true);
}
示例3: 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);
}
//.........这里部分代码省略.........
示例4: Page_Load
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
protected void Page_Load(object sender, EventArgs e)
{
gridElem.EditActionUrl = "Edit.aspx?variantid={0}&nodeid=" + NodeID;
gridElem.ZeroRowsText = GetString("contentvariant.nodata");
// Grid initialization
gridElem.OnAction += new OnActionEventHandler(gridElem_OnAction);
// If not set, get the page template id for the current node and its document template
if ((PageTemplateID <= 0) && (Node != null))
{
PageTemplateID = Node.GetUsedPageTemplateId();
}
// Build where condition
var where = new WhereCondition().WhereEquals("VariantPageTemplateID", PageTemplateID);
// Display only variants for the current document
if (Node != null)
{
where.WhereEqualsOrNull("VariantDocumentID", Node.DocumentID);
}
// Display variants just for a specific zone/webpart/widget
if (!string.IsNullOrEmpty(ZoneID))
{
where.WhereEquals("VariantZoneID", ZoneID);
if (InstanceGUID != Guid.Empty)
{
// Web part/widget condition
where.WhereEquals("VariantInstanceGUID", InstanceGUID );
}
}
gridElem.WhereCondition = where.ToString(expand: true);
}