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); }
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 IEnumerable <ISOCommentAllocation> ExportCommentAllocations(IEnumerable <Note> adaptCommentAllocations) { List <ISOCommentAllocation> CommentAllocations = new List <ISOCommentAllocation>(); foreach (Note note in adaptCommentAllocations) { ISOCommentAllocation isoCommentAllocation = ExportCommentAllocation(note); CommentAllocations.Add(isoCommentAllocation); } return(CommentAllocations); }