예제 #1
0
        /// <summary>
        /// 轉換比較運算子。
        /// </summary>
        /// <param name="comparisonOperator">比較運算子列舉。</param>
        private string ToComparisonOperator(EComparisonOperator comparisonOperator)
        {
            switch (comparisonOperator)
            {
            case EComparisonOperator.Equal: return("=");

            case EComparisonOperator.NotEqual: return("<>");

            case EComparisonOperator.Less: return("<");

            case EComparisonOperator.LessOrEqual: return("<=");

            case EComparisonOperator.Greater: return(">");

            case EComparisonOperator.GreaterOrEqual: return(">=");

            case EComparisonOperator.Like: return("LIKE");

            case EComparisonOperator.Between: return("BETWEEN");

            case EComparisonOperator.In: return("IN");

            case EComparisonOperator.NotIn: return("NOTIN");

            default:     // Variable
                return("VARIABLE");
            }
        }
예제 #2
0
        /// <summary>
        /// 加入成員。
        /// </summary>
        /// <param name="fieldName">查詢欄位名稱。</param>
        /// <param name="combineOperator">結合運算子。</param>
        /// <param name="comparisonOperator">比較運算子。</param>
        /// <param name="filterValue">查詢值。</param>
        /// <param name="groupNumber">條件群組。</param>
        public GFilterItem Add(string fieldName, ECombineOperator combineOperator, EComparisonOperator comparisonOperator, string filterValue, int groupNumber)
        {
            GFilterItem oItem;

            oItem = new GFilterItem();
            oItem.CombineOperator    = combineOperator;
            oItem.FieldName          = fieldName;
            oItem.ComparisonOperator = comparisonOperator;
            oItem.FilterValue        = filterValue;
            oItem.GroupNumber        = groupNumber;
            base.Add(oItem);
            return(oItem);
        }
예제 #3
0
        /// <summary>
        /// 取得 Db Parameter 的回傳的參數。
        /// </summary>
        /// <param name="fieldDefine">欄位定義。</param>
        /// <param name="comparison">比較運算子。</param>
        /// <param name="value">過濾條件值。</param>
        private string GetDbParameter(GFieldDefine fieldDefine, EComparisonOperator comparison, object value)
        {
            var oDbParameter = this.DbCommandHelper.AddFilterParameter(fieldDefine);

            if (comparison == EComparisonOperator.Like &&
                (fieldDefine.DbType == EFieldDbType.String || fieldDefine.DbType == EFieldDbType.Text))
            {
                // Like 加入 % 符號
                if (BaseFunc.CStr(value).Contains("%"))
                {
                    oDbParameter.Value = value;
                }
                else
                {
                    oDbParameter.Value = StrFunc.StrFormat("%{0}%", value);
                }
            }
            else
            {
                oDbParameter.Value = value;
            }

            return(oDbParameter.ParameterName);
        }
예제 #4
0
 /// Author: Bert van Montfort
 /// <summary>
 /// Creates a new ValueSolver.
 /// This solver checks for (i==5) and the like
 /// </summary>
 /// <param name="leftSolver">Left solver.</param>
 /// <param name="rightSolver">Right solver.</param>
 /// <param name="comparisonOperator">Comparison operator.</param>
 public ValueSolver(VariableSolver leftSolver, VariableSolver rightSolver, EComparisonOperator comparisonOperator)
 {
     this.leftSolver = leftSolver;
     this.rightSolver = rightSolver;
     this.comparisonOperator = comparisonOperator;
 }
예제 #5
0
 /// <summary>
 /// 建構函式。
 /// </summary>
 /// <param name="fieldName">查詢欄位名稱。</param>
 /// <param name="filterValue">查詢值。</param>
 /// <param name="comparisonOperator">比較運算子</param>
 public GFilterItem(string fieldName, string filterValue, EComparisonOperator comparisonOperator)
 {
     FieldName          = fieldName;
     FilterValue        = filterValue;
     ComparisonOperator = comparisonOperator;
 }