Example #1
0
        static internal object ToResponse(this ProjectItemStateChange stateChange, int position)
        {
            bool createFromTemplate = stateChange.Operation == ProjectItemOperation.CreateFromTemplate;

            var template = createFromTemplate ? ((Activity)stateChange.Template) : Activity.Empty;

            var activity = !createFromTemplate ? stateChange.ProjectItem : ProjectItem.Empty;

            return(new {
                operation = stateChange.Operation,
                uid = stateChange.UID,
                position,
                parentUID = stateChange.ParentStateChange != null ? stateChange.ParentStateChange.UID : String.Empty,
                level = stateChange.ItemLevel,

                name = createFromTemplate ? template.Name : (stateChange.Name ?? activity.Name),
                theme = createFromTemplate ? template.Theme : (stateChange.Theme ?? activity.Theme),
                notes = createFromTemplate ? template.Notes : (stateChange.Notes ?? activity.Notes),

                currentDeadline = !activity.IsEmptyInstance ? activity.Deadline : ExecutionServer.DateMaxValue,

                deadline = stateChange.Deadline,

                plannedEndDate = stateChange.PlannedEndDate,
                actualStartDate = stateChange.ActualStartDate,
                actualEndDate = stateChange.ActualEndDate,

                activityUID = !createFromTemplate ? activity.UID : String.Empty,
                projectUID = createFromTemplate ? stateChange.Project.UID : activity.Project.UID,
                templateUID = !template.IsEmptyInstance ? template.UID : String.Empty,
                matchResult = stateChange.ProcessMatchResult.ToString()
            });
        }
Example #2
0
 internal void SetData(ProjectItemStateChange stateChange)
 {
     if (stateChange.Name != null)
     {
         this.Name = stateChange.Name;
     }
     if (stateChange.Notes != null)
     {
         this.Notes = stateChange.Notes;
     }
     if (stateChange.Theme != null)
     {
         this.Theme = stateChange.Theme;
     }
 }