本文整理汇总了C#中WhereCondition.NoResults方法的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition.NoResults方法的具体用法?C# WhereCondition.NoResults怎么用?C# WhereCondition.NoResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhereCondition
的用法示例。
在下文中一共展示了WhereCondition.NoResults方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: GetWhereCondition
/// <summary>
/// Creates where condition according to values selected in filter.
/// </summary>
public override string GetWhereCondition()
{
var where = new WhereCondition();
var oper = drpLanguage.SelectedValue.ToEnum<QueryOperator>();
var val = ValidationHelper.GetString(cultureElem.Value, null);
if (String.IsNullOrEmpty(val))
{
val = "##ANY##";
}
if (val != "##ANY##")
{
// Create base query
var tree = new TreeProvider();
var query = tree.SelectNodes()
.All()
.Column("NodeID");
switch (val)
{
case "##ALL##":
{
var cultureCount = SiteCultures.Tables[0].Rows.Count;
query.GroupBy("NodeID").Having(string.Format("(COUNT(NodeID) {0} {1})", oper.ToStringRepresentation(), cultureCount));
where.WhereIn("NodeID", query);
}
break;
default:
{
query.WhereEquals("DocumentCulture", val);
if (oper == QueryOperator.NotEquals)
{
where.WhereNotIn("NodeID", query);
}
else
{
where.WhereIn("NodeID", query);
}
}
break;
}
}
else if (oper == QueryOperator.NotEquals)
{
where.NoResults();
}
return where.ToString(true);
}
示例3: AppendExclusiveWhere
/// <summary>
/// Exclude main currency and currencies without exchange rate according selector settings.
/// </summary>
/// <param name="whereCondition">Where condition.</param>
protected override string AppendExclusiveWhere(string whereCondition)
{
// Prepare where condition
var where = new WhereCondition(whereCondition);
if (DisplayOnlyWithExchangeRate)
{
var tableInfo = ExchangeTableInfoProvider.GetLastExchangeTableInfo(SiteID);
if (tableInfo != null)
{
where.Where(w => w.WhereEquals("CurrencyID", MainCurrencyID)
.Or()
.WhereIn("CurrencyID", new IDQuery(ExchangeRateInfo.OBJECT_TYPE, "ExchangeRateToCurrencyID")
.WhereEquals("ExchangeTableID", tableInfo.ExchangeTableID)
.WhereTrue("CurrencyEnabled")));
}
else
{
where.NoResults();
}
}
// Exclude site main currency when required
if (ExcludeSiteDefaultCurrency && (MainCurrencyID > 0))
{
where.WhereNotEquals("CurrencyID", MainCurrencyID);
}
// Restrict disabled or site not related currencies
return base.AppendExclusiveWhere(where.ToString(true));
}
示例4: GetFilterWhereCondition
/// <summary>
/// Builds a SQL condition for filtering the variant list, and returns it.
/// </summary>
/// <returns>A SQL condition for filtering the variant list.</returns>
private WhereCondition GetFilterWhereCondition()
{
var condition = new WhereCondition();
bool allChecked = AllCheckboxesChecked();
string variantNameOrNumber = txtVariantNameNumber.Text;
// If there are no options/categories in filter or all options are selected and Name-or-Number search box is empty, empty condition is returned
if (((optionToCheckBoxMap.Keys.Count == 0) || allChecked) && (string.IsNullOrEmpty(variantNameOrNumber)))
{
return condition;
}
foreach (KeyValuePair<int, List<int>> pair in SelectedOptionIDs)
{
// Option ids for current category (pair.Key = current category id)
List<int> optionIds = pair.Value;
// If there are no selected options in category, whole category is ignored
if (optionIds.Count > 0)
{
// Where condition for selected options from current category
condition.WhereIn("SKUID", new IDQuery<VariantOptionInfo>("VariantSKUID").WhereIn("OptionSKUID", optionIds));
}
}
// Variants with SKUName or Number like text in textbox field
if (!string.IsNullOrEmpty(variantNameOrNumber))
{
condition.Where(w => w.WhereContains("SKUNumber", variantNameOrNumber).Or().WhereContains("SKUName", variantNameOrNumber));
}
// Condition is empty -> not a single option is checked -> grid will be empty
if (condition.WhereCondition == null)
{
condition.NoResults();
}
return condition;
}
示例5: GetDisplayedLibrariesCondition
/// <summary>
/// Returns WHERE condition when libraries are being displayed. Sets also group identifier if specified
/// </summary>
private string GetDisplayedLibrariesCondition()
{
AvailableLibrariesEnum availableLibrariesEnum;
string libraryName = String.Empty;
// Get correct libraries
if (SelectedGroupID != 0)
{
availableLibrariesEnum = GroupLibraries;
if (groupsSelector != null)
{
// Get currently selected group ID
int groupId = ValidationHelper.GetInteger(groupsSelector.GetValue("GroupID"), 0);
if (groupId > 0)
{
librarySelector.GroupID = groupId;
libraryName = GroupLibraryName;
}
}
}
else
{
availableLibrariesEnum = GlobalLibraries;
libraryName = GlobalLibraryName;
}
var condition = new WhereCondition();
switch (availableLibrariesEnum)
{
case AvailableLibrariesEnum.OnlySingleLibrary:
librarySelector.SiteID = SiteID;
return condition.WhereEquals("LibraryName", libraryName).ToString(true);
case AvailableLibrariesEnum.OnlyCurrentLibrary:
int libraryId = (MediaLibraryContext.CurrentMediaLibrary != null) ? MediaLibraryContext.CurrentMediaLibrary.LibraryID : 0;
return condition.WhereEquals("LibraryID", libraryId).ToString(true);
case AvailableLibrariesEnum.None:
return condition.NoResults().ToString(true);
default:
librarySelector.SiteID = SiteID;
return String.Empty;
}
}