コード例 #1
0
 /// <summary>
 /// Constructs a search condition with the specified key.
 /// </summary>
 /// <param name="key"></param>
 protected SearchConditionBase(string key)
     : base(key)
 {
     _test          = SearchConditionTest.None;
     _values        = new object[0];
     _sortPosition  = -1;                // do not sort on this field
     _sortDirection = true;              // default sort direction to ascending
 }
コード例 #2
0
ファイル: SearchConditionBase.cs プロジェクト: nhannd/Xian
		/// <summary>
		/// Constructs a search condition with the specified key.
		/// </summary>
		/// <param name="key"></param>
		protected SearchConditionBase(string key)
			: base(key)
		{
			_test = SearchConditionTest.None;
			_values = new object[0];
			_sortPosition = -1;     // do not sort on this field
			_sortDirection = true;    // default sort direction to ascending
		}
コード例 #3
0
ファイル: SearchConditionBase.cs プロジェクト: nhannd/Xian
		/// <summary>
		/// Copy constructor.
		/// </summary>
		/// <param name="other"></param>
		protected SearchConditionBase(SearchConditionBase other)
			: base(other)
		{
			// copy the values
			_values = (new List<object>(other._values)).ToArray();
			_test = other._test;
			_sortPosition = other._sortPosition;
			_sortDirection = other._sortDirection;
		}
コード例 #4
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="other"></param>
 protected SearchConditionBase(SearchConditionBase other)
     : base(other)
 {
     // copy the values
     _values        = (new List <object>(other._values)).ToArray();
     _test          = other._test;
     _sortPosition  = other._sortPosition;
     _sortDirection = other._sortDirection;
 }
コード例 #5
0
        protected void SetCondition(SearchConditionTest test, params object[] values)
        {
            // do not set a condition if any value is null
            foreach (var val in values)
            {
                if (IsNullValue(val))
                {
                    throw new ArgumentNullException();
                }
            }

            _test   = test;
            _values = values;
        }
コード例 #6
0
        internal static HqlCondition GetCondition(string variable, SearchConditionTest test, object[] values)
        {
            switch (test)
            {
            case SearchConditionTest.Equal:
                return(EqualTo(variable, values[0]));

            case SearchConditionTest.NotEqual:
                return(NotEqualTo(variable, values[0]));

            case SearchConditionTest.Like:
                return(Like(variable, (string)values[0]));

            case SearchConditionTest.NotLike:
                return(NotLike(variable, (string)values[0]));

            case SearchConditionTest.Between:
                return(Between(variable, values[0], values[1]));

            case SearchConditionTest.In:
                return(In(variable, values));

            case SearchConditionTest.NotIn:
                return(NotIn(variable, values));

            case SearchConditionTest.LessThan:
                return(LessThan(variable, values[0]));

            case SearchConditionTest.LessThanOrEqual:
                return(LessThanOrEqual(variable, values[0]));

            case SearchConditionTest.MoreThan:
                return(MoreThan(variable, values[0]));

            case SearchConditionTest.MoreThanOrEqual:
                return(MoreThanOrEqual(variable, values[0]));

            case SearchConditionTest.NotNull:
                return(IsNotNull(variable));

            case SearchConditionTest.Null:
                return(IsNull(variable));

            default:
                throw new Exception();                          // invalid
            }
        }
コード例 #7
0
ファイル: SearchConditionBase.cs プロジェクト: nhannd/Xian
		protected void SetCondition(SearchConditionTest test, params object[] values)
		{
			// do not set a condition if any value is null
			foreach (var val in values)
			{
				if (IsNullValue(val))
					throw new ArgumentNullException();
			}

			_test = test;
			_values = values;
		}
コード例 #8
0
ファイル: HqlCondition.cs プロジェクト: nhannd/Xian
		internal static HqlCondition GetCondition(string variable, SearchConditionTest test, object[] values)
		{
			switch (test)
			{
				case SearchConditionTest.Equal:
					return EqualTo(variable, values[0]);
				case SearchConditionTest.NotEqual:
					return NotEqualTo(variable, values[0]);
				case SearchConditionTest.Like:
					return Like(variable, (string)values[0]);
				case SearchConditionTest.NotLike:
					return NotLike(variable, (string)values[0]);
				case SearchConditionTest.Between:
					return Between(variable, values[0], values[1]);
				case SearchConditionTest.In:
					return In(variable, values);
				case SearchConditionTest.NotIn:
					return NotIn(variable, values);
				case SearchConditionTest.LessThan:
					return LessThan(variable, values[0]);
				case SearchConditionTest.LessThanOrEqual:
					return LessThanOrEqual(variable, values[0]);
				case SearchConditionTest.MoreThan:
					return MoreThan(variable, values[0]);
				case SearchConditionTest.MoreThanOrEqual:
					return MoreThanOrEqual(variable, values[0]);
				case SearchConditionTest.NotNull:
					return IsNotNull(variable);
				case SearchConditionTest.Null:
					return IsNull(variable);
				default:
					throw new Exception();  // invalid
			}
		}