本文整理汇总了C#中WhereCondition.WhereEquals方法的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition.WhereEquals方法的具体用法?C# WhereCondition.WhereEquals怎么用?C# WhereCondition.WhereEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhereCondition
的用法示例。
在下文中一共展示了WhereCondition.WhereEquals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: GetWhereCondition
/// <summary>
/// Get where condition for unigrid
/// </summary>
/// <returns>Where condition</returns>
private WhereCondition GetWhereCondition()
{
string productNameFilter = txtProductName.Text;
string productCodeFilter = txtProductCode.Text;
// To display ONLY product - not product options
var where = new WhereCondition().WhereTrue("SKUEnabled").And().WhereNull("SKUOptionCategoryID");
if (!string.IsNullOrEmpty(productNameFilter))
{
// Condition to get also products with variants that contains
where.Where(w => w.WhereContains("SKUName", productNameFilter)
.Or()
.WhereIn("SKUID", new IDQuery<SKUInfo>("SKUParentSKUID").WhereContains("SKUName", productNameFilter)));
}
if (productCodeFilter != "")
{
// Condition to get also products with variants that contains
where.Where(w => w.WhereContains("SKUNumber", productNameFilter).Or().WhereIn("SKUID", new IDQuery<SKUInfo>("SKUParentSKUID").WhereContains("SKUNumber", productNameFilter)));
}
if (departmentElem.SelectedID > 0)
{
where.WhereEquals("SKUDepartmentID", departmentElem.SelectedID);
}
where.Where(SKUInfoProvider.ProviderObject.AddSiteWhereCondition(string.Empty, SiteContext.CurrentSiteID, ECommerceSettings.ALLOW_GLOBAL_PRODUCTS, true));
return where;
}
示例3: GetSiteCondition
/// <summary>
/// Returns site condition for given site id.
/// </summary>
/// <param name="siteID">Site id</param>
private static WhereCondition GetSiteCondition(int siteID)
{
var condition = new WhereCondition();
switch (siteID)
{
case UniSelector.US_GLOBAL_RECORD:
condition.WhereNull("StateSiteID");
break;
case UniSelector.US_ALL_RECORDS:
case UniSelector.US_NONE_RECORD:
break;
default:
condition.WhereEquals("StateSiteID", siteID);
break;
}
return condition;
}
示例4: 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);
}
示例5: GetWhereCondition
/// <summary>
/// Returns where condition.
/// </summary>
/// <param name="customWhere">Custom WHERE condition</param>
private WhereCondition GetWhereCondition(string customWhere)
{
SiteInfo si;
var where = new WhereCondition();
// Get required site data
if (!String.IsNullOrEmpty(SiteName))
{
si = SiteInfoProvider.GetSiteInfo(SiteName);
}
else
{
si = SiteContext.CurrentSite;
}
if (si != null)
{
// Build where condition
var classWhere = new WhereCondition();
// Get documents of the specified class only - without coupled data !!!
if (!String.IsNullOrEmpty(ClassNames))
{
string[] classNames = ClassNames.Trim(';').Split(';');
foreach (string className in classNames)
{
classWhere.WhereEquals("ClassName", className).Or();
}
}
where.WhereIn("NodeSKUID", new IDQuery<OrderItemInfo>("OrderItemSKUID").Source(s => s.Join<SKUInfo>("OrderItemSKUID", "SKUID")
.Join<OrderInfo>("COM_OrderItem.OrderItemOrderID", "OrderID"))
.WhereTrue("SKUEnabled")
.WhereNull("SKUOptionCategoryID")
.WhereEquals("OrderSiteID", si.SiteID)
.Where(classWhere));
// Add custom WHERE condition
if (!String.IsNullOrEmpty(customWhere))
{
where.Where(customWhere);
}
}
return where;
}
示例6: AddOutdatedWhereCondition
/// <summary>
/// Gets where condition based on value of given controls.
/// </summary>
/// <param name="where">Where condition</param>
/// <param name="column">Column to compare</param>
/// <param name="drpOperator">List control with operator</param>
/// <param name="valueBox">Text control with value</param>
/// <returns>Where condition for outdated documents</returns>
private void AddOutdatedWhereCondition(WhereCondition where, string column, ListControl drpOperator, ITextControl valueBox)
{
var value = TextHelper.LimitLength(valueBox.Text, 100);
if (!String.IsNullOrEmpty(value))
{
string condition = drpOperator.SelectedValue;
// Create condition based on operator
switch (condition)
{
case WhereBuilder.LIKE:
where.WhereContains(column, value);
break;
case WhereBuilder.NOT_LIKE:
where.WhereNotContains(column, value);
break;
case WhereBuilder.EQUAL:
where.WhereEquals(column, value);
break;
case WhereBuilder.NOT_EQUAL:
where.WhereNotEquals(column, value);
break;
}
}
}
示例7: Page_Load
/// <summary>
/// PageLoad event handler.
/// </summary>
protected void Page_Load(object sender, EventArgs e)
{
// Object type cannot be defined in xml definition -> it would ignore code behind configuration
UniGridRelationship.ObjectType = (IsAdHocRelationship) ? RelationshipInfo.OBJECT_TYPE_ADHOC : RelationshipInfo.OBJECT_TYPE;
if (StopProcessing)
{
UniGridRelationship.StopProcessing = StopProcessing;
return;
}
// Set tree node from Form object
if ((TreeNode == null) && (Form != null) && (Form.EditedObject != null))
{
var node = Form.EditedObject as TreeNode;
if ((node != null) && (Form.Mode == FormModeEnum.Update))
{
TreeNode = node;
}
else
{
ShowInformation(GetString("relationship.editdocumenterror"));
}
}
if (TreeNode != null)
{
InitUniGrid();
int nodeId = TreeNode.NodeID;
// Add relationship name condition
var condition = new WhereCondition().WhereIn("RelationshipNameID", new IDQuery<RelationshipNameInfo>().Where(GetRelationshipNameCondition()));
// Switch sides is disabled
if (!AllowSwitchSides)
{
condition.WhereEquals(DefaultSide ? "RightNodeID" : "LeftNodeID", nodeId);
}
else
{
condition.Where(new WhereCondition().WhereEquals("RightNodeID", nodeId).Or().WhereEquals("LeftNodeID", nodeId));
}
InitFilterVisibility();
UniGridRelationship.WhereCondition = condition.ToString(true);
if (ShowAddRelation)
{
btnNewRelationship.OnClientClick = GetAddRelatedDocumentScript() + " return false;";
}
else
{
pnlNewLink.Visible = false;
}
}
else
{
UniGridRelationship.StopProcessing = true;
UniGridRelationship.Visible = false;
btnNewRelationship.Enabled = false;
}
if (RequestHelper.IsPostBack())
{
string target = Request[Page.postEventSourceID];
if ((target != pnlUpdate.ClientID) && (target != pnlUpdate.UniqueID))
{
return;
}
string action = Request[Page.postEventArgumentID];
if (string.IsNullOrEmpty(action))
{
return;
}
switch (action.ToLowerCSafe())
{
// Insert from 'Select document' dialog
case "insertfromselectdocument":
SaveRelationship();
break;
}
}
else
{
bool inserted = QueryHelper.GetBoolean("inserted", false);
if (inserted)
{
ShowConfirmation(GetString("relationship.wasadded"));
}
}
}
示例8: GetCompleteWhereCondition
/// <summary>
/// Returns complete WHERE condition.
/// </summary>
protected WhereCondition GetCompleteWhereCondition()
{
string allRecords = UniSelector.US_ALL_RECORDS.ToString();
string customWhere = ValidationHelper.GetString(GetValue("WhereCondition"), "");
var where = new WhereCondition();
// Do not select product options and select only enabled products
where.WhereNull("SKUOptionCategoryID").And().WhereTrue("SKUEnabled");
// Get products only with specified public status
if (ProductPublicStatusName != allRecords)
{
int pStatusSiteID = ECommerceSettings.UseGlobalPublicStatus(SiteName) ? 0 : SiteInfoProvider.GetSiteID(SiteName);
where.WhereEquals("SKUPublicStatusID", new IDQuery<PublicStatusInfo>("PublicStatusID").Where("ISNULL(PublicStatusSiteID, 0) = " + pStatusSiteID).And().WhereEquals("PublicStatusName", ProductPublicStatusName).TopN(1));
}
// Get products only with specified internal status
if (ProductInternalStatusName != allRecords)
{
int iStatusSiteID = ECommerceSettings.UseGlobalInternalStatus(SiteName) ? 0 : SiteInfoProvider.GetSiteID(SiteName);
where.WhereEquals("SKUInternalStatusID", new IDQuery<InternalStatusInfo>("InternalStatusID").Where("ISNULL(InternalStatusSiteID, 0) = " + iStatusSiteID).And().WhereEquals("InternalStatusName", ProductInternalStatusName).TopN(1));
}
// Get products only from specified department
if (!string.IsNullOrEmpty(ProductDepartmentName) && (ProductDepartmentName != allRecords))
{
DepartmentInfo dept = DepartmentInfoProvider.GetDepartmentInfo(ProductDepartmentName, SiteName);
int departmentID = (dept != null) ? dept.DepartmentID : 0;
where.WhereEquals("SKUDepartmentID", departmentID);
}
// Include user custom WHERE condition
if (customWhere.Trim() != "")
{
where.Where(customWhere);
}
return where;
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:44,代码来源:RandomProducts.ascx.cs
示例9: FilterData
/// <summary>
/// Creates filter condition and raise filter change event.
/// </summary>
private void FilterData()
{
WhereCondition where = new WhereCondition();
int paging = 0;
string order = string.Empty;
// Build where condition according to drop-downs settings
if (statusSelector.SelectedID > 0)
{
where.WhereEquals("SKUPublicStatusID", statusSelector.SelectedID);
}
if (manufacturerSelector.SelectedID > 0)
{
where.WhereEquals("SKUManufacturerID", manufacturerSelector.SelectedID);
}
if (chkStock.Checked)
{
where.Where(w => w.WhereNull("SKUTrackInventory")
.Or()
.WhereGreaterThan("SKUAvailableItems", 0)
.Or()
.WhereIn("SKUID", new IDQuery<SKUInfo>("SKUParentSKUID").WhereGreaterThan("SKUAvailableItems", 0)));
}
if (!string.IsNullOrEmpty(txtSearch.Text))
{
where.WhereContains("SKUName", txtSearch.Text);
}
// Process drpSort drop-down
if (ValidationHelper.GetInteger(drpPaging.SelectedValue, 0) > 0)
{
paging = ValidationHelper.GetInteger(drpPaging.SelectedValue, 0);
}
if (!string.IsNullOrEmpty(drpSort.SelectedValue))
{
order = drpSort.SelectedValue;
}
// Set where condition
WhereCondition = where.ToString(true);
if (paging > 0)
{
// Set paging
PageSize = paging;
}
if (!string.IsNullOrEmpty(order))
{
// Set sorting
OrderBy = GetOrderBy(order);
}
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:60,代码来源:ProductFilter.ascx.cs
示例10: GetNodes
/// <summary>
/// Gets all child nodes in the specified parent path.
/// </summary>
/// <param name="searchText">Text to filter searched nodes</param>
/// <param name="parentAliasPath">Alias path of the parent</param>
/// <param name="siteName">Name of the related site</param>
/// <param name="totalRecords">Total records</param>
private DataSet GetNodes(string searchText, string parentAliasPath, string siteName, out int totalRecords)
{
// Create WHERE condition
var where = new WhereCondition()
.WhereNotEquals("NodeAliasPath", "/");
bool searchEnabled = !string.IsNullOrEmpty(searchText);
if (searchEnabled)
{
var searchWhere = new WhereCondition().WhereContains("DocumentName", searchText)
.Or().WhereContains("DocumentType", searchText);
where = where.Where(searchWhere);
}
// If not all content is selectable and no additional content being displayed
if ((SelectableContent != SelectableContentEnum.AllContent) && !IsFullListingMode)
{
where = where.WhereEquals("ClassName", SystemDocumentTypes.File);
}
var childClassNames = DocumentHelper.GetDocuments()
.Path(parentAliasPath, PathTypeEnum.Children)
.Column("ClassName")
.OnSite(siteName)
.NestingLevel(1)
.Distinct();
var classNames = String.Join(";", childClassNames.Select(name => name.ClassName));
// Get nodes with coupled data to be able to recover presentation URL in case coupled data macro is used in URL pattern
var query = DocumentHelper.GetDocuments()
.Published(IsLiveSite)
.WithCoupledColumns()
.Types(classNames)
.PublishedVersion(IsLiveSite)
.OnSite(siteName)
.Path(parentAliasPath, PathTypeEnum.Children)
.Culture(Config.Culture)
.CombineWithDefaultCulture()
.Where(where)
.OrderBy(mediaView.ListViewControl.SortDirect)
.NestingLevel(1)
.CheckPermissions();
if (!searchEnabled)
{
// Don't use paged query for searching (works only for first page)
query.Page(mediaView.CurrentPage - 1, mediaView.CurrentPageSize);
}
DataSet nodes = query.Result;
totalRecords = query.TotalRecords;
return nodes;
}
示例11: GetSitesWhere
/// <summary>
/// Gets WHERE condition to retrieve available sites according specified type.
/// </summary>
private string GetSitesWhere()
{
WhereCondition condition = new WhereCondition().WhereEquals("SiteStatus", "RUNNING");
// If not global admin display only related sites
if (!MembershipContext.AuthenticatedUser.IsGlobalAdministrator)
{
condition.WhereIn("SiteID", new IDQuery<UserSiteInfo>(UserSiteInfo.TYPEINFO.SiteIDColumn)
.WhereEquals("UserID", MembershipContext.AuthenticatedUser.UserID));
}
switch (Sites)
{
case AvailableSitesEnum.OnlySingleSite:
if (!string.IsNullOrEmpty(SelectedSiteName))
{
condition.WhereEquals("SiteName", SelectedSiteName);
}
break;
case AvailableSitesEnum.OnlyCurrentSite:
condition.WhereEquals("SiteName", SiteContext.CurrentSiteName);
break;
}
return condition.ToString(true);
}
示例12: 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;
}
}
示例13: GetFilterWhereCondition
/// <summary>
/// Builds a SQL condition for filtering the order list, and returns it.
/// </summary>
/// <returns>A SQL condition for filtering the order list.</returns>
private WhereCondition GetFilterWhereCondition()
{
var condition = new WhereCondition();
// Order status
if (statusSelector.SelectedID > 0)
{
condition.WhereEquals("OrderStatusID", statusSelector.SelectedID);
}
// Order site
if (FilterSiteID > 0)
{
condition.WhereEquals("OrderSiteID", FilterSiteID);
}
// Order identifier
string filterOrderId = txtOrderId.Text.Trim().Truncate(txtOrderId.MaxLength);
if (filterOrderId != String.Empty)
{
int orderId = ValidationHelper.GetInteger(filterOrderId, 0);
// Include also an invoice number
condition.Where(w => w.WhereEquals("OrderID", orderId).Or().WhereContains("OrderInvoiceNumber", filterOrderId));
}
// Customer's properties, applicable only if a valid customer is not specified
if (CustomerFilterEnabled)
{
// First, Last name and Company search
string customerNameOrCompany = txtCustomerNameOrCompany.Text.Trim().Truncate(txtCustomerNameOrCompany.MaxLength);
if (customerNameOrCompany != String.Empty)
{
condition.WhereIn("OrderCustomerID", new IDQuery<CustomerInfo>("CustomerID").WhereContains("CustomerFirstName", customerNameOrCompany)
.Or()
.WhereContains("CustomerLastName", customerNameOrCompany)
.Or()
.WhereContains("CustomerCompany", customerNameOrCompany));
}
}
// Order is paid
switch (drpOrderIsPaid.SelectedValue)
{
case "0":
condition.Where("ISNULL(OrderIsPaid, 0) = 0");
break;
case "1":
condition.Where("ISNULL(OrderIsPaid, 0) = 1");
break;
}
// Advanced Filter
if (AdvancedFilterEnabled)
{
// Specific currency was selected
if (CurrencySelector.SelectedID > 0)
{
condition.WhereEquals("OrderCurrencyID", CurrencySelector.SelectedID);
}
// Specific payment method was selected
if (PaymentSelector.SelectedID > 0)
{
condition.WhereEquals("OrderPaymentOptionID", PaymentSelector.SelectedID);
}
// Specific shipping option was selected
if (ShippingSelector.SelectedID > 0)
{
condition.WhereEquals("OrderShippingOptionID", ShippingSelector.SelectedID);
}
// Specific tracking number was provided
var trackingNumber = txtTrackingNumber.Text.Truncate(txtTrackingNumber.MaxLength);
if (trackingNumber != string.Empty)
{
condition.WhereContains("OrderTrackingNumber", trackingNumber);
}
// Specific created date was selected
if ((dtpCreatedTo.SelectedDateTime < dtpCreatedTo.MaxDate) && (dtpCreatedTo.SelectedDateTime > dtpCreatedTo.MinDate))
{
condition.WhereLessOrEquals("OrderDate", dtpCreatedTo.SelectedDateTime);
}
// Specific from date was selected
if ((dtpFrom.SelectedDateTime < dtpFrom.MaxDate) && (dtpFrom.SelectedDateTime > dtpFrom.MinDate))
{
condition.WhereGreaterOrEquals("OrderDate", dtpFrom.SelectedDateTime);
}
}
return condition;
}
示例14: CreateWhereCondition
private string CreateWhereCondition(string originalWhere)
{
var where = new WhereCondition();
where.Where(new WhereCondition(originalWhere){ WhereIsComplex = true });
// Add where conditions from filters
where.Where(new WhereCondition(nameFilter.WhereCondition) { WhereIsComplex = true });
string objType = ValidationHelper.GetString(objTypeSelector.Value, "");
if (!String.IsNullOrEmpty(objType))
{
where.WhereLike("VersionObjectType", objType);
}
int userId = ValidationHelper.GetInteger(userSelector.Value, 0);
if (userId > 0)
{
where.WhereEquals("VersionDeletedByUserID", userId);
}
// Get older than value
if (DisplayDateTimeFilter)
{
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;
}
where.WhereLessOrEquals("VersionDeletedWhen", olderThan);
}
return where.ToString(true);
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:50,代码来源:ObjectsRecycleBinFilter.ascx.cs
示例15: GetLevelWhereCondition
/// <summary>
/// Creates level where condition.
/// </summary>
/// <param name="showAllLevels">Indicates if pages from all levels should be retrieved</param>
/// <param name="orderBy">Current order by</param>
private WhereCondition GetLevelWhereCondition(bool showAllLevels, ref string orderBy)
{
var levelCondition = new WhereCondition();
if (showAllLevels)
{
string path = aliasPath ?? string.Empty;
levelCondition.WhereStartsWith("NodeAliasPath", path.TrimEnd('/') + "/")
.WhereGreaterThan("NodeLevel", 0);
}
else
{
levelCondition.WhereEquals("NodeParentID", Node.NodeID)
.WhereEquals("NodeLevel", Node.NodeLevel + 1);
// Extend the where condition to include the root document
if (RequiresDialog && (Node != null) && (Node.NodeParentID == 0))
{
levelCondition.Or().WhereNull("NodeParentID");
orderBy = String.Join(",","NodeParentID ASC", orderBy);
}
}
if (ClassID > 0)
{
levelCondition.WhereEquals("NodeClassID", ClassID);
}
return levelCondition;
}