예제 #1
0
        /// <summary>
        /// Get global condition
        /// </summary>
        /// <param name="conditionFilter">Condition filter</param>
        /// <returns>Return global condition</returns>
        internal static GlobalCondition GetGlobalCondition(GlobalConditionFilter conditionFilter)
        {
            if (conditionFilter == null)
            {
                throw new EZNEWException("GlobalConditionFilter is null");
            }
            if (conditionFilter.EntityType == null)
            {
                throw new EZNEWException("GlobalConditionFilter.EntityType is null");
            }
            if (conditionFilter.OriginalQuery == null)
            {
                conditionFilter.OriginalQuery = Create();
                conditionFilter.OriginalQuery.SetEntityType(conditionFilter.EntityType);
            }
            GlobalCondition globalCondition = null;

            if (!GetGlobalConditionProxys.IsNullOrEmpty() && conditionFilter.OriginalQuery.AllowSetGlobalCondition())
            {
                foreach (var globalConditionProxy in GetGlobalConditionProxys)
                {
                    var nowGlobalCondition = globalConditionProxy(conditionFilter);
                    if (nowGlobalCondition?.Value == null)
                    {
                        continue;
                    }
                    if (globalCondition == null)
                    {
                        globalCondition = nowGlobalCondition;
                    }
                    else
                    {
                        globalCondition.Value = globalCondition.Value.AddQueryItem(nowGlobalCondition.AppendMethod, nowGlobalCondition.Value);
                    }
                }
            }
            return(globalCondition);
        }
예제 #2
0
        /// <summary>
        /// global condition filter
        /// </summary>
        /// <param name="conditionFilter">condition filter</param>
        /// <returns>filter result</returns>
        public static GlobalConditionFilterResult GlobalConditionFilter(GlobalConditionFilter conditionFilter)
        {
            if (conditionFilter == null)
            {
                throw new EZNEWException("GlobalConditionFilter is null");
            }
            if (conditionFilter.EntityType == null)
            {
                throw new EZNEWException("GlobalConditionFilter.EntityType is null");
            }
            if (conditionFilter.OriginQuery == null)
            {
                conditionFilter.OriginQuery = QueryFactory.Create();
                conditionFilter.OriginQuery.SetEntityType(conditionFilter.EntityType);
            }
            GlobalConditionFilterResult globalConditionResult = null;

            if (GetGlobalCondition != null && conditionFilter.OriginQuery.AllowSetGlobalCondition())
            {
                globalConditionResult = GetGlobalCondition(conditionFilter);
            }
            return(globalConditionResult);
        }
예제 #3
0
        /// <summary>
        /// Get global condition
        /// </summary>
        /// <param name="conditionFilter">Condition filter</param>
        /// <returns>Return global condition</returns>
        internal static GlobalCondition GetGlobalCondition(GlobalConditionFilter conditionFilter)
        {
            if (conditionFilter == null)
            {
                throw new EZNEWException("GlobalConditionFilter is null");
            }
            if (conditionFilter.EntityType == null)
            {
                throw new EZNEWException("GlobalConditionFilter.EntityType is null");
            }
            if (conditionFilter.OriginalQuery == null)
            {
                conditionFilter.OriginalQuery = Create();
                conditionFilter.OriginalQuery.SetEntityType(conditionFilter.EntityType);
            }
            GlobalCondition globalCondition = null;

            if (GetGlobalConditionProxy != null && conditionFilter.OriginalQuery.AllowSetGlobalCondition())
            {
                globalCondition = GetGlobalConditionProxy(conditionFilter);
            }
            return(globalCondition);
        }