public GuidanceAllocation ImportGuidanceAllocation(ISOGuidanceAllocation isoGuidanceAllocation)
        {
            GuidanceAllocation adaptGuidanceAllocation = new GuidanceAllocation();

            //Group ID
            int?groupID = TaskDataMapper.InstanceIDMap.GetADAPTID(isoGuidanceAllocation.GuidanceGroupIdRef);

            if (groupID.HasValue)
            {
                adaptGuidanceAllocation.GuidanceGroupId = groupID.Value;
            }

            //Allocation Stamps
            if (isoGuidanceAllocation.AllocationStamp != null)
            {
                adaptGuidanceAllocation.TimeScopes = AllocationStampMapper.ImportAllocationStamps(new List <ISOAllocationStamp>()
                {
                    isoGuidanceAllocation.AllocationStamp
                }).ToList();
            }

            //Guidance Shift
            if (isoGuidanceAllocation.GuidanceShifts.Any())
            {
                GuidanceShiftMapper gstMapper = new GuidanceShiftMapper(TaskDataMapper);
                adaptGuidanceAllocation.GuidanceShift = gstMapper.ImportGuidanceShift(isoGuidanceAllocation.GuidanceShifts.First()); //Using first item only
            }

            return(adaptGuidanceAllocation);
        }
Пример #2
0
        public PersonRole ImportWorkerAllocation(ISOWorkerAllocation isoWorkerAllocation)
        {
            int?personID = TaskDataMapper.InstanceIDMap.GetADAPTID(isoWorkerAllocation.WorkerIdRef);

            if (personID.HasValue)
            {
                PersonRole adaptWorkerAllocation = new PersonRole();

                //Worker ID
                adaptWorkerAllocation.PersonId = personID.Value;

                //Allocation Stamps
                if (isoWorkerAllocation.AllocationStamp != null)
                {
                    adaptWorkerAllocation.TimeScopes = AllocationStampMapper.ImportAllocationStamps(new List <ISOAllocationStamp>()
                    {
                        isoWorkerAllocation.AllocationStamp
                    }).ToList();
                }

                return(adaptWorkerAllocation);
            }

            //If we can't map to a Person, no sense including a PersonRole
            return(null);
        }
        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);
        }