public ISOGuidanceAllocation ExportGuidanceAllocation(GuidanceAllocation adaptGuidanceAllocation) { ISOGuidanceAllocation gan = new ISOGuidanceAllocation(); //Group ID gan.GuidanceGroupIdRef = TaskDataMapper.InstanceIDMap.GetISOID(adaptGuidanceAllocation.GuidanceGroupId); //Allocation Stamps if (adaptGuidanceAllocation.TimeScopes.Any()) { gan.AllocationStamp = AllocationStampMapper.ExportAllocationStamps(adaptGuidanceAllocation.TimeScopes).FirstOrDefault(); } //Guidance Shift if (adaptGuidanceAllocation.GuidanceShift != null) { GuidanceShiftMapper gstMapper = new GuidanceShiftMapper(TaskDataMapper); gan.GuidanceShifts = new List <ISOGuidanceShift>() { gstMapper.ExportGuidanceShift(adaptGuidanceAllocation.GuidanceShift) }; } return(gan); }
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); }
public IEnumerable <ISOGuidanceAllocation> ExportGuidanceAllocations(IEnumerable <GuidanceAllocation> adaptGuidanceAllocations) { List <ISOGuidanceAllocation> groups = new List <ISOGuidanceAllocation>(); foreach (GuidanceAllocation group in adaptGuidanceAllocations) { ISOGuidanceAllocation isoGroup = ExportGuidanceAllocation(group); groups.Add(isoGroup); } return(groups); }