private EnumerationMember ImportCodedCommentListValue(ISOCodedCommentListValue listValue)
        {
            EnumerationMember member = new EnumerationMember();

            member.Value = listValue.CodedCommentListValueDesignator;
            return(member);
        }
        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);
        }
        private ISOCodedCommentListValue ExportCodedCommentListValue(EnumerationMember member)
        {
            ISOCodedCommentListValue value = new ISOCodedCommentListValue();

            value.CodedCommentListValueId         = GenerateId();
            value.CodedCommentListValueDesignator = member.Value;
            return(value);
        }
        public IEnumerable <ISOCodedCommentListValue> ExportCodedCommentList(IEnumerable <EnumerationMember> members)
        {
            List <ISOCodedCommentListValue> listValues = new List <ISOCodedCommentListValue>();

            foreach (EnumerationMember member in members)
            {
                ISOCodedCommentListValue listValue = ExportCodedCommentListValue(member);
                listValues.Add(listValue);
            }
            return(listValues);
        }