コード例 #1
0
        private CodedComment LoadComment(XmlNode inputNode, out string commentId)
        {
            var comment = new CodedComment
            {
                Comment = new EnumeratedRepresentation()
            };

            // Required fields. Do not proceed if they are missing
            commentId = inputNode.GetXmlNodeValue("@A");
            comment.Comment.Description = inputNode.GetXmlNodeValue("@B");
            if (commentId == null || comment.Comment.Description == null)
            {
                return(null);
            }

            if (!LoadScope(inputNode.GetXmlNodeValue("@C"), comment))
            {
                return(null);
            }

            // Optional fields
            LoadListValues(inputNode.SelectNodes("CCL"), comment);

            _taskDocument.LoadLinkedIds(commentId, comment.Comment.Id);
            return(comment);
        }
コード例 #2
0
        private static void LoadListValues(XmlNodeList inputNodes, CodedComment comment)
        {
            foreach (XmlNode inputNode in inputNodes)
            {
                var valueId     = inputNode.GetXmlNodeValue("@A");
                var description = inputNode.GetXmlNodeValue("@B");

                if (string.IsNullOrEmpty(valueId) || string.IsNullOrEmpty(description))
                {
                    continue;
                }

                if (comment.Values == null)
                {
                    comment.Values = new Dictionary <string, EnumerationMember>();
                    comment.Comment.EnumeratedMembers = new List <EnumerationMember>();
                }

                var listValue = new EnumerationMember
                {
                    Value = description
                };

                comment.Comment.EnumeratedMembers.Add(listValue);
                comment.Values[valueId] = listValue;
            }
        }
コード例 #3
0
ファイル: CommentLoader.cs プロジェクト: ADAPT/ISOv4Plugin
        private static void LoadListValues(XmlNodeList inputNodes, CodedComment comment)
        {
            foreach (XmlNode inputNode in inputNodes)
            {
                var valueId = inputNode.GetXmlNodeValue("@A");
                var description = inputNode.GetXmlNodeValue("@B");

                if (string.IsNullOrEmpty(valueId) || string.IsNullOrEmpty(description))
                    continue;

                if (comment.Values == null)
                {
                    comment.Values = new Dictionary<string, EnumerationMember>();
                    comment.Comment.EnumeratedMembers = new List<EnumerationMember>();
                }

                var listValue = new EnumerationMember
                {
                    Value = description
                };

                comment.Comment.EnumeratedMembers.Add(listValue);
                comment.Values[valueId] = listValue;
            }
        }
コード例 #4
0
ファイル: CommentLoader.cs プロジェクト: ADAPT/ISOv4Plugin
        private static bool LoadScope(string scopeValue, CodedComment comment)
        {
            if (string.IsNullOrEmpty(scopeValue))
                return false;

            byte scope;
            if (!byte.TryParse(scopeValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out scope)
                || scope < 1 || scope > 3)
                return false;

            comment.Scope = scope;
            return true;
        }
コード例 #5
0
        private static bool LoadScope(string scopeValue, CodedComment comment)
        {
            if (string.IsNullOrEmpty(scopeValue))
            {
                return(false);
            }

            byte scope;

            if (!byte.TryParse(scopeValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out scope) ||
                scope < 1 || scope > 3)
            {
                return(false);
            }

            comment.Scope = scope;
            return(true);
        }
コード例 #6
0
ファイル: CommentLoader.cs プロジェクト: ADAPT/ISOv4Plugin
        private CodedComment LoadComment(XmlNode inputNode, out string commentId)
        {
            var comment = new CodedComment
            {
                Comment = new EnumeratedRepresentation()
            };

            // Required fields. Do not proceed if they are missing
            commentId = inputNode.GetXmlNodeValue("@A");
            comment.Comment.Description = inputNode.GetXmlNodeValue("@B");
            if (commentId == null || comment.Comment.Description == null)
                return null;

            if (!LoadScope(inputNode.GetXmlNodeValue("@C"), comment))
                return null;

            // Optional fields
            LoadListValues(inputNode.SelectNodes("CCL"), comment);

            _taskDocument.LoadLinkedIds(commentId, comment.Comment.Id);
            return comment;
        }