예제 #1
0
        public BusinessObjects.WorkManagement.Job UpdateTasks(BusinessObjects.WorkManagement.Job targetJob, BusinessObjects.WorkManagement.EngineerFeedback feedback)
        {
            // Tasks
            ActivityTaskCollection activityTaskCollection = new ActivityTaskCollection();
            ActivityTask activityTask = null;

            /*
            foreach (TaskUpdate taskUpdate in feedback.Tasks)
            {
                if (targetJob.Tasks != null && targetJob.Tasks.Count > 0 && targetJob.Tasks.Find("ID", taskUpdate.ID) >= 0)
                {
                    // Update to existing Task
                    activityTask = targetJob.Tasks.Find(taskUpdate.ID);
                }
                else
                {
                    // Adding a new Task
                    activityTask = new ActivityTask();
                    activityTask.Description = taskUpdate.Comments[0].Text;
                }
                activityTask.IsComplete = taskUpdate.IsComplete;
                activityTask.IsDatabaseComplete = activityTask.IsComplete;
                activityTask.LastUpdatedDate = feedback.EndDateTime != null ? feedback.EndDateTime.Value : this.EndDateTime.Value;
                activityTaskCollection.Add(activityTask);
            }
            foreach (ActivityTask updatedActivityTask in activityTaskCollection)
            {
                if (updatedActivityTask.ID > 0)
                {
                    targetJob.Tasks.Replace(targetJob.Tasks.Find(updatedActivityTask.ID), updatedActivityTask);
                }
                else
                {
                    targetJob.Tasks.Add(updatedActivityTask);
                }
            }
            */

            foreach (TaskUpdate taskUpdate in feedback.Tasks)
            {
                activityTask = new ActivityTask();
                if (taskUpdate.ID <= 0)
                {
                    activityTask.Description = taskUpdate.Comments[0].Text;
                }
                activityTask.IsComplete = taskUpdate.IsComplete;
                activityTask.IsDatabaseComplete = activityTask.IsComplete;
                activityTask.LastUpdatedDate = feedback.EndDateTime != null ? feedback.EndDateTime.Value : this.EndDateTime.Value;

                activityTask.MaterialsRequired = taskUpdate.MaterialsUsed;
                activityTask.MeasurementsRequired = taskUpdate.MeasurementsTaken;
                
                activityTaskCollection.Add(activityTask);
            }
            targetJob.Tasks = activityTaskCollection;

            return targetJob;
        }
예제 #2
0
 public bool PredicateDelegate(ActivityTask memberObject)
 {
     return memberObject.Description.ToUpper() == _description.ToUpper();
 }