Beispiel #1
0
        public void Iterate(FieldMap map, string msgType)
        {
            DataDictionary.CheckHasNoRepeatedTags(map);

            int lastField = 0;

            foreach (KeyValuePair <int, Fields.IField> kvp in map)
            {
                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);
                        if (!Message.IsHeaderField(field.Tag, this) && !Message.IsTrailerField(field.Tag, this))
                        {
                            CheckIsInMessage(field, msgType);
                            CheckGroupCount(field, map, msgType);
                        }
                    }
                }

                lastField = field.Tag;
            }
        }
        public void Iterate(FieldMap map, string msgType)
        {
            DataDictionary.CheckHasNoRepeatedTags(map);

            // check non-group fields
            int lastField = 0;

            foreach (KeyValuePair <int, Fields.IField> kvp in map)
            {
                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);
                        if (!Message.IsHeaderField(field.Tag, this) && !Message.IsTrailerField(field.Tag, this))
                        {
                            CheckIsInMessage(field, msgType);
                            CheckGroupCount(field, map, msgType);
                        }
                    }
                }
                lastField = field.Tag;
            }

            // check contents of each group
            foreach (int groupTag in map.GetGroupTags())
            {
                if (!Message.IsHeaderField(groupTag, this) && !Message.IsTrailerField(groupTag, this))
                {
                    for (int i = 1; i <= map.GroupCount(groupTag); i++)
                    {
                        Group g   = map.GetGroup(i, groupTag);
                        DDGrp ddg = this.Messages[msgType].GetGroup(groupTag);
                        IterateGroup(g, ddg, msgType);
                    }
                }
            }
        }
Beispiel #3
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);
                }
            }
        }