本文整理汇总了C#中WhereCondition类的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition类的具体用法?C# WhereCondition怎么用?C# WhereCondition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WhereCondition类属于命名空间,在下文中一共展示了WhereCondition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
mNewsletter = EditedObject as NewsletterInfo;
if (mNewsletter == null)
{
pnlAvailability.Visible = false;
return;
}
if (!mNewsletter.CheckPermissions(PermissionsEnum.Read, CurrentSiteName, CurrentUser))
{
RedirectToAccessDenied(mNewsletter.TypeInfo.ModuleName, "ManageTemplates");
}
if (!RequestHelper.IsPostBack())
{
LoadBindings();
}
// Show all issue templates from current site
var where = new WhereCondition()
.WhereEquals("TemplateType", EmailTemplateType.Issue)
.WhereEquals("TemplateSiteID", mNewsletter.NewsletterSiteID)
.WhereNotEquals("TemplateID", mNewsletter.NewsletterTemplateID);
usTemplates.WhereCondition = where.ToString(expand: true);
usTemplates.OnSelectionChanged += usTemplates_OnSelectionChanged;
}
示例2: GenerateWhereCondition
/// <summary>
/// Generates WHERE condition.
/// </summary>
private WhereCondition GenerateWhereCondition()
{
var where = new WhereCondition();
string name = txtName.Text;
if (String.IsNullOrEmpty(name))
{
return where;
}
// Get filter operator (LIKE, NOT LIKE, =, !=)
switch (filter.SelectedValue)
{
default:
where.Where(w => w.WhereContains("CategoryDisplayName", name).Or().WhereContains("CategoryLiveSiteDisplayName", name));
break;
case WhereBuilder.EQUAL:
where.Where(w => w.WhereEquals("CategoryDisplayName", name).Or().WhereEquals("CategoryLiveSiteDisplayName", name));
break;
case WhereBuilder.NOT_LIKE:
where.Where(w => w.WhereNotContains("CategoryDisplayName", name).Or().WhereNull("CategoryDisplayName"))
.And()
.Where(w => w.WhereNotContains("CategoryLiveSiteDisplayName", name).Or().WhereNull("CategoryLiveSiteDisplayName"));
break;
case WhereBuilder.NOT_EQUAL:
where.Where(w => w.WhereNotEquals("CategoryDisplayName", name).Or().WhereNull("CategoryDisplayName"))
.And()
.Where(w => w.WhereNotEquals("CategoryLiveSiteDisplayName", name).Or().WhereNull("CategoryLiveSiteDisplayName"));
break;
}
return where;
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
PageTitle.TitleText = GetString("newsletter_issue_subscribersclicks.title");
linkId = QueryHelper.GetInteger("linkid", 0);
if (linkId == 0)
{
RequestHelper.EndResponse();
}
LinkInfo link = LinkInfoProvider.GetLinkInfo(linkId);
EditedObject = link;
IssueInfo issue = IssueInfoProvider.GetIssueInfo(link.LinkIssueID);
EditedObject = issue;
// Prevent accessing issues from sites other than current site
if (issue.IssueSiteID != SiteContext.CurrentSiteID)
{
RedirectToResourceNotAvailableOnSite("Issue with ID " + link.LinkIssueID);
}
var where = new WhereCondition().Where("LinkID", QueryOperator.Equals, linkId);
// Link's issue is the main A/B test issue
if (issue.IssueIsABTest && !issue.IssueIsVariant)
{
// Get A/B test and its winner issue ID
ABTestInfo test = ABTestInfoProvider.GetABTestInfoForIssue(issue.IssueID);
if (test != null)
{
// Get ID of the same link from winner issue
var winnerLink = LinkInfoProvider.GetLinks()
.WhereEquals("LinkIssueID", test.TestWinnerIssueID)
.WhereEquals("LinkTarget", link.LinkTarget)
.WhereEquals("LinkDescription", link.LinkDescription)
.TopN(1)
.Column("LinkID")
.FirstOrDefault();
if (winnerLink != null)
{
if (winnerLink.LinkID > 0)
{
// Add link ID of winner issue link
where.Or(new WhereCondition().Where("LinkID", QueryOperator.Equals, winnerLink.LinkID));
}
}
}
}
where.And(new WhereCondition(fltOpenedBy.WhereCondition));
UniGrid.WhereCondition = where.WhereCondition;
UniGrid.QueryParameters = where.Parameters;
UniGrid.Pager.DefaultPageSize = PAGESIZE;
UniGrid.Pager.ShowPageSize = false;
UniGrid.FilterLimit = 1;
UniGrid.OnExternalDataBound += UniGrid_OnExternalDataBound;
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
PageTitle.TitleText = GetString("newsletter_issue_openedby.title");
var issue = (IssueInfo)EditedObject;
issueID = issue.IssueID;
// Do not show page if reports are not available
if (issue.IssueSentEmails <= 0)
{
ShowInformation(GetString("newsletter.issue.overviewnotsentyet"));
UniGrid.Visible = false;
fltOpenedBy.Visible = false;
return;
}
// Prevent accessing issues from sites other than current site
if (issue.IssueSiteID != SiteContext.CurrentSiteID)
{
RedirectToResourceNotAvailableOnSite("Issue with ID " + issueID);
}
// Issue is the main A/B test issue
isMainABTestIssue = issue.IssueIsABTest && !issue.IssueIsVariant;
if (isMainABTestIssue)
{
// Initialize variant selector in the filter
fltOpenedBy.IssueId = issue.IssueID;
if (RequestHelper.IsPostBack())
{
// Get issue ID from variant selector
issueID = fltOpenedBy.IssueId;
}
// Reset ID for main issue, grid will show data from main and winner variant issues
if (issueID == issue.IssueID)
{
issueID = 0;
}
}
var whereCondition = new WhereCondition(fltOpenedBy.WhereCondition);
if (issueID > 0)
{
whereCondition.And(w => w.WhereEquals("OpenedEmailIssueID", issueID));
}
UniGrid.WhereCondition = whereCondition.ToString(true);
UniGrid.Pager.DefaultPageSize = PAGESIZE;
UniGrid.Pager.ShowPageSize = false;
UniGrid.FilterLimit = 1;
UniGrid.OnExternalDataBound += UniGrid_OnExternalDataBound;
UniGrid.OnBeforeDataReload += UniGrid_OnBeforeDataReload;
UniGrid.ZeroRowsText = GetString("newsletter.issue.noopenmails");
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!CheckPermissions("cms.scoring", "Read"))
{
return;
}
var whereCondition = new WhereCondition(gridElem.WhereCondition)
.WhereEquals("ScoreSiteID", SiteContext.CurrentSiteID);
gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
gridElem.WhereCondition = whereCondition.ToString(true);
gridElem.ZeroRowsText = GetString("om.score.notfound");
gridElem.EditActionUrl = URLHelper.AppendQuery(UIContextHelper.GetElementUrl("CMS.Scoring", "ScoringProperties"), "displayTitle=0&objectid={0}");
}
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var whereCondition = new WhereCondition(gridElem.WhereCondition);
if (ContactID != null)
{
whereCondition.WhereEquals("ContactID", ContactID);
}
if (SiteID != null)
{
whereCondition.WhereEquals("ScoreSiteID", SiteID);
}
gridElem.WhereCondition = whereCondition.ToString(true);
gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
}
示例7: btnSearch_Click
/// <summary>
/// Applies filter on associated UniGrid control.
/// </summary>
protected void btnSearch_Click(object sender, EventArgs e)
{
string text = txtSearch.Text.Trim();
if (!string.IsNullOrEmpty(text))
{
WhereCondition = new WhereCondition()
.WhereContains("CompanyName", text)
.ToString(true);
}
else
{
WhereCondition = null;
}
//Raise OnFilterChange event
RaiseOnFilterChanged();
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
emailTemplateInfo = EditedObject as EmailTemplateInfo;
if (emailTemplateInfo == null)
{
pnlAvailability.Visible = false;
return;
}
// Initialize newsletter selector
var where = new WhereCondition()
.WhereEquals("NewsletterType", NewsletterType.TemplateBased)
.WhereEquals("NewsletterSiteID", SiteContext.CurrentSiteID)
.WhereNotEquals("NewsletterTemplateID", emailTemplateInfo.TemplateID);
usNewsletters.WhereCondition = where.ToString(expand: true);
if (!RequestHelper.IsPostBack())
{
LoadSiteBindings();
}
usNewsletters.OnSelectionChanged += usSites_OnSelectionChanged;
}
示例9: AddWhere
public Query AddWhere(WhereCondition condition, object thisObject, ValueObjectType thisObjectType, WhereComparision comparison, object thatObject, ValueObjectType thatObjectType)
{
return Where(new Where(condition, thisObject, thisObjectType, comparison, thatObject, thatObjectType), false);
}
示例10: Delete
/// <summary>
/// Deletes document(s).
/// </summary>
private void Delete(object parameter)
{
if (parameter == null || nodeIds.Count < 1)
{
return;
}
if (!LicenseHelper.LicenseVersionCheck(RequestContext.CurrentDomain, FeatureEnum.Blogs, ObjectActionEnum.Edit))
{
AddError(ResHelper.GetString("cmsdesk.blogdeletelicenselimitations", currentCulture));
return;
}
if (!LicenseHelper.LicenseVersionCheck(RequestContext.CurrentDomain, FeatureEnum.Documents, ObjectActionEnum.Edit))
{
AddError(ResHelper.GetString("cmsdesk.documentdeletelicenselimitations", currentCulture));
return;
}
int refreshId = 0;
TreeProvider tree = new TreeProvider(currentUser);
tree.AllowAsyncActions = false;
string[] parameters = ((string)parameter).Split(';');
bool allLevelsSelected = ValidationHelper.GetBoolean(parameters[3], false);
try
{
string siteName = parameters[1];
bool isMultipleDelete = ValidationHelper.GetBoolean(parameters[2], false);
// Prepare the where condition
string where = new WhereCondition().WhereIn("NodeID", nodeIds).ToString(true);
string columns = SqlHelper.MergeColumns(DocumentColumnLists.SELECTNODES_REQUIRED_COLUMNS, "NodeAliasPath, ClassName, DocumentCulture, NodeParentID");
bool combineWithDefaultCulture = false;
string cultureCode = parameters[0];
switch (parameters[4])
{
// Standard page deletion
case "documentoptions":
combineWithDefaultCulture = chkAllCultures.Checked;
cultureCode = combineWithDefaultCulture ? TreeProvider.ALL_CULTURES : parameters[0];
break;
// Root page deletion
case "rootoptions":
cultureCode = rblRoot.SelectedValue == "allpages" ? TreeProvider.ALL_CULTURES : parameters[0];
where = rblRoot.SelectedValue == "allculturepages" ? String.Empty : where;
break;
}
// Begin log
AddLog(ResHelper.GetString("ContentDelete.DeletingDocuments", currentCulture));
string orderBy = "NodeAliasPath DESC";
if (cultureCode == TreeProvider.ALL_CULTURES)
{
// Default culture has to be selected on last position
string defaultCulture = CultureHelper.GetDefaultCultureCode(siteName);
orderBy += ", CASE WHEN DocumentCulture = '" + SqlHelper.EscapeQuotes(defaultCulture) + "' THEN 1 ELSE 0 END";
}
// Get the documents
DataSet ds = tree.SelectNodes(siteName, "/%", cultureCode, combineWithDefaultCulture, null, where, orderBy, TreeProvider.ALL_LEVELS, false, 0, columns);
if (!DataHelper.DataSourceIsEmpty(ds))
{
string altPath = Convert.ToString(selAltPath.Value);
TreeNode altNode = null;
if (chkUseDeletedPath.Checked && !String.IsNullOrEmpty(altPath))
{
NodeSelectionParameters nsp = new NodeSelectionParameters();
nsp.AliasPath = altPath;
nsp.CultureCode = TreeProvider.ALL_CULTURES;
nsp.ClassNames = TreeProvider.ALL_CLASSNAMES;
nsp.CombineWithDefaultCulture = true;
nsp.SiteName = siteName;
nsp.MaxRelativeLevel = TreeProvider.ALL_LEVELS;
nsp.TopN = 1;
altNode = DocumentHelper.GetDocument(nsp, tree);
// Check whether user is authorized to use alternating document
if (altNode != null)
{
if (currentUser.IsAuthorizedPerDocument(altNode, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied)
{
throw new Exception(GetString("contentdelete.notallowedalternating"));
}
}
else
{
// Do not allow to delete a page with specified redirection URL which is not valid
throw new Exception(GetString("contentdelete.redirectionurlisnotvalid"));
}
//.........这里部分代码省略.........
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Register script files
ScriptHelper.RegisterCMS(this);
ScriptHelper.RegisterScriptFile(this, "~/CMSModules/Content/CMSDesk/Operation.js");
// Set current UI culture
currentCulture = CultureHelper.PreferredUICultureCode;
// Initialize current user
currentUser = MembershipContext.AuthenticatedUser;
// Initialize current site
currentSite = SiteContext.CurrentSite;
// Initialize events
ctlAsyncLog.OnFinished += ctlAsyncLog_OnFinished;
ctlAsyncLog.OnError += ctlAsyncLog_OnError;
ctlAsyncLog.OnCancel += ctlAsyncLog_OnCancel;
if (!RequestHelper.IsCallback())
{
DataSet allDocs = null;
TreeProvider tree = new TreeProvider(currentUser);
// Current Node ID to delete
string parentAliasPath = string.Empty;
if (Parameters != null)
{
parentAliasPath = ValidationHelper.GetString(Parameters["parentaliaspath"], string.Empty);
}
if (string.IsNullOrEmpty(parentAliasPath))
{
nodeIdsArr = QueryHelper.GetString("nodeid", string.Empty).Trim('|').Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string nodeId in nodeIdsArr)
{
int id = ValidationHelper.GetInteger(nodeId, 0);
if (id != 0)
{
nodeIds.Add(id);
}
}
}
else
{
var where = new WhereCondition(WhereCondition)
.WhereNotEquals("ClassName", SystemDocumentTypes.Root);
allDocs = tree.SelectNodes(currentSite.SiteName, parentAliasPath.TrimEnd(new[] { '/' }) + "/%",
TreeProvider.ALL_CULTURES, true, ClassID > 0 ? DataClassInfoProvider.GetClassName(ClassID) : TreeProvider.ALL_CLASSNAMES, where.ToString(true),
"DocumentName", TreeProvider.ALL_LEVELS, false, 0,
DocumentColumnLists.SELECTNODES_REQUIRED_COLUMNS + ",DocumentName,NodeParentID,NodeSiteID,NodeAliasPath,NodeSKUID");
if (!DataHelper.DataSourceIsEmpty(allDocs))
{
foreach (DataTable table in allDocs.Tables)
{
foreach (DataRow row in table.Rows)
{
nodeIds.Add(ValidationHelper.GetInteger(row["NodeID"], 0));
}
}
}
}
// Setup page title text and image
PageTitle.TitleText = GetString("Content.DeleteTitle");
EnsureDocumentBreadcrumbs(PageBreadcrumbs, action: PageTitle.TitleText);
// Register the dialog script
ScriptHelper.RegisterDialogScript(this);
ctlAsyncLog.TitleText = GetString("ContentDelete.DeletingDocuments");
// Set visibility of panels
pnlContent.Visible = true;
pnlLog.Visible = false;
bool isMultilingual = CultureSiteInfoProvider.IsSiteMultilingual(currentSite.SiteName);
if (!isMultilingual)
{
// Set all cultures checkbox
chkAllCultures.Checked = true;
pnlAllCultures.Visible = false;
}
if (nodeIds.Count > 0)
{
if (nodeIds.Count == 1)
{
// Single document deletion
int nodeId = ValidationHelper.GetInteger(nodeIds[0], 0);
TreeNode node = null;
if (string.IsNullOrEmpty(parentAliasPath))
{
// Get any culture if current not found
node = tree.SelectSingleNode(nodeId, CultureCode) ?? tree.SelectSingleNode(nodeId, TreeProvider.ALL_CULTURES);
}
else
{
if (allDocs != null)
{
DataRow dr = allDocs.Tables[0].Rows[0];
//.........这里部分代码省略.........
示例12: 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);
}
示例13: CheckDoublePageAssignment
/// <summary>
/// Checks if page is not already assigned.
/// </summary>
/// <param name="filledVariantPath">Variant path filled in form</param>
private void CheckDoublePageAssignment(string filledVariantPath)
{
string originalVariantPath = ValidationHelper.GetString(ABVariant.GetOriginalValue("ABVariantPath"), "");
//Check if variantPath is changed
if (originalVariantPath != filledVariantPath)
{
var condition = new WhereCondition()
.WhereEquals("ABVariantTestID", ABTest.ABTestID)
.WhereEquals("ABVariantPath", filledVariantPath);
if (ABVariant.ABVariantID > 0)
{
condition.Where("ABVariantID", QueryOperator.NotEquals, ABVariant.ABVariantID);
}
var variants = ABVariantInfoProvider.GetVariants().Where(condition).TopN(1);
if (variants.Any())
{
ShowError(GetString("abtesting.variantpath.alreadyassigned"));
form.StopProcessing = true;
}
}
}
示例14: GetParentProductWhereCondition
/// <summary>
/// Returns where condition based on parent product for variants.
/// </summary>
/// <param name="condition">Condition to restrict parent product.</param>
private WhereCondition GetParentProductWhereCondition(WhereCondition condition)
{
return new WhereCondition().WhereNotNull("SKUParentSKUID").And().WhereIn("SKUParentSKUID", new IDQuery<SKUInfo>("SKUID").Where(condition));
}
示例15: 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