Ejemplo n.º 1
0
        private void ResolvePropertyChanges(EntityCommitChange commitChanges)
        {
            AssignedMembersChangeViewModel = null;
            CommentsChangeViewModel        = null;
            ContentChangeViewModel         = null;
            TaskPriorityChangeViewModel    = null;
            TaskStateChangeViewModel       = null;

            foreach (var propertyChange in commitChanges.PropertyChanges)
            {
                switch (propertyChange.PropertyName)
                {
                case "Content":
                    ContentChangeViewModel =
                        new ContentChangeViewModel((string)propertyChange.OldValue,
                                                   (string)propertyChange.NewValue);
                    break;

                case "AssignedMembers":
                    AssignedMembersChangeViewModel =
                        new ProjectMembersChangeViewModel((IEnumerable <ProjectMember>)propertyChange.OldValue,
                                                          (IEnumerable <ProjectMember>)propertyChange.NewValue);
                    break;

                case "Priority":
                    TaskPriorityChangeViewModel =
                        new TaskPriorityChangeViewModel((TaskPriority)propertyChange.OldValue,
                                                        (TaskPriority)propertyChange.NewValue);
                    break;

                case "State":
                    TaskStateChangeViewModel =
                        new TaskStateChangeViewModel((string)propertyChange.OldValue,
                                                     (string)propertyChange.NewValue,
                                                     _taskStateQueryService);
                    break;

                case "Comments":
                    CommentsChangeViewModel =
                        new CommentsChangeViewModel((IEnumerable <string>)propertyChange.OldValue,
                                                    (IEnumerable <string>)propertyChange.NewValue);
                    break;

                default:
                    continue;
                }
            }
        }
Ejemplo n.º 2
0
 private void ResolvePropertyChanges(ProjectCommitChange commitChanges)
 {
     if (commitChanges.ProjectMembersChange != null)
     {
         ProjectMembersChangeViewModel =
             new ProjectMembersChangeViewModel((IEnumerable <ProjectMember>)commitChanges.ProjectMembersChange.OldValue,
                                               (IEnumerable <ProjectMember>)commitChanges.ProjectMembersChange.NewValue);
     }
     if (commitChanges.RemovedTasks.Any() || commitChanges.AddedTasks.Any())
     {
         TaskChangesViewModel = new TaskChangesViewModel(commitChanges.AddedTasks, commitChanges.RemovedTasks);
     }
     if (commitChanges.TaskStatesChange != null)
     {
         var orderedOld =
             ((IEnumerable <TaskState>)commitChanges.TaskStatesChange.OldValue).OrderBy(x => x.Position);
         var orderedNew =
             ((IEnumerable <TaskState>)commitChanges.TaskStatesChange.NewValue).OrderBy(x => x.Position);
         TaskStatesChangesViewModel = new TaskStatesChangesViewModel(orderedOld, orderedNew);
     }
 }