예제 #1
0
파일: GoalPanel.cs 프로젝트: nandub/DeOps
        private void UpdatePlanItems(GoalNode node)
        {
            PlanListItem ReselectPlanItem = null;

            if (PlanList.SelectedItems.Count > 0)
            {
                ReselectPlanItem = PlanList.SelectedItems[0] as PlanListItem;
            }

            PlanList.Items.Clear();


            if (node == null)
            {
                Selected = null;
                DelegateLink.Hide();
                PlanList.Columns[0].Text = "Plan";
                //splitContainer2.Panel1Collapsed = true;
                return;
            }

            Selected = node.Goal;


            // set delegate task vis
            if (Selected.Person == Core.UserID && Trust.HasSubs(Selected.Person, View.ProjectID))
            {
                DelegateLink.Show();
            }
            else
            {
                DelegateLink.Hide();
            }

            if (Selected.Person == Core.UserID)
            {
                AddItemLink.Show();
            }
            else
            {
                AddItemLink.Hide();
            }

            // name's Plan for <goal>

            PlanList.Columns[0].Text = Core.GetName(node.Goal.Person) + "'s Plan for " + node.Goal.Title;

            // set plan items
            OpPlan plan = Plans.GetPlan(Selected.Person, true);

            if (plan == null) // re-searched at during selection
            {
                return;
            }


            if (plan.ItemMap.ContainsKey(Head.Ident))
            {
                foreach (PlanItem item in plan.ItemMap[Head.Ident])
                {
                    if (item.BranchUp == Selected.BranchDown)
                    {
                        PlanListItem row = new PlanListItem(item);

                        if (ReselectPlanItem != null && item == ReselectPlanItem.Item)
                        {
                            row.Selected = true;
                        }

                        PlanList.Items.Add(row);
                        FormatTime(row);
                    }
                }
            }

            PlanList.Invalidate();
        }