Exemple #1
0
        /// <summary>
        /// Add a property criterion to a search unit.
        /// set to the left or to the right operand of the expression.
        /// </summary>
        /// <param name="criteria"></param>
        /// <param name="keyText"></param>
        /// <returns></returns>
        public SearchPropCriterionKeyText AddCritPropKeyText(SearchEntity searchEntity, SearchPropBoolExpr boolExprParent, BoolExprOperand leftOrRight, string keyText)
        {
            if (searchEntity == null)
            {
                return(null);
            }
            if (boolExprParent == null)
            {
                return(null);
            }

            // check the text
            if (string.IsNullOrWhiteSpace(keyText))
            {
                return(null);
            }

            // check that the criterion does not already exists
            if (boolExprParent.GetLeftOrRight(leftOrRight) != null)
            {
                return(null);
            }

            SearchPropCriterionKeyText criterionPropKeyText = CreateSearchPropCriterionPropKeyText(keyText);

            // set the prop operand to the left or to the right
            boolExprParent.SetLeftOrRight(leftOrRight, criterionPropKeyText);
            return(criterionPropKeyText);
        }
Exemple #2
0
        /// <summary>
        /// create a boolean expression.
        /// </summary>
        /// <param name="searchEntityUnit"></param>
        /// <param name="searchPropParent"></param>
        /// <returns></returns>
        public SearchPropBoolExpr AddSearchPropBoolExpr(SearchEntity searchEntity, SearchPropBoolExpr boolExprParent, BoolExprOperand leftOrRight, SearchBoolOperator oper)
        {
            if (searchEntity == null)
            {
                return(null);
            }
            if (boolExprParent == null)
            {
                return(null);
            }

            // check that the criterion does not already exists
            if (searchEntity.SearchPropRoot != null)
            {
                // a criterion already exists!
                return(null);
            }

            // check that the criterion does not already exists
            if (boolExprParent.GetLeftOrRight(leftOrRight) != null)
            {
                return(null);
            }

            SearchPropBoolExpr expr = new SearchPropBoolExpr();

            expr.Operator = oper;

            // set the prop operand to the left or to the right
            boolExprParent.SetLeftOrRight(leftOrRight, expr);
            return(expr);
        }