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


C# CompoundFilter类代码示例

本文整理汇总了C#中CompoundFilter的典型用法代码示例。如果您正苦于以下问题:C# CompoundFilter类的具体用法?C# CompoundFilter怎么用?C# CompoundFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Run

        public static void Run()
        {
            // Set up a navigator which looks at sites/pipes/Nozzles/Tee only
            TypeFilter filt = new TypeFilter();
            filt.Add(DbElementTypeInstance.SITE);
            filt.Add(DbElementTypeInstance.PIPE);
            filt.Add(DbElementTypeInstance.NOZZLE);
            filt.Add(DbElementTypeInstance.TEE);
            CompoundFilter filt2 = new CompoundFilter();
            filt2.AddShow(filt);
            ElementTreeNavigator navi = new ElementTreeNavigator(DbElement.GetElement("/*"), filt2);

            // Test FirstMember
            DbElement site = navi.FirstMemberInScan(Example.Instance.mWorld);
            DbElement nozz = navi.FirstMemberInScan(Example.Instance.mZone);
            nozz = navi.FirstMemberInScan(Example.Instance.mEqui);
            DbElement ele = navi.FirstMemberInScan(nozz);

            // Next
            DbElement zone = site.FirstMember();
            DbElement next = navi.NextInScan(zone);

            // parent
            DbElement parent = navi.Parent(Example.Instance.mEqui);
            parent = navi.Parent(nozz);
            parent = navi.Parent(parent);

            //All Members
            DbElement[] tees = navi.MembersInScan(Example.Instance.mPipe);
        }
开发者ID:freudshow,项目名称:raffles-codes,代码行数:30,代码来源:ExampleTreeNavigator.cs

示例2: CreateCompoundJoinFilter

        public virtual CompoundFilter CreateCompoundJoinFilter()
        {
            CompoundFilter jFilter = new CompoundFilter();

            return jFilter;
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:6,代码来源:ShowUOMTable.Controls.cs

示例3: UOMID_SelectedIndexChanged

        protected virtual void UOMID_SelectedIndexChanged(object sender, EventArgs args)
        {
            // If a large list selector or a Quick Add link is used, the dropdown list
            // will contain an item that was not in the original (smaller) list.  During postbacks,
            // this new item will not be in the list - since the list is based on the original values
            // read from the database. This function adds the value back if necessary.
            // In addition, This dropdown can be used on make/model/year style dropdowns.  Make filters the result of Model.
            // Mode filters the result of Year.  When users change the value of Make, Model and Year are repopulated.
            // When this function is fire for Make or Model, we don't want the following code executed.
            // Therefore, we check this situation using Items.Count > 1
            // Since both of these feature use javascript to fire this event, this can be skip if the event is fired by server side,
            // so we check if it is not postback
            if (!this.Page.IsPostBack && this.UOMID.Items.Count > 1)
            {
                string selectedValue = MiscUtils.GetValueSelectedPageRequest(this.UOMID);

            if (selectedValue != null &&
                selectedValue.Trim() != "" &&
                !MiscUtils.SetSelectedValue(this.UOMID, selectedValue) &&
                !MiscUtils.SetSelectedDisplayText(this.UOMID, selectedValue))
            {

                // construct a whereclause to query a record with UOM.UOMID = selectedValue

                CompoundFilter filter2 = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null);
                WhereClause whereClause2 = new WhereClause();
                filter2.AddFilter(new BaseClasses.Data.ColumnValueFilter(UOMTable.UOMID, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, false));
                whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator);

                // Execute the query
                try
                {
                UOMRecord[] rc = UOMTable.GetRecords(whereClause2, new OrderBy(false, false), 0, 1);
                System.Collections.Generic.IDictionary<string, object> vars = new System.Collections.Generic.Dictionary<string, object> ();
                    // if find a record, add it to the dropdown and set it as selected item
                    if (rc != null && rc.Length == 1)
                    {

                        string fvalue = ScopeTable.UOMID.Format(selectedValue);

                        ListItem item = new ListItem(fvalue, selectedValue);
                        item.Selected = true;
                        this.UOMID.Items.Add(item);
                    }
                }
                catch
                {
                }

            }

            }
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:53,代码来源:EditScope.Controls.cs

示例4: PopulateUOMIDDropDownList

        // Fill the UOMID list.
        protected virtual void PopulateUOMIDDropDownList(string selectedValue, int maxItems)
        {
            this.UOMID.Items.Clear();

            // 1. Setup the static list items

            // Add the Please Select item.
            this.UOMID.Items.Insert(0, new ListItem(this.Page.GetResourceValue("Txt:PleaseSelect", "FPCEstimate"), "--PLEASE_SELECT--"));

            // 2. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_UOMIDDropDownList function.
            // It is better to customize the where clause there.

            WhereClause wc = CreateWhereClause_UOMIDDropDownList();

            // Create the ORDER BY clause to sort based on the displayed value.

            OrderBy orderBy = new OrderBy(false, false);
                          orderBy.Add(UOMTable.UOMName, OrderByItem.OrderDir.Asc);

            System.Collections.Generic.IDictionary<string, object> variables = new System.Collections.Generic.Dictionary<string, object> ();

            // 3. Read a total of maxItems from the database and insert them into the UOMIDDropDownList.
            UOMRecord[] itemValues  = null;
            if (wc.RunQuery)
            {
                int counter = 0;
                int pageNum = 0;
                FormulaEvaluator evaluator = new FormulaEvaluator();
                do
                {
                    itemValues = UOMTable.GetRecords(wc, orderBy, pageNum, maxItems);
                    foreach (UOMRecord itemValue in itemValues)
                    {
                        // Create the item and add to the list.
                        string cvalue = null;
                        string fvalue = null;
                        if (itemValue.UOMIDSpecified)
                        {
                            cvalue = itemValue.UOMID.ToString().ToString();
                            if (counter < maxItems && this.UOMID.Items.FindByValue(cvalue) == null)
                            {

                                Boolean _isExpandableNonCompositeForeignKey = ScopeTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(ScopeTable.UOMID);
                                if(_isExpandableNonCompositeForeignKey && ScopeTable.UOMID.IsApplyDisplayAs)
                                    fvalue = ScopeTable.GetDFKA(itemValue, ScopeTable.UOMID);
                                if ((!_isExpandableNonCompositeForeignKey) || (String.IsNullOrEmpty(fvalue)))
                                    fvalue = itemValue.Format(UOMTable.UOMName);

                                if (fvalue == null || fvalue.Trim() == "")
                                    fvalue = cvalue;
                                ListItem newItem = new ListItem(fvalue, cvalue);
                                this.UOMID.Items.Add(newItem);
                                counter += 1;
                            }
                        }
                    }
                    pageNum++;
                }
                while (itemValues.Length == maxItems && counter < maxItems);
            }

            // 4. Set the selected value (insert if not already present).

            if (selectedValue != null &&
                selectedValue.Trim() != "" &&
                !MiscUtils.SetSelectedValue(this.UOMID, selectedValue) &&
                !MiscUtils.SetSelectedDisplayText(this.UOMID, selectedValue))
            {

                // construct a whereclause to query a record with UOM.UOMID = selectedValue

                CompoundFilter filter2 = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null);
                WhereClause whereClause2 = new WhereClause();
                filter2.AddFilter(new BaseClasses.Data.ColumnValueFilter(UOMTable.UOMID, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, false));
                whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator);

                // Execute the query
                try
                {
                UOMRecord[] rc = UOMTable.GetRecords(whereClause2, new OrderBy(false, false), 0, 1);
                System.Collections.Generic.IDictionary<string, object> vars = new System.Collections.Generic.Dictionary<string, object> ();
                    // if find a record, add it to the dropdown and set it as selected item
                    if (rc != null && rc.Length == 1)
                    {

                        string fvalue = ScopeTable.UOMID.Format(selectedValue);

                        ListItem item = new ListItem(fvalue, selectedValue);
                        item.Selected = true;
                        this.UOMID.Items.Add(item);
                    }
                }
                catch
                {
                }

            }
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:99,代码来源:EditScope.Controls.cs


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