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


C# WhereClause.iOR方法代码示例

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


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

示例1: CreateWhereClause

        public virtual WhereClause CreateWhereClause(String searchText, String fromSearchControl, String AutoTypeAheadSearch, String AutoTypeAheadWordSeparators)
        {
            // This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature.
            UOMTable.Instance.InnerFilter = null;
            WhereClause wc = new WhereClause();

            // Compose the WHERE clause consiting of:
            // 1. Static clause defined at design time.
            // 2. User selected search criteria.
            // 3. User selected filter criteria.

            String appRelativeVirtualPath = (String)HttpContext.Current.Session["AppRelativeVirtualPath"];

            // Adds clauses if values are selected in Filter controls which are configured in the page.

              String UOMDescriptionFilterSelectedValue = (String)HttpContext.Current.Session[HttpContext.Current.Session.SessionID + appRelativeVirtualPath + "UOMDescriptionFilter_Ajax"];
            if (MiscUtils.IsValueSelected(UOMDescriptionFilterSelectedValue)) {

                wc.iAND(UOMTable.UOMDescription, BaseFilter.ComparisonOperator.EqualsTo, UOMDescriptionFilterSelectedValue, false, false);

              }

              String UOMNameFilterSelectedValue = (String)HttpContext.Current.Session[HttpContext.Current.Session.SessionID + appRelativeVirtualPath + "UOMNameFilter_Ajax"];
            if (MiscUtils.IsValueSelected(UOMNameFilterSelectedValue)) {

                wc.iAND(UOMTable.UOMName, BaseFilter.ComparisonOperator.EqualsTo, UOMNameFilterSelectedValue, false, false);

              }

            if (MiscUtils.IsValueSelected(searchText) && fromSearchControl == "UOMSearch") {
                String formatedSearchText = searchText;
                // strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored.

                  if (searchText.StartsWith("...")) {
                      formatedSearchText = searchText.Substring(3,searchText.Length-3);
                  }
                  if (searchText.EndsWith("...")) {
                      formatedSearchText = searchText.Substring(0,searchText.Length-3);
                  }

                // After stripping "...", trim any leading and trailing whitespaces
                formatedSearchText = formatedSearchText.Trim();
                // After stripping "..." see if the search text is null or empty.
                if (MiscUtils.IsValueSelected(searchText)) {

                    // These clauses are added depending on operator and fields selected in Control's property page, bindings tab.

                    WhereClause search = new WhereClause();

                    if (StringUtils.InvariantLCase(AutoTypeAheadSearch).Equals("wordsstartingwithsearchstring")) {

                        search.iOR(UOMTable.UOMName, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, true, false);
                        search.iOR(UOMTable.UOMName, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators + formatedSearchText, true, false);

                        search.iOR(UOMTable.UOMDescription, BaseFilter.ComparisonOperator.Starts_With, formatedSearchText, true, false);
                        search.iOR(UOMTable.UOMDescription, BaseFilter.ComparisonOperator.Contains, AutoTypeAheadWordSeparators + formatedSearchText, true, false);

                    } else {

                        search.iOR(UOMTable.UOMName, BaseFilter.ComparisonOperator.Contains, formatedSearchText, true, false);
                        search.iOR(UOMTable.UOMDescription, BaseFilter.ComparisonOperator.Contains, formatedSearchText, true, false);
                    }
                    wc.iAND(search);

                }
            }

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

示例2: CreateWhereClause

        protected virtual WhereClause CreateWhereClause()
        {
            WhereClause whereClause = new WhereClause();
            BaseClasses.Data.BaseColumn displayCol = this.GetTable().TableDefinition.ColumnList.GetByAnyName(this.DisplayField);
            if (MiscUtils.IsValueSelected(this.StartsWith))
            {
            // Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored.
            if (this.StartsWith.Text.StartsWith("...")) {
            this.StartsWith.Text = this.StartsWith.Text.Substring(3, this.StartsWith.Text.Length - 3);
            }
            if (this.StartsWith.Text.EndsWith("...")) {
            this.StartsWith.Text = this.StartsWith.Text.Substring(0, this.StartsWith.Text.Length - 3);
            }
            this.StartsWith.Text = this.StartsWith.Text.Trim();
            if (displayCol != null)
            {
                whereClause.iAND(displayCol, BaseFilter.ComparisonOperator.Starts_With, this.StartsWith.Text, true, false);
            }
            else
            {
                List<BaseClasses.Data.BaseColumn> dfkaColumns = GetDFKAColumns();
                    WhereClause wc = new WhereClause();
                    if (dfkaColumns != null)
                    {
                        if (dfkaColumns.Count > 0)
                        {
                            foreach (BaseClasses.Data.BaseColumn col in dfkaColumns)
                            {
                                if (col.ColumnType.Equals(BaseColumn.ColumnTypes.String))
                                    wc.iOR(col, BaseFilter.ComparisonOperator.Starts_With, this.StartsWith.Text, true, false);
                            }
                            whereClause.iAND(wc);
                        }
                    }
            }
            }

            if (MiscUtils.IsValueSelected(this.Contains))
            {

            // Strip "..." from begin and ending of the search text, otherwise the search will return 0 values as in database "..." is not stored.
            if (this.Contains.Text.StartsWith("...")) {
            this.Contains.Text = this.Contains.Text.Substring(3, this.Contains.Text.Length - 3);
            }
            if (this.StartsWith.Text.EndsWith("...")) {
            this.Contains.Text = this.Contains.Text.Substring(0, this.Contains.Text.Length - 3);
            }
            this.Contains.Text = this.Contains.Text.Trim();
            if (displayCol != null)
            {
                whereClause.iAND(displayCol, BaseFilter.ComparisonOperator.Contains, this.Contains.Text, true, false);
            }
            else
            {
                WhereClause wc = new WhereClause();
                List<BaseClasses.Data.BaseColumn> dfkaColumns = GetDFKAColumns();
                foreach (BaseClasses.Data.BaseColumn col in dfkaColumns)
                {
                    if (col.ColumnType.Equals(BaseColumn.ColumnTypes.String))
                        wc.iOR(col, BaseFilter.ComparisonOperator.Contains, this.Contains.Text, true, false);
                }
                whereClause.iAND(wc);
            }
            }
            return whereClause;
        }
开发者ID:ciswebb,项目名称:FPC-Estimate-App,代码行数:66,代码来源:LargeListSelector.Controls.cs


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