public SnowProject(projectTree p) { this.Priority(p.priority); this.Risk(p.risk); this.State(p.state); this.CalculationType(p.calculation_type); this.ProjectName(p.short_description); this.PlannedStartDate(p.schedule_start_date); this.PlannedEndDate(p.schedule_end_date); this.ActualStartDate(p.start_date); this.ActualEndDate(p.end_date); if (ActualStartDate().value.IndexOf("YYYY-MM-DD") < 0 && ActualStartDate().value.Trim().Length > 0) { DateTime myStartDtm = DateTime.Parse(p.start_date); DateTime myNowDtm = DateTime.Now; if (myNowDtm > myStartDtm) { this.State(2); //Make Work-In-Progress; } } if (p.childtasks.Count > 0) { foreach (taskTree t in p.childtasks) { //Note: If child state is "WIP", then also applies to parent! var st = new SnowTask(t, this.ilevel + 1); this.ChildTasks.Add(st); if (Int32.Parse(st.State().value) > 1) { this.State(2); } } } }
public SnowTask(taskTree t, int argIlevel) { this.ilevel = argIlevel; this.Priority(t.priority); this.State(t.state); this.TaskName(t.short_description); this.Constraint(t.time_constraint); this.PlannedStartDate(t.schedule_start_date); this.PlannedEndDate(t.schedule_end_date); this.ActualStartDate(t.start_date); this.ActualEndDate(t.end_date); if (ActualStartDate().value.IndexOf("YYYY-MM-DD") < 0 && ActualStartDate().value.Trim().Length > 0) { DateTime myStartDtm = DateTime.Parse(t.start_date); DateTime myNowDtm = DateTime.Now; if (myNowDtm > myStartDtm) { State(2); //Make Work-In-Progress; } } if (t.childtasks.Count > 0) { foreach (taskTree ct in t.childtasks) { //Note: If child state is "WIP", then also applies to parent! var st = new SnowTask(ct, this.ilevel + 1); this.ChildTasks.Add(st); if (Int32.Parse(st.State().value) > 1) { this.State(2); } } } }