当前位置: 首页>>代码示例>>C#>>正文


C# WhereCondition.WhereNotEquals方法代码示例

本文整理汇总了C#中WhereCondition.WhereNotEquals方法的典型用法代码示例。如果您正苦于以下问题:C# WhereCondition.WhereNotEquals方法的具体用法?C# WhereCondition.WhereNotEquals怎么用?C# WhereCondition.WhereNotEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WhereCondition的用法示例。


在下文中一共展示了WhereCondition.WhereNotEquals方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetWhereCondition

    /// <summary>
    /// Returns SQL WHERE condition depending on selected checkboxes.
    /// </summary>
    /// <returns>Returns SQL WHERE condition</returns>
    public string GetWhereCondition()
    {
        var where = new WhereCondition();

        // Contacts checked
        if (chkContacts.Checked)
        {
            where.Where(GetContactWhereCondition());
        }

        // Address checked
        if (chkAddress.Checked)
        {
            where.Where(GetAddressWhereCondition());
        }

        // Email address checked
        if (chkEmail.Checked)
        {
            string domain = ContactHelper.GetEmailDomain(CurrentAccount.AccountEmail);
            if (!String.IsNullOrEmpty(domain))
            {
                var emailWhere = new WhereCondition().WhereEndsWith("AccountEmail", "@" + domain);
                where.Where(emailWhere);
            }
        }

        // URL checked
        if (chkURL.Checked && !String.IsNullOrEmpty(CurrentAccount.AccountWebSite))
        {
            var urlWhere = new WhereCondition().WhereContains("AccountWebSite", URLHelper.CorrectDomainName(CurrentAccount.AccountWebSite));
            where.Where(urlWhere);
        }

        // Phone & fax checked
        if (chkPhone.Checked && (!String.IsNullOrEmpty(CurrentAccount.AccountPhone) || !String.IsNullOrEmpty(CurrentAccount.AccountFax)))
        {
            where.Where(GetPhoneWhereCondition());
        }

        if ((!chkContacts.Checked && !chkAddress.Checked && !chkEmail.Checked && !chkURL.Checked && !chkPhone.Checked) || (String.IsNullOrEmpty(where.WhereCondition)))
        {
            return "(1 = 0)";
        }

        // Filter out current account
        where.WhereNotEquals("AccountID", CurrentAccount.AccountID);

        // Filter out merged records
        where.Where(w => w.Where(x => x.WhereNull("AccountMergedWithAccountID")
                                       .WhereNull("AccountGlobalAccountID")
                                       .WhereGreaterThan("AccountSiteID", 0))
                          .Or(y => y.WhereNull("AccountGlobalAccountID")
                                    .WhereNull("AccountSiteID")));

        // For global object use siteselector's value
        if (plcSite.Visible)
        {
            mSelectedSiteID = UniSelector.US_ALL_RECORDS;
            if (siteSelector.Visible)
            {
                mSelectedSiteID = siteSelector.SiteID;
            }
            else if (siteOrGlobalSelector.Visible)
            {
                mSelectedSiteID = siteOrGlobalSelector.SiteID;
            }

            // Only global objects
            if (mSelectedSiteID == UniSelector.US_GLOBAL_RECORD)
            {
                where.WhereNull("AccountSiteID");
            }
            // Global and site objects
            else if (mSelectedSiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD)
            {
                where.Where(w => w.WhereNull("AccountSiteID").Or().WhereEquals("AccountSiteID", SiteContext.CurrentSiteID));
            }
            // Site objects
            else if (mSelectedSiteID != UniSelector.US_ALL_RECORDS)
            {
                where.WhereEquals("AccountSiteID", mSelectedSiteID);
            }
        }
        // Filter out accounts from different sites
        else
        {
            // Site accounts only
            if (CurrentAccount.AccountSiteID > 0)
            {
                where.WhereEquals("AccountSiteID", CurrentAccount.AccountSiteID);
            }
            // Global accounts only
            else
            {
                where.WhereNull("AccountSiteID");
//.........这里部分代码省略.........
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:101,代码来源:FilterSuggest.ascx.cs

示例2: 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;
            }
        }
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:37,代码来源:OutdatedDocumentsFilter.ascx.cs

示例3: CheckSitePermissions

    /// <summary>
    /// Checks activity permissions.
    /// Returns restricted sites condition.
    /// </summary>
    private WhereCondition CheckSitePermissions(IWhereCondition whereCondition)
    {
        var restrictedSitesCondition = new WhereCondition();
        var activitiesSites = ActivityInfoProvider.GetActivities()
                                                  .Distinct()
                                                  .Column("ActivitySiteID")
                                                  .Where(whereCondition);
        foreach (var activity in activitiesSites)
        {
            if (!CurrentUser.IsAuthorizedPerObject(PermissionsEnum.Modify, "om.activity", SiteInfoProvider.GetSiteName(activity.ActivitySiteID)))
            {
                SiteInfo notAllowedSite = SiteInfoProvider.GetSiteInfo(activity.ActivitySiteID);
                AddError(String.Format(GetString("accessdeniedtopage.info"), ResHelper.LocalizeString(notAllowedSite.DisplayName)));

                restrictedSitesCondition.WhereNotEquals("ActivitySiteID", activity.ActivitySiteID);
            }
        }

        return restrictedSitesCondition;
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:24,代码来源:Delete.aspx.cs

示例4: SetupTargetLanguageDropDownWhereCondition

    /// <summary>
    /// Setups target language selector control.
    /// </summary>
    private void SetupTargetLanguageDropDownWhereCondition()
    {
        WhereCondition condition = new WhereCondition();

        var culturesAreEqual = currentCulture.EqualsCSafe(defaultCulture, true);
        var selectedSourceCulture = selectCultureElem.DropDownCultures.SelectedValue;

        string notTargetLanguage = null;

        if (!String.IsNullOrEmpty(selectedSourceCulture))
        {
            // Use source language if selected
            notTargetLanguage = selectedSourceCulture;
        }
        else if (!culturesAreEqual || !UseCurrentCultureAsDefaultTarget)
        {
            // Use default culture if source and target languages are equal
            notTargetLanguage = defaultCulture;
        }

        if (!String.IsNullOrEmpty(selectedSourceCulture))
        {
            condition.WhereNotEquals("CultureCode", notTargetLanguage);
        }

        if (!CurrentUser.IsGlobalAdministrator && CurrentUser.UserHasAllowedCultures)
        {
            condition.WhereIn("CultureID", new IDQuery(UserCultureInfo.OBJECT_TYPE, "CultureID").WhereEquals("UserID", CurrentUser.UserID).WhereEquals("SiteID", CurrentSite.SiteID));
        }

        selectTargetCultureElem.AdditionalWhereCondition = condition.ToString(true);
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:35,代码来源:TranslationServiceSelector.ascx.cs

示例5: OnInit

    protected override void OnInit(EventArgs e)
    {
        currentUser = MembershipContext.AuthenticatedUser;
        prefferedUICultureCode = currentUser.PreferredUICultureCode;

        var categoryWhere = new WhereCondition();

        if (IsUITemplate())
        {
            categorySelector.RootPath = CATEGORY_UIWEBPARTS;
            COOKIE_SELECTED_CATEGORY += "UI";
        }
        else
        {
            categoryWhere.WhereNotEquals("ObjectPath", CATEGORY_UIWEBPARTS).WhereNotStartsWith("ObjectPath", CATEGORY_UIWEBPARTS + "/");
        }

        // Display only top level categories
        categoryWhere.WhereLessThan("ObjectLevel", 2);
        categorySelector.WhereCondition = categoryWhere.ToString(true);

        base.OnInit(e);
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:23,代码来源:WebPartToolbar.ascx.cs

示例6: ReloadData

    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        uniSelector.IsLiveSite = IsLiveSite;
        if (!DisplayNoDataMessage)
        {
            uniSelector.ZeroRowsText = string.Empty;
        }

        // Need to set uni-selector value again after basic form reload
        if (AllowMultipleChoice)
        {
            uniSelector.Value = mMultipleChoiceValue;
        }

        var where = new WhereCondition();

        if (ProductOptionCategoryID > 0)
        {
            where.WhereEquals("SKUOptionCategoryID", ProductOptionCategoryID);
        }
        else
        {
            var productSiteWhere = new WhereCondition();

            // Add global products
            if (DisplayGlobalProducts)
            {
                productSiteWhere.Where(w => w.WhereNull("SKUOptionCategoryID")
                                             .WhereNull("SKUSiteID"));
            }

            // Add site specific products
            if (DisplaySiteProducts)
            {
                productSiteWhere.Or().Where(w => w.WhereNull("SKUOptionCategoryID")
                                                  .WhereEquals("SKUSiteID", SiteID));
            }

            where.Where(productSiteWhere);
        }

        // Exclude standard products if needed
        if (!DisplayStandardProducts)
        {
            where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Product.ToStringRepresentation());
        }

        // Exclude memberships if needed
        if (!DisplayMemberships)
        {
            where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Membership.ToStringRepresentation());
        }

        // Exclude e-products if needed
        if (!DisplayEproducts)
        {
            where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.EProduct.ToStringRepresentation());
        }

        // Exclude donations if needed
        if (!DisplayDonations)
        {
            where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Donation.ToStringRepresentation());
        }

        // Exclude bundles if needed
        if (!DisplayBundles)
        {
            where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Bundle.ToStringRepresentation());
        }

        // Exclude products with product options if needed
        if (DisplayOnlyProductsWithoutOptions)
        {
            where.WhereNotIn("SKUID", new IDQuery<SKUOptionCategoryInfo>("SKUID"));
        }

        if (DisplayProductOptions && (ProductOptionCategoryID <= 0))
        {
            var optionsSiteWhere = new WhereCondition();

            // Add global options
            if (DisplayGlobalOptions)
            {
                optionsSiteWhere.Where(w => w.WhereNotNull("SKUOptionCategoryID")
                                             .WhereNull("SKUSiteID"));
            }

            // Add site specific options
            if (DisplaySiteOptions)
            {
                optionsSiteWhere.Or().Where(w => w.WhereNotNull("SKUOptionCategoryID")
                                                  .WhereEquals("SKUSiteID", SiteID));
            }

            where.Or().Where(optionsSiteWhere);
            where = new WhereCondition().Where(where);
//.........这里部分代码省略.........
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:101,代码来源:SKUSelector.ascx.cs

示例7: 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));
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:33,代码来源:CurrencySelector.ascx.cs

示例8: 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);

        // 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));
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:18,代码来源:CurrencySelector.ascx.cs


注:本文中的WhereCondition.WhereNotEquals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。