public void SortChildrenRecursive()
            {
                // We sort by display name
                ChildNodes.Sort((First, Second) => FStreamInfo.GlobalInstance.NameArray[First.NameIndex].CompareTo(FStreamInfo.GlobalInstance.NameArray[Second.NameIndex]));
                ChildTags.Sort((First, Second) => FStreamInfo.GlobalInstance.NameArray[First.NameIndex].CompareTo(FStreamInfo.GlobalInstance.NameArray[Second.NameIndex]));

                foreach (var ChildNode in ChildNodes)
                {
                    ChildNode.SortChildrenRecursive();
                }
            }
Beispiel #2
0
        public override bool IsCondition(AbstractRequestContext context)
        {
            var matched = ChildTags.Sum(childTag => childTag.IsCondition(context) ? 1 : 0);

            if (Min.HasValue)
            {
                if (matched < Min)
                {
                    throw new TagMinMatchedFailException(this, matched);
                }
            }
            return(matched > 0);
        }
Beispiel #3
0
        public override void BuildSql(AbstractRequestContext context)
        {
            var matchedTag = ChildTags.FirstOrDefault(tag =>
            {
                if (tag is Case caseTag)
                {
                    return(caseTag.IsCondition(context));
                }
                return(false);
            }) ?? ChildTags.FirstOrDefault(tag => tag is Default);

            matchedTag?.BuildSql(context);
        }
Beispiel #4
0
        private ITag GetMatchedTag(AbstractRequestContext context)
        {
            var matchedTag = ChildTags.FirstOrDefault(tag =>
            {
                if (tag is Case caseTag)
                {
                    return(caseTag.IsCondition(context));
                }

                return(false);
            }) ?? ChildTags.FirstOrDefault(tag => tag is Default);

            return(matchedTag);
        }
Beispiel #5
0
        public override void BuildSql(RequestContext context)
        {
            var matchedTag = ChildTags.FirstOrDefault(tag =>
            {
                if (tag.Type == TagType.SwitchCase)
                {
                    var caseTag = tag as Case;
                    return(caseTag.IsCondition(context));
                }
                return(false);
            });

            if (matchedTag == null)
            {
                matchedTag = ChildTags.FirstOrDefault(tag => tag.Type == TagType.SwitchDefault);
            }
            if (matchedTag != null)
            {
                matchedTag.BuildSql(context);
            }
        }
Beispiel #6
0
        public override string BuildSql(RequestContext context)
        {
            var matchedTag = ChildTags.FirstOrDefault(tag =>
            {
                if (tag.Type == TagType.SwitchCase)
                {
                    var caseTag = tag as Case;
                    return(caseTag.IsCondition(context, context.RequestParameters));
                }
                return(false);
            });

            if (matchedTag == null)
            {
                matchedTag = ChildTags.FirstOrDefault(tag => tag.Type == TagType.SwitchDefault);
            }
            if (matchedTag != null)
            {
                return(matchedTag.BuildSql(context));
            }
            return(String.Empty);
        }
Beispiel #7
0
        public override bool IsCondition(AbstractRequestContext context)
        {
            bool passed  = false;
            var  matched = ChildTags.Sum(childTag =>
            {
                if (childTag is SqlText)
                {
                    passed = true;
                    return(0);
                }
                return(childTag.IsCondition(context) ? 1 : 0);
            });

            if (Min.HasValue)
            {
                if (matched < Min)
                {
                    throw new TagMinMatchedFailException(this, matched);
                }
            }
            return(passed || matched > 0);
        }
 void RegisterChildTag(int InChildNameIndex, FNode InChild)
 {
     ChildTags.Add(InChild);
     ChildTagsByNameMap.Add(InChildNameIndex, InChild);
 }
 public FluentTagBuilder AddChild(FluentTagBuilder childTag)
 {
     ChildTags.Add(childTag);
     return(this);
 }