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 IEnumerable <ISOWorkerAllocation> ExportWorkerAllocations(IEnumerable <PersonRole> adaptWorkerAllocations) { List <ISOWorkerAllocation> wans = new List <ISOWorkerAllocation>(); foreach (PersonRole role in adaptWorkerAllocations) { ISOWorkerAllocation wan = ExportWorkerAllocation(role); wans.Add(wan); } return(wans); }
public ISOWorkerAllocation ExportWorkerAllocation(PersonRole adaptWorkerAllocation) { ISOWorkerAllocation wan = new ISOWorkerAllocation(); //Worker ID wan.WorkerIdRef = TaskDataMapper.InstanceIDMap.GetISOID(adaptWorkerAllocation.PersonId); //Allocation Stamps if (adaptWorkerAllocation.TimeScopes.Any()) { wan.AllocationStamp = AllocationStampMapper.ExportAllocationStamps(adaptWorkerAllocation.TimeScopes).FirstOrDefault(); } return(wan); }