public Note ImportCommentAllocation(ISOCommentAllocation isoCommentAllocation)
        {
            Note adaptNote = new Note();

            //Allocation Stamps
            if (isoCommentAllocation.AllocationStamp != null && isoCommentAllocation.AllocationStamp.Start != null)
            {
                adaptNote.TimeStamps = AllocationStampMapper.ImportAllocationStamps(new List <ISOAllocationStamp>()
                {
                    isoCommentAllocation.AllocationStamp
                }).ToList();
            }

            //Coded Comment
            if (!string.IsNullOrEmpty(isoCommentAllocation.CodedCommentIdRef) && !string.IsNullOrEmpty(isoCommentAllocation.CodedCommentListValueIdRef))
            {
                ISOCodedComment          comment = ISOTaskData.ChildElements.OfType <ISOCodedComment>().FirstOrDefault(c => c.CodedCommentID == isoCommentAllocation.CodedCommentIdRef);
                ISOCodedCommentListValue value   = comment.CodedCommentListValues.FirstOrDefault(l => l.CodedCommentListValueId == isoCommentAllocation.CodedCommentListValueIdRef);
                if (comment != null)
                {
                    adaptNote.Description = comment.CodedCommentDesignator;
                    adaptNote.Value       = TaskDataMapper.CommentMapper.ImportCodedComment(comment);
                    adaptNote.Value.Value = adaptNote.Value.Representation.EnumeratedMembers.FirstOrDefault(m => m.Value == value.CodedCommentListValueDesignator);
                }
            }
            else
            {
                adaptNote.Description = isoCommentAllocation.FreeCommentText;
            }


            return(adaptNote);
        }
        public ISOCommentAllocation ExportCommentAllocation(Note note)
        {
            ISOCommentAllocation commentAllocation = new ISOCommentAllocation();

            if (note.Value == null)
            {
                commentAllocation.FreeCommentText = note.Description;
            }
            else
            {
                if (note.Value.Representation != null)
                {
                    ISOCodedComment          comment = TaskDataMapper.CommentMapper.ExportCodedComment(note.Value);
                    ISOCodedCommentListValue value   = comment.CodedCommentListValues.FirstOrDefault(c => c.CodedCommentListValueDesignator == note.Value.Value.Value);
                    if (value != null)
                    {
                        commentAllocation.CodedCommentListValueIdRef = value.CodedCommentListValueId;
                    }
                }
            }

            //Allocation Stamps
            if (note.TimeStamps.Any())
            {
                commentAllocation.AllocationStamp = AllocationStampMapper.ExportAllocationStamps(note.TimeStamps).FirstOrDefault();
            }

            return(commentAllocation);
        }
Пример #3
0
        public EnumeratedValue ImportCodedComment(ISOCodedComment comment)
        {
            EnumeratedValue value = new EnumeratedValue();

            value.Designator     = comment.CodedCommentDesignator;
            value.Representation = new EnumeratedRepresentation();
            value.Representation.EnumeratedMembers = _listMapper.ImportCodedCommentListValues(comment.CodedCommentListValues).ToList();
            return(value);
        }
Пример #4
0
        public ISOCodedComment ExportCodedComment(EnumeratedValue value)
        {
            ISOCodedComment comment = new ISOCodedComment();

            comment.CodedCommentID         = GenerateId();
            comment.CodedCommentDesignator = value.Representation.Description;
            comment.CodedCommentListValues = _listMapper.ExportCodedCommentList(value.Representation.EnumeratedMembers).ToList();
            ExportedComments.Add(comment);
            return(comment);
        }
Пример #5
0
        public IEnumerable <ISOCodedComment> ExportCodedComments(IEnumerable <EnumeratedValue> enumeratedValues)
        {
            List <ISOCodedComment> comments = new List <ISOCodedComment>();

            foreach (EnumeratedValue value in enumeratedValues)
            {
                ISOCodedComment isoCommentAllocation = ExportCodedComment(value);
                comments.Add(isoCommentAllocation);
            }

            return(comments);
        }