protected void Page_Load(object sender, EventArgs e) { if (Global.GetRepository() == null) { Response.Redirect("Default.aspx"); } D2Repository repository = Global.GetRepository(); if (!repository.isD2Rest()) { NoteLabel2.ForeColor = Color.OrangeRed; NoteLabel2.Text = String.Format("The target repository '{0}' is NOT a D2 repository.", repository.Name); btnCreate.Enabled = false; return; } NoteLabel2.ForeColor = Color.LightGreen; NoteLabel2.Text = String.Format("The target repository '{0}' is a D2 repository.", repository.Name); }
protected void PopulateTaskGrid(D2Repository repository) { if (!repository.isD2Rest()) { NoteLabel.ForeColor = Color.OrangeRed; NoteLabel.Text = String.Format("The target repository '{0}' is NOT a D2 repository.", repository.Name); return; } NoteLabel.ForeColor = Color.LightGreen; NoteLabel.Text = String.Format("The target repository '{0}' is a D2 repository.", repository.Name); Feed <D2Task> taskFeed = repository.GetD2TaskList(); List <D2Task> tasks = ObjectUtil.getFeedAsList(taskFeed); StringBuilder taskStatus = new StringBuilder(); List <TaskProperties> taskProperties = new List <TaskProperties>(); foreach (D2Task task in tasks) { TaskProperties tp = new TaskProperties(); tp.Subject = task.TaskSubject; tp.Instructions = task.TaskInstructions; StringBuilder forwardTasks = new StringBuilder(); bool firstPass = true; foreach (String key in task.TaskRequirements.ForwardTasks.Keys) { if (firstPass) { firstPass = false; forwardTasks.Append(key); } else { forwardTasks.Append(", " + key); } } tp.forwardTasks = forwardTasks.ToString(); taskProperties.Add(tp); } taskGrid.DataSource = taskProperties; taskGrid.DataBind(); }