/// <summary>
        /// Used to create: {UnaryOperation}{Value}
        /// </summary>
        public Expression(UnaryOperation unaryOperation, IValueType value)
        {
            StringBuilder sb = new StringBuilder(512);

            this.UnaryOperator = Operation.GetUnaryOperator(unaryOperation);

            sb.Append(this.UnaryOperator);
            sb.Append(value.ToString());

            this.Value = sb.ToString();
        }
Example #2
0
        /// <summary>
        /// Used to create: {UnaryOperation}{Value}
        /// </summary>
        public Expression(UnaryOperation unaryOperation, IValueType value)
        {
            StringBuilder sb = new StringBuilder(512);

            this._unaryOperator = Operation.GetUnaryOperator(unaryOperation);

            sb.Append(this._unaryOperator);
            sb.Append(value.ToString());

            this.Value = sb.ToString();
        }
        /// <summary>
        /// Used to create: {ValueLeft}{ComparisonOperator}{ValueRight}
        /// </summary>
        public Expression(ComparisonOperation comparisonOperation, IValueType valueLeft, IValueType valueRight)
        {
            StringBuilder sb = new StringBuilder(512);

            this.ComparisonOperator = Operation.GetComparisonOperator(comparisonOperation);

            sb.Append(valueLeft.ToString());
            sb.Append(this.ComparisonOperator);
            sb.Append(valueRight.ToString());

            this.Value = sb.ToString();
        }
Example #4
0
        /// <summary>
        /// Used to create: {ValueLeft}{ComparisonOperator}{ValueRight}
        /// </summary>
        public Expression(ComparisonOperation comparisonOperation, IValueType valueLeft, IValueType valueRight)
        {
            StringBuilder sb = new StringBuilder(512);

            this._comparisonOperator = Operation.GetComparisonOperator(comparisonOperation);

            sb.Append(valueLeft.ToString());
            sb.Append(this._comparisonOperator);
            sb.Append(valueRight.ToString());

            this.Value = sb.ToString();
        }
Example #5
0
        /// <summary>
        /// Used to create: IF({Condition}, {CaseTrue}, IF({Condition}, {CaseTrue}, IF({Condition}, {CaseTrue}, {DefaultValue})))
        /// </summary>
        public Switch(IValueType defaultValue, params KeyValuePair<System.Linq.Expressions.Expression<Func<string>>, IValueType>[] conditionCaseTruePair)
        {
            StringBuilder sb = new StringBuilder(512);

            for (int i = 0; i < conditionCaseTruePair.Length; i++)
            {
                sb.AppendFormat("IF({0}" + SPFormulaBuilder.SectionSeparator + "{1}" + SPFormulaBuilder.SectionSeparator, new Expression(conditionCaseTruePair[i].Key).ToString(), conditionCaseTruePair[i].Value.ToString());

                if ((i+1) == conditionCaseTruePair.Length)
                {
                    sb.AppendFormat("{0}", defaultValue.ToString());
                    sb.Append(')', conditionCaseTruePair.Length);
                }
            }

            this.Value = sb.ToString();
        }
Example #6
0
        public bool Contains(IValueType leftTerm)
        {
            if (!(leftTerm is BaseType))
            {
                return(false);
            }

            if (((BaseType)leftTerm).IsNumberOrBoolean())
            {
                return(this == (BaseType)leftTerm);
            }
            else if (Value is string)
            {
                return(((string)Value).Contains(leftTerm.ToString()));
            }

            return(false);
        }
 /// <summary>
 /// Used to create: {Value}
 /// </summary>
 public Expression(IValueType value)
 {
     this.Value = value.ToString();
 }
Example #8
0
 /// <summary>
 /// Used to create: {Value}
 /// </summary>
 public Expression(IValueType value)
 {
     this.Value = value.ToString();
 }
Example #9
0
 /// <summary>
 /// Used to create: ={Text}
 /// </summary>
 public Formula(IValueType text)
 {
     this.Text = text.ToString();
 }