本文整理汇总了C#中WhereCondition.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition.ToString方法的具体用法?C# WhereCondition.ToString怎么用?C# WhereCondition.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhereCondition
的用法示例。
在下文中一共展示了WhereCondition.ToString方法的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: 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");
}
示例3: 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}");
}
示例4: 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;
}
示例5: 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;
}
示例6: InitSelector
/// <summary>
/// Initializes the selector.
/// </summary>
public void InitSelector()
{
uniSelector.IsLiveSite = IsLiveSite;
// Set resource prefix if specified
if (ResourcePrefix != null)
{
uniSelector.ResourcePrefix = ResourcePrefix;
}
// Initialize selector for on-line marketing
if (ValidationHelper.GetString(GetValue("mode"), "").ToLowerCSafe() == "onlinemarketing")
{
UniSelector.SelectionMode = SelectionModeEnum.MultipleButton;
UniSelector.OnItemsSelected += UniSelector_OnItemsSelected;
UniSelector.ReturnColumnName = "CustomerID";
IsLiveSite = false;
SiteID = ValidationHelper.GetInteger(GetValue("SiteID"), 0);
UniSelector.ResourcePrefix = "om.customerselector";
}
var where = new WhereCondition();
// Add registered customers
if (DisplayRegisteredCustomers)
{
where.WhereIn("CustomerUserID", new IDQuery<UserSiteInfo>("UserID").WhereEquals("SiteID", SiteID));
}
// Add anonymous customers
if (DisplayAnonymousCustomers)
{
where.Or().Where(w => w.WhereEquals("CustomerSiteID", SiteID).And().WhereNull("CustomerUserID"));
}
where = new WhereCondition(where);
// Filter out only enabled items
if (DisplayOnlyEnabled)
{
where.WhereTrue("CustomerEnabled");
}
// Add items which have to be on the list
if (!string.IsNullOrEmpty(AdditionalItems))
{
where.Or().WhereIn("CustomerID", AdditionalItems.Split(','));
}
// Selected value must be on the list
if (CustomerID > 0)
{
where.Or().WhereEquals("CustomerID", CustomerID);
}
uniSelector.WhereCondition = where.ToString(true);
}
示例7: SetupSourceLanguageDropDownWhereCondition
/// <summary>
/// Setups source language drop down list control.
/// </summary>
/// <param name="targetCultures">List of target cultures which should not be in te source selector</param>
private void SetupSourceLanguageDropDownWhereCondition(HashSet<string> targetCultures)
{
var condition = new WhereCondition();
if (targetCultures.Count > 0)
{
condition.WhereNotIn("CultureCode", targetCultures.ToList());
}
if (NodeID > 0)
{
// Get source culture list from original node if current node is linked
var node = TreeProvider.SelectSingleNode(NodeID, TreeProvider.ALL_CULTURES, true, false);
var sourceNodeID = node.OriginalNodeID;
condition.WhereIn("CultureCode", new IDQuery("cms.document", "DocumentCulture").WhereEquals("DocumentNodeID", sourceNodeID));
}
selectCultureElem.AdditionalWhereCondition = condition.ToString(true);
}
示例8: GetRecycleBinSeletedItems
private DataSet GetRecycleBinSeletedItems(BinSettingsContainer settings, string columns)
{
var where = new WhereCondition();
switch (settings.CurrentWhat)
{
case What.AllObjects:
if (IsSingleSite)
{
where.WhereNull("VersionObjectSiteID");
}
if (settings.Site != null)
{
where.Or().WhereEquals("VersionObjectSiteID", settings.Site.SiteID);
}
// Wrap filter condition with brackets
where.Where(new WhereCondition(filter.WhereCondition) { WhereIsComplex = true });
where = GetWhereCondition(where);
break;
case What.SelectedObjects:
// Restore selected objects
var toRestore = settings.SelectedItems;
where.WhereIn("VersionID", toRestore);
break;
}
return ObjectVersionHistoryInfoProvider.GetRecycleBin(where.ToString(true), OrderBy, -1, columns);
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:30,代码来源:ObjectsRecycleBin.ascx.cs
示例9: GenerateWhereCondition
//.........这里部分代码省略.........
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);
}
// Filter only global objects
else if (SiteID == UniSelector.US_GLOBAL_RECORD)
{
whereCondition = whereCondition.WhereNull("ContactSiteID");
}
}
// Filter by site filter
else
{
// Only global objects
if (SelectedSiteID == UniSelector.US_GLOBAL_RECORD)
{
whereCondition = whereCondition.WhereNull("ContactSiteID");
}
// Global and site objects
else if (SelectedSiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD)
{
whereCondition = whereCondition.WhereEqualsOrNull("ContactSiteID", SiteContext.CurrentSiteID);
}
// Site objects
else if (SelectedSiteID != UniSelector.US_ALL_RECORDS)
{
whereCondition = whereCondition.WhereEquals("ContactSiteID", mSelectedSiteID);
}
}
}
return whereCondition.ToString(true);
}
示例10: LoadAvailableTables
protected void LoadAvailableTables()
{
var tm = new TableManager(null);
var where = new WhereCondition()
.WhereNotIn("TABLE_NAME", new ObjectQuery<DataClassInfo>().Column("ClassTableName").WhereNotNull("ClassTableName"))
.WhereNotIn("TABLE_NAME", new List<string> { "Analytics_Index", "sysdiagrams", "Temp_WebPart" });
drpExistingTables.DataSource = tm.GetTables(where.ToString());
drpExistingTables.DataBind();
}
示例11: InitWhereCondition
/// <summary>
/// Creates where condition for UniGrid and reloads it.
/// </summary>
private void InitWhereCondition()
{
var where = new WhereCondition().WhereEquals("ShippingOptionSiteID", SiteContext.CurrentSiteID);
UniGrid.WhereCondition = where.ToString(true);
}
示例12: ReloadData
/// <summary>
/// Reloads the data.
/// </summary>
/// <param name="forceReload">If true, the data is reloaded even when already loaded</param>
public void ReloadData(bool forceReload)
{
if (!dataLoaded || forceReload)
{
drpWebpart.Items.Clear();
if (DisplayNone)
{
drpWebpart.Items.Add(new ListItem(ResHelper.GetString("General.SelectNone"), ""));
}
// Do not retrieve webparts
WhereCondition condition = new WhereCondition(WhereCondition);
if (!ShowWebparts)
{
condition.WhereEquals("ObjectType", "webpartcategory");
}
if (!ShowInheritedWebparts)
{
condition.WhereNull("WebPartParentID");
}
if (!String.IsNullOrEmpty(RootPath))
{
string rootPath = RootPath.TrimEnd('/');
condition.Where(new WhereCondition().WhereEquals("ObjectPath", rootPath).Or().WhereStartsWith("ObjectPath", rootPath + "/"));
}
ds = WebPartCategoryInfoProvider.GetCategoriesAndWebparts(condition.ToString(true), "DisplayName", 0, "ObjectID, DisplayName, ParentID, ObjectType");
if (!DataHelper.DataSourceIsEmpty(ds))
{
int counter = 0;
// Make special collection for "tree mapping"
Dictionary<int, SortedList<string, object[]>> categories = new Dictionary<int, SortedList<string, object[]>>();
// Fill collection from dataset
foreach (DataRow dr in ds.Tables[0].Rows)
{
int parentId = ValidationHelper.GetInteger(dr["ParentID"], 0);
int id = ValidationHelper.GetInteger(dr["ObjectID"], 0);
string name = ResHelper.LocalizeString(ValidationHelper.GetString(dr["DisplayName"], String.Empty));
string type = ValidationHelper.GetString(dr["ObjectType"], String.Empty);
// Skip webpart, take only WebpartCategory
if (type == "webpart")
{
continue;
}
SortedList<string, object[]> list;
categories.TryGetValue(parentId, out list);
// Sub categories list not created yet
if (list == null)
{
list = new SortedList<string, object[]>();
categories.Add(parentId, list);
}
list.Add(name + "_" + counter, new object[] { id, name });
counter++;
}
// Start filling the dropdown from the root(parentId = 0)
int level = 0;
// Root is not shown, start indentation later
if (!ShowRoot)
{
level = -1;
}
AddSubCategories(categories, 0, level);
}
dataLoaded = true;
}
}
示例13: GenerateWhereCondition
/// <summary>
/// Generates where condition.
/// </summary>
private string GenerateWhereCondition()
{
// Get older than value
DateTime olderThan = DateTime.Now.Date.AddDays(1);
int dateTimeValue = ValidationHelper.GetInteger(txtFilter.Text, 0);
switch (drpFilter.SelectedIndex)
{
case 0:
olderThan = olderThan.AddDays(-dateTimeValue);
break;
case 1:
olderThan = olderThan.AddDays(-dateTimeValue * 7);
break;
case 2:
olderThan = olderThan.AddMonths(-dateTimeValue);
break;
case 3:
olderThan = olderThan.AddYears(-dateTimeValue);
break;
}
var where = new WhereCondition().WhereLessOrEquals(SOURCE_MODIFIEDWHEN, olderThan);
// Add where condition
if (!string.IsNullOrEmpty(txtDocumentName.Text))
{
AddOutdatedWhereCondition(where, SOURCE_DOCUMENTNAME, drpDocumentName, txtDocumentName);
}
if (!string.IsNullOrEmpty(txtDocumentType.Text))
{
AddOutdatedWhereCondition(where, SOURCE_CLASSDISPLAYNAME, drpDocumentType, txtDocumentType);
}
return where.ToString(true);
}
示例14: GetFilterWhereCondition
/// <summary>
/// Builds a SQL condition for filtering the discount list, and returns it.
/// </summary>
/// <returns>A SQL condition for filtering the discount list.</returns>
private string GetFilterWhereCondition()
{
string discountStatus = drpStatus.SelectedValue;
var condition = new WhereCondition();
/* Active discounts */
if (discountStatus == "0")
{
condition.Where(GetActiveQuery());
}
/* Disabled discounts */
else if (discountStatus == "1")
{
condition.WhereNot(GetEnabledDiscounts());
}
/* Finished discounts */
else if (discountStatus == "2")
{
condition.Where(GetEnabledDiscounts())
.WhereLessThan(GetColumn("DiscountValidTo"), DateTime.Now)
.WhereNot(GetIncompleteDiscounts())
.Or(GetDiscountsWithCouponsExceeded());
}
/* Scheduled discounts */
else if (discountStatus == "3")
{
condition.Where(GetEnabledDiscounts())
.WhereGreaterThan(GetColumn("DiscountValidFrom"), DateTime.Now)
.WhereNot(GetIncompleteDiscounts());
}
/* Incomplete discounts */
else if (discountStatus == "4")
{
condition.Where(GetEnabledDiscounts())
.Where(GetIncompleteDiscounts());
}
return condition.ToString(true);
}
示例15: btnOk_Click
/// <summary>
/// Mass action 'ok' button clicked.
/// </summary>
protected void btnOk_Click(object sender, EventArgs e)
{
CheckModifyPermissions();
Action action = (Action)ValidationHelper.GetInteger(drpAction.SelectedItem.Value, 0);
What what = (What)ValidationHelper.GetInteger(drpWhat.SelectedItem.Value, 0);
var where = new WhereCondition()
.WhereEquals("ContactGroupMemberContactGroupID", cgi.ContactGroupID)
// Set constraint for account relations only
.WhereEquals("ContactGroupMemberType", 1);
switch (what)
{
// All items
case What.All:
var accountIds = new ObjectQuery("om.contactgroupaccountlist")
.Column("AccountID")
.Where(gridElem.WhereCondition)
.Where(gridElem.WhereClause);
where.WhereIn("ContactGroupMemberRelatedID", accountIds);
break;
// Selected items
case What.Selected:
// Convert array to integer values to make sure no sql injection is possible (via string values)
where.WhereIn("ContactGroupMemberRelatedID", gridElem.SelectedItems);
break;
default:
return;
}
switch (action)
{
// Action 'Remove'
case Action.Remove:
// Delete the relations between contact group and accounts
ContactGroupMemberInfoProvider.DeleteContactGroupMembers(where.ToString(true), cgi.ContactGroupID, true, true);
// Show result message
if (what == What.Selected)
{
ShowConfirmation(GetString("om.account.massaction.removed"));
}
else
{
ShowConfirmation(GetString("om.account.massaction.removedall"));
}
break;
default:
return;
}
// Reload unigrid
gridElem.ResetSelection();
gridElem.ReloadData();
pnlUpdate.Update();
}