Esempio n. 1
0
        public void Draw(RallyData data)
        {
            _data = data;

            Cursor.Current = Cursors.WaitCursor;

            InitializeBoxes(data.Sagas.Values);

            if (data.SagasOrder != null)
            {
                List <SagaFeature> ordered = new List <SagaFeature>();
                foreach (string fid in data.SagasOrder)
                {
                    SagaFeature sf = data.FindSaga(fid);
                    if (sf == null)
                    {
                        continue;
                    }
                    ordered.Add(sf);
                }
                DrawSagaFeatures(ordered);
            }
            else
            {
                DrawSagaFeatures(data.Sagas.Values);
            }

            DrawIterations(data.Iterations.Values);

            Cursor.Current = Cursors.Default;
        }
Esempio n. 2
0
        public void SetPredecessors(SagaFeature saga)
        {
            foreach (Story story in saga.Stories)
            {
                Braincase.GanttChart.Task storyTask;
                if (!Boxes.TryGetValue(story.FormattedID, out storyTask))
                {
                    continue;
                }

                _manager.Unrelate(storyTask);
            }

            foreach (Story story in saga.Stories)
            {
                Braincase.GanttChart.Task storyTask;
                if (!Boxes.TryGetValue(story.FormattedID, out storyTask))
                {
                    continue;
                }

                foreach (string pred in story.Predecessors)
                {
                    Braincase.GanttChart.Task predecessorTask;
                    if (!Boxes.TryGetValue(pred, out predecessorTask))
                    {
                        continue;
                    }
                    _manager.Relate(predecessorTask, storyTask);
                }
            }
        }
Esempio n. 3
0
        public static SagaFeature From(dynamic obj)
        {
            SagaFeature sf = new SagaFeature();

            try { sf.ObjectUUID = obj.ObjectUUID; }
            catch { }
            try { sf.FormattedID = obj.FormattedID; }
            catch { }
            try { sf.Name = obj.Name; }
            catch { }
            try { sf.Release = obj.Release._refObjectName; }
            catch { }
            try { sf.Owner = obj.Owner._refObjectName; }
            catch { }
            try
            {
                foreach (var tag in obj.Milestones._tagsNameArray)
                {
                    sf.Milestones.Add(tag.Name);
                }
            }
            catch { }

            return(sf);
        }
Esempio n. 4
0
        public static Dictionary <string, SagaFeature> QuerySagaFeatures(Query query, string projectObjectID)
        {
            Dictionary <string, SagaFeature> list = new Dictionary <string, SagaFeature>();

            var request = new Request("PortfolioItem/SagaFeature");

            request.Limit = 1000;
            //sagaRequest.Fetch = SagaFeature.Attributes;
            if (!string.IsNullOrEmpty(projectObjectID))
            {
                request.Project = "/project/" + projectObjectID;
            }
            if (query != null)
            {
                request.Query = query;
            }
            request.Order = "DragAndDropRank";
            QueryResult result = _rally.Query(request);

            if (result.TotalResultCount <= 0)
            {
                return(list);
            }

            foreach (var obj in result.Results)
            {
                SagaFeature sf = SagaFeature.From(obj);
                if (!string.IsNullOrEmpty(sf.ObjectUUID))
                {
                    list.Add(sf.ObjectUUID, sf);
                }
            }

            return(list);
        }
Esempio n. 5
0
        private void AddGridRow(SagaFeature sf)
        {
            int index = grid.Rows.Add();

            grid.Rows[index].Cells[0].Value = true;
            grid.Rows[index].Cells[1].Value = sf.FormattedID + ": " + sf.Name;
            grid.Rows[index].Tag            = sf.FormattedID;
        }
Esempio n. 6
0
        private void InitializeGrid(RallyData data)
        {
            grid.Rows.Clear();

            if (data.SagasOrder != null)
            {
                foreach (string id in data.SagasOrder)
                {
                    SagaFeature sf = data.FindSaga(id);
                    if (sf == null)
                    {
                        continue;
                    }
                    AddGridRow(sf);
                }
            }
            else
            {
                foreach (SagaFeature sf in data.Sagas.Values)
                {
                    AddGridRow(sf);
                }
            }
        }
Esempio n. 7
0
        private void DrawSagaFeature(SagaFeature saga)
        {
            Braincase.GanttChart.Task sagaBox;
            if (!Boxes.TryGetValue(saga.FormattedID, out sagaBox))
            {
                return;
            }

            _manager.Add(sagaBox);

            string tooltip = saga.Owner + " (" + saga.Release + ")";

            foreach (string stone in saga.Milestones)
            {
                tooltip += "(" + stone + ")";
            }
            _chart.SetToolTip(sagaBox, tooltip);

            if (saga.Stories.Count <= 0)
            {
                sagaBox.Name = sagaBox.Name + " (no children)";
                return;
            }

            if (saga.EndDate > _startDate)
            {
                SetBoxLength(sagaBox, saga.StartDate, saga.EndDate, new List <string>());
            }

            List <Story> ordered = saga.Stories.OrderBy(o => o.StartDate).ToList();
            List <Story> leafs   = new List <Story>();

            foreach (Story story in ordered)
            {
                if (story.ChildrenCount != 0)
                {
                    continue;
                }
                leafs.Add(story);
            }

            if (leafs.Count <= 0)
            {
                return;
            }

            DateTime min = leafs.First().StartDate;

            foreach (Story story in leafs)
            {
                Braincase.GanttChart.Task storyBox;
                if (!Boxes.TryGetValue(story.FormattedID, out storyBox))
                {
                    continue;
                }

                sagaBox.Children.Add(storyBox);
                DrawStory(story, storyBox);
            }

            SetPredecessors(saga);
        }
Esempio n. 8
0
        private void PlotProject()
        {
            string projectOID;

            if (!_projectOIDs.TryGetValue(comboBoxProject.Text, out projectOID))
            {
                return;
            }
            string projectName = Rally.QueryProjectName(projectOID);

            if (string.IsNullOrEmpty(projectName))
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            _data             = new RallyData();
            _data.ProjectName = projectName;
            List <Story>  orphans;
            List <string> sfUUIDs = Rally.QuerySagaFeatureUUIDsFromStories(projectOID, textBoxRelease.Text, out orphans);

            progressBar.Value = 20;
            _data.Sagas       = Rally.QuerySagaFeatures(Rally.GenerateQuery(sfUUIDs, "ObjectUUID"), string.Empty);
            progressBar.Value = 40;
            _data.Stories     = Rally.QueryStories(sfUUIDs, Query.Operator.Equals, "SagaFeature.ObjectUUID", string.Empty);
            Rally.QueryPredecessors(_data.Stories.Values);
            progressBar.Value = 80;

            _data.Iterations = Rally.QueryIterations(_data.Stories.Values);

            // this will populate tasks
            List <string> storyIDs = Story.GetObjectIDs(Story.GetLeafs(_data.Stories.Values, projectName));

            _data.Tasks = Rally.QueryTasks(storyIDs, Query.Operator.Equals, "WorkProduct.ObjectUUID", string.Empty);

            progressBar.Value = 90;

            _data.ReleaseDate = Rally.QueryReleaseDate(projectOID, textBoxRelease.Text);

            if (orphans.Count > 0)
            {
                SagaFeature sf = new SagaFeature {
                    ObjectUUID = "0", FormattedID = "0", Name = "Orphaned Stories"
                };
                sf.Stories.AddRange(orphans);
                _data.Sagas.Add("0", sf);
            }

            _data.Initialize(dateTimePicker1.Value);

            Form1 form = new Form1();

            form.Text = comboBoxProject.Text;
            form.Initialize(_data, dateTimePicker1.Value);
            form.Draw(new Filter());
            form.Show();

            progressBar.Value = 0;
            Cursor.Current    = Cursors.Default;
        }