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


C# WhereCondition.WhereIn方法代码示例

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


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

示例1: GetWhereCondition

    /// <summary>
    /// Returns where condition based on webpart fields.
    /// </summary>
    private WhereCondition GetWhereCondition()
    {
        // Orders from current site
        var where = new WhereCondition()
            .WhereEquals("OrderSiteID", SiteContext.CurrentSiteID);

        // Order status filter
        var status = OrderStatusInfoProvider.GetOrderStatusInfo(OrderStatus, SiteContext.CurrentSiteName);
        if (status != null)
        {
            where.WhereEquals("OrderStatusID", status.StatusID);
        }

        // Customer or company like filter
        if (!string.IsNullOrEmpty(CustomerOrCompany))
        {
            where.WhereIn("OrderCustomerID", new IDQuery<CustomerInfo>()
                .Where("CustomerFirstName + ' ' + CustomerLastName + ' ' + CustomerFirstName LIKE N'%"+ SqlHelper.EscapeLikeText(SqlHelper.EscapeQuotes(CustomerOrCompany)) + "%'")
                .Or()
                .WhereContains("CustomerCompany", CustomerOrCompany));
        }

        // Filter for orders with note
        if (HasNote)
        {
            where.WhereNotEmpty("OrderNote");
        }

        // Payment method filter
        var payment = PaymentOptionInfoProvider.GetPaymentOptionInfo(PaymentMethod, SiteContext.CurrentSiteName);
        if (payment != null)
        {
            where.WhereEquals("OrderPaymentOptionID", payment.PaymentOptionID);
        }

        // Payment status filter
        switch (PaymentStatus.ToLowerCSafe())
        {
            case PAY_STATUS_NOT_PAID:
                where.Where(new WhereCondition().WhereFalse("OrderIsPaid").Or().WhereNull("OrderIsPaid"));
                break;

            case PAY_STATUS_PAID:
                where.WhereTrue("OrderIsPaid");
                break;
        }

        // Currency filter
        var currencyObj = CurrencyInfoProvider.GetCurrencyInfo(Currency, SiteContext.CurrentSiteName);
        if (currencyObj != null)
        {
            where.WhereEquals("OrderCurrencyID", currencyObj.CurrencyID);
        }

        // Min price in main currency filter
        if (MinPriceInMainCurrency > 0)
        {
            where.Where("OrderTotalPriceInMainCurrency", QueryOperator.LargerOrEquals, MinPriceInMainCurrency);
        }

        // Max price in main currency filter
        if (MaxPriceInMainCurrency > 0)
        {
            where.Where("OrderTotalPriceInMainCurrency", QueryOperator.LessOrEquals, MaxPriceInMainCurrency);
        }

        // Shipping option filter
        var shipping = ShippingOptionInfoProvider.GetShippingOptionInfo(ShippingOption, SiteContext.CurrentSiteName);
        if (shipping != null)
        {
            where.WhereEquals("OrderShippingOptionID", shipping.ShippingOptionID);
        }

        // Shipping country filter
        if (!string.IsNullOrEmpty(ShippingCountry) && ShippingCountry != "0")
        {
            AddCountryWhereCondition(where);
        }

        // Date filter
        AddDateWhereCondition(where);

        return where;
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:87,代码来源:Orders.ascx.cs

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

示例3: AddCountryWhereCondition

    /// <summary>
    /// Returns where condition filtering ShippingAddress, Country and State.
    /// </summary>
    private void AddCountryWhereCondition(WhereCondition where)
    {
        var addressWhere = new IDQuery<AddressInfo>();

        string[] split = ShippingCountry.Split(';');

        if ((split.Length >= 1) && (split.Length <= 2))
        {
            // Country filter
            var country = CountryInfoProvider.GetCountryInfo(split[0]);
            if (country != null)
            {
                addressWhere.WhereEquals("AddressCountryID", country.CountryID);

                if (split.Length == 2)
                {
                    // State filter
                    var state = StateInfoProvider.GetStateInfo(split[1]);
                    if (state != null)
                    {
                        addressWhere.WhereEquals("AddressStateID", state.StateID);
                    }
                }
            }
        }

        where.WhereIn("OrderShippingAddressID", addressWhere);
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:31,代码来源:Orders.ascx.cs

示例4: 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;
    }
开发者ID:prsolans,项目名称:rsg,代码行数:50,代码来源:TopNProductsBySales.ascx.cs

示例5: SetupTargetLanguageDropDownWhereCondition

    /// <summary>
    /// Setups target language drop down list control.
    /// </summary>
    private void SetupTargetLanguageDropDownWhereCondition()
    {
        WhereCondition condition = new WhereCondition().WhereNotEquals("CultureCode", DataHelper.GetNotEmpty(selectCultureElem.DropDownCultures.SelectedValue, defaultCulture));

        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:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:14,代码来源:TranslationServiceSelector.ascx.cs

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

示例7: 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

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

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

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

示例11: GetCurrentWhere

    /// <summary>
    /// Gets current where condition.
    /// </summary>
    /// <returns>Where condition determining documents to process</returns>
    private string GetCurrentWhere()
    {
        List<string> documentIds = docElem.UniGrid.SelectedItems;

        // Prepare the where condition
        WhereCondition condition = new WhereCondition();
        if (currentWhat == What.SelectedDocuments)
        {
            // Get where for selected documents
            condition.WhereIn("DocumentID", documentIds);
        }
        else
        {
            if (!string.IsNullOrEmpty(filterDocuments.WhereCondition))
            {
                // Add filter condition
                condition.Where(filterDocuments.WhereCondition);
            }

            // Select documents only under current workflow
            condition.WhereIn("DocumentWorkflowStepID", new IDQuery<WorkflowStepInfo>().WhereEquals("StepWorkflowID", WorkflowId));
        }
        return condition.ToString(true);
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:28,代码来源:Workflow_Documents.aspx.cs

示例12: Translate

    /// <summary>
    /// Translates document(s).
    /// </summary>
    private void Translate(object parameter)
    {
        if (parameter == null || nodeIds.Count < 1)
        {
            return;
        }

        int refreshId = 0;

        TreeProvider tree = new TreeProvider(currentUser);
        tree.AllowAsyncActions = false;

        try
        {
            // Begin log
            AddLog(ResHelper.GetString("contentrequest.starttranslate", currentCulture));

            bool oneSubmission = chkSeparateSubmissions.Checked;

            // Prepare translation settings
            TranslationSettings settings = new TranslationSettings();
            settings.TargetLanguage = targetCulture;
            settings.TranslateWebpartProperties = SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSTranslateWebpartProperties");
            settings.SourceLanguage = translationElem.FromLanguage;
            settings.Instructions = translationElem.Instructions;
            settings.Priority = translationElem.Priority;
            settings.TranslateAttachments = translationElem.ProcessBinary;
            settings.ProcessBinary = translationElem.ProcessBinary;
            settings.TranslationDeadline = translationElem.Deadline;
            settings.TranslationServiceName = translationElem.SelectedService;

            using (var tr = new CMSTransactionScope())
            {
                // Get the translation provider
                AbstractMachineTranslationService machineService = null;
                AbstractHumanTranslationService humanService = null;
                TranslationSubmissionInfo submission = null;
                TranslationServiceInfo ti = TranslationServiceInfoProvider.GetTranslationServiceInfo(translationElem.SelectedService);
                if (ti != null)
                {
                    // Set if we need target tag (Translations.com workaround)
                    settings.GenerateTargetTag = ti.TranslationServiceGenerateTargetTag;

                    if (oneSubmission)
                    {
                        if (ti.TranslationServiceIsMachine)
                        {
                            machineService = AbstractMachineTranslationService.GetTranslationService(ti, CurrentSiteName);
                        }
                        else
                        {
                            humanService = AbstractHumanTranslationService.GetTranslationService(ti, CurrentSiteName);
                        }
                    }

                    bool langSupported = true;
                    if (humanService != null)
                    {
                        if (!humanService.IsLanguageSupported(settings.TargetLanguage))
                        {
                            AddError(ResHelper.GetString("translationservice.targetlanguagenotsupported"));
                            langSupported = false;
                        }
                        else
                        {
                            submission = TranslationServiceHelper.CreateSubmissionInfo(settings, ti, MembershipContext.AuthenticatedUser.UserID, SiteContext.CurrentSiteID, "Page submission " + DateTime.Now);
                        }
                    }

                    if (langSupported)
                    {
                        if (!oneSubmission || (machineService != null) || (humanService != null))
                        {
                            const string columns = "NodeID, NodeAliasPath, DocumentCulture, NodeParentID";
                            string submissionFileName = "";
                            string submissionName = "";
                            int charCount = 0;
                            int wordCount = 0;
                            int docCount = 0;

                            // Prepare the where condition
                            var where = new WhereCondition().WhereIn("NodeID", nodeIds);

                            // Get the documents in target culture to be able to check if "Skip already translated" option is on
                            // Combine both, source and target culture (at least one hit has to be found - to find the source of translation)
                            where.WhereIn("DocumentCulture", new[] { settings.SourceLanguage, settings.TargetLanguage });

                            DataSet ds = tree.SelectNodes(SiteContext.CurrentSiteName, "/%", TreeProvider.ALL_CULTURES, true, null, where.ToString(true), "NodeAliasPath DESC", TreeProvider.ALL_LEVELS, false, 0, columns);
                            if (!DataHelper.DataSourceIsEmpty(ds))
                            {
                                List<int> processedNodes = new List<int>();

                                // Translate the documents
                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    refreshId = ValidationHelper.GetInteger(dr["NodeParentID"], 0);
                                    int nodeId = ValidationHelper.GetInteger(dr["NodeID"], 0);
//.........这里部分代码省略.........
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:101,代码来源:TranslateDocuments.aspx.cs

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

示例14: OnPreRender

    /// <summary>
    /// OnPreRender.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        gridDocuments.StopProcessing = StopProcessing;
        if (StopProcessing)
        {
            return;
        }

        // Get actual filter where condition
        string filterWhere = gridDocuments.FilterForm.GetWhereCondition();

        // Filter selected document type only
        if ((ClassID > 0) && !RequestHelper.IsCallback())
        {
            CurrentWhereCondition = SqlHelper.AddWhereCondition(filterWhere, "NodeClassID = " + ClassID);
        }
        else
        {
            CurrentWhereCondition = filterWhere;
        }

        if (!dataLoaded)
        {
            if ((gridDocuments.FilterForm.FieldControls != null) && (gridDocuments.FilterForm.FieldControls.Count > 0))
            {
                // Set actual where condition from basic filter if exists
                gridDocuments.WhereClause = filterWhere;
            }

            gridDocuments.ReloadData();
        }

        // Hide column with languages if only one culture is assigned to the site
        if (DataHelper.DataSourceIsEmpty(SiteCultures) || (SiteCultures.Tables[0].Rows.Count <= 1))
        {
            // Hide column with flags
            if (gridDocuments.NamedColumns.ContainsKey("documentculture"))
            {
                gridDocuments.NamedColumns["documentculture"].Visible = false;
            }

            // Hide language filter
            gridDocuments.FilterForm.FieldsToHide.Add("DocumentCulture");
        }
        else
        {
            if (FlagsControls.Count != 0)
            {
                // Get all document node IDs
                HashSet<int> nodeIds = new HashSet<int>();
                foreach (DocumentFlagsControl ucDocFlags in FlagsControls)
                {
                    nodeIds.Add(ucDocFlags.NodeID);
                }

                var condition = new WhereCondition();
                condition.WhereIn("NodeID", nodeIds);

                // Get all culture documents
                DataSet docs = Tree.SelectNodes(currentSiteName, "/%", TreeProvider.ALL_CULTURES, false, null, condition.ToString(true), null, -1, false, 0, "NodeID, DocumentLastVersionNumber, DocumentCulture, DocumentModifiedWhen, DocumentLastPublished");

                if (!DataHelper.DataSourceIsEmpty(docs))
                {
                    var groupedDocs = new GroupedDataSource(docs, "NodeID");

                    // Initialize the document flags controls
                    foreach (var docFlagCtrl in FlagsControls)
                    {
                        docFlagCtrl.DataSource = groupedDocs;
                        docFlagCtrl.ReloadData();
                    }
                }
            }
        }

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

示例15: GetStagingTasksByTaskGroup

 private void GetStagingTasksByTaskGroup(WhereCondition where, int taskGroupSelected)
 {
     if (taskGroupSelected > 0)
     {
         // Get tasks for given task group
         where.WhereIn("TaskID", TaskGroupTaskInfoProvider.GetTaskGroupTasks().WhereEquals("TaskGroupID", taskGroupSelected).Column("TaskID"));
     }
     else if (taskGroupSelected == UniSelector.US_NONE_RECORD)
     {
         where.WhereNotIn("TaskID", TaskGroupTaskInfoProvider.GetTaskGroupTasks().Column("TaskID"));
     }
 }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:12,代码来源:StagingTasksFilter.ascx.cs


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