private MppResource GetResource(Mpxj.Resource resource, bool loadTasks) { MppResource returnResource = null; if (resource != null) { returnResource = new MppResource(); returnResource.Id = resource.ID.longValue(); returnResource.Name = resource.Name; returnResource.UniqueId = resource.UniqueID.longValue(); returnResource.Initials = resource.Initials; returnResource.Group = resource.Group; returnResource.Code = resource.Code; returnResource.MaterialLabel = resource.MaterialLabel; returnResource.Email = resource.EmailAddress; returnResource.StandardRate = String.Format("{1} / {0}", resource.StandardRate.Units, resource.StandardRate.Amount); returnResource.OvertimeRate = String.Format("{1} / {0}", resource.OvertimeRate.Units, resource.OvertimeRate.Amount); returnResource.Notes = resource.Notes; if (loadTasks) { GetAssignedTasks(resource, returnResource); } } return(returnResource); }
private void GetAssignedTasks(Resource resource, MppResource returnResource) { java.util.List tasksList = resource.TaskAssignments; ResourceAssignment task = null; for (int i = 0; i < tasksList.size(); i++) { task = tasksList.get(i) as ResourceAssignment; returnResource.Tasks.Add(GetTask(task.Task)); } }