Exemplo n.º 1
0
        public void IterateGroup(Group group, DDGrp ddgroup, string msgType)
        {
            DataDictionary.CheckHasNoRepeatedTags(group);

            int lastField = 0;

            foreach (KeyValuePair <int, Fields.IField> kvp in group)
            {
                Fields.IField field = kvp.Value;
                if (lastField != 0 && field.Tag == lastField)
                {
                    throw new RepeatedTag(lastField);
                }
                CheckHasValue(field);

                if (!string.IsNullOrEmpty(this.Version))
                {
                    CheckValidFormat(field);

                    if (ShouldCheckTag(field))
                    {
                        CheckValidTagNumber(field.Tag);
                        CheckValue(field);

                        CheckIsInGroup(field, ddgroup, msgType);
                        CheckGroupCount(field, group, msgType);
                    }
                }
                lastField = field.Tag;
            }

            // check contents of each nested group
            foreach (int groupTag in group.GetGroupTags())
            {
                for (int i = 1; i <= group.GroupCount(groupTag); i++)
                {
                    Group g   = group.GetGroup(i, groupTag);
                    DDGrp ddg = ddgroup.GetGroup(groupTag);
                    IterateGroup(g, ddg, msgType);
                }
            }
        }
Exemplo n.º 2
0
        public void IterateGroup(Group group, DDGrp ddgroup, string msgType)
        {
            DataDictionary.CheckHasNoRepeatedTags(group);

            int lastField = 0;
            foreach(KeyValuePair<int, Fields.IField> kvp in group)
            {
                Fields.IField field = kvp.Value;
                if (lastField != 0 && field.Tag == lastField)
                    throw new RepeatedTag(lastField);
                CheckHasValue(field);

                if (null != this.Version && this.Version.Length > 0)
                {
                    CheckValidFormat(field);

                    if (ShouldCheckTag(field))
                    {
                        CheckValidTagNumber(field.Tag);
                        CheckValue(field);

                        CheckIsInGroup(field, ddgroup, msgType);
                        CheckGroupCount(field, group, msgType);
                    }
                }
                lastField = field.Tag;
            }

            // check contents of each nested group
            foreach (int groupTag in group.GetGroupTags())
            {
                for (int i = 1; i <= group.GroupCount(groupTag); i++)
                {
                    Group g = group.GetGroup(i, groupTag);
                    DDGrp ddg = ddgroup.GetGroup(groupTag);
                    IterateGroup(g, ddg, msgType);
                }
            }
        }