示例#1
0
        /// <summary>
        /// Creates a condition node that is a logical conjunction ("AND") or disjunction ("OR")
        /// of a collection of subconditions.
        /// </summary>
        /// <param name="conditionType">The SearchConditionType of the condition node.
        /// Must be either AndCondition or OrCondition.</param>
        /// <param name="simplyfy">TRUE to logically simplify the result, if possible;
        /// then the result will not necessarily to be of the specified kind. FALSE if the result should
        /// have exactly the prescribed structure. An application that plans to execute a query based on the
        /// condition tree would typically benefit from setting this parameter to TRUE. </param>
        /// <param name="conditionNodes">Array of subconditions</param>
        /// <returns>New SearchCondition based on the operation</returns>
        public static SearchCondition CreateAndOrCondition(SearchConditionType conditionType, bool simplyfy, params SearchCondition[] conditionNodes)
        {
            // Same as the native "IConditionFactory:MakeAndOr" method
            IConditionFactory nativeConditionFactory = (IConditionFactory) new ConditionFactoryCoClass();
            ICondition        result = null;

            try
            {
                //
                List <ICondition> conditionList = new List <ICondition>();
                foreach (SearchCondition c in conditionNodes)
                {
                    conditionList.Add(c.NativeSearchCondition);
                }

                IEnumUnknown subConditions = new EnumUnknownClass(conditionList.ToArray());

                HRESULT hr = nativeConditionFactory.MakeAndOr(conditionType, subConditions, simplyfy, out result);

                if (!CoreErrorHelper.Succeeded((int)hr))
                {
                    Marshal.ThrowExceptionForHR((int)hr);
                }
            }
            finally
            {
                if (nativeConditionFactory != null)
                {
                    Marshal.ReleaseComObject(nativeConditionFactory);
                }
            }

            return(new SearchCondition(result));
        }
        /// <summary>
        /// Creates a condition node that is a logical conjunction ("AND") or disjunction ("OR") 
        /// of a collection of subconditions.
        /// </summary>
        /// <param name="conditionType">The SearchConditionType of the condition node. 
        /// Must be either AndCondition or OrCondition.</param>
        /// <param name="simplyfy">TRUE to logically simplify the result, if possible; 
        /// then the result will not necessarily to be of the specified kind. FALSE if the result should 
        /// have exactly the prescribed structure. An application that plans to execute a query based on the 
        /// condition tree would typically benefit from setting this parameter to TRUE. </param>
        /// <param name="conditionNodes">Array of subconditions</param>
        /// <returns>New SearchCondition based on the operation</returns>
        public static SearchCondition CreateAndOrCondition(SearchConditionType conditionType, bool simplyfy, params SearchCondition[] conditionNodes)
        {
            // Same as the native "IConditionFactory:MakeAndOr" method
            IConditionFactory nativeConditionFactory = (IConditionFactory)new ConditionFactoryCoClass();
            ICondition result = null;

            try
            {
                //
                List<ICondition> conditionList = new List<ICondition>();
                foreach (SearchCondition c in conditionNodes)
                    conditionList.Add(c.NativeSearchCondition);

                IEnumUnknown subConditions = new EnumUnknownClass(conditionList.ToArray());

                HRESULT hr = nativeConditionFactory.MakeAndOr(conditionType, subConditions, simplyfy, out result);

                if (!CoreErrorHelper.Succeeded((int)hr))
                    Marshal.ThrowExceptionForHR((int)hr);
            }
            finally
            {
                if (nativeConditionFactory != null)
                    Marshal.ReleaseComObject(nativeConditionFactory);
            }

            return new SearchCondition(result);
        }
示例#3
0
 public HResult Clone(out IEnumUnknown result)
 {
     result = new EnumUnknownClass(this.conditionList.ToArray());
     return HResult.Ok;
 }
示例#4
0
 public HRESULT Clone(out IEnumUnknown result)
 {
     result = new EnumUnknownClass(this.conditionList.ToArray());
     return HRESULT.S_OK;
 }
示例#5
0
 public HResult Clone(out IEnumUnknown result)
 {
     result = new EnumUnknownClass(this.conditionList.ToArray());
     return(HResult.Ok);
 }
示例#6
0
 public HRESULT Clone(out IEnumUnknown result)
 {
     result = new EnumUnknownClass(this.conditionList.ToArray());
     return(HRESULT.S_OK);
 }