public JsonSprintBurnDown(int sprintId)
            : base()
        {
            Data = new List<object>();
            YAxisMin = 0;

            if (sprintId >= 0)
            {
                ScrumTimeEntities scrumTimeEntities = new ScrumTimeEntities();
                SprintService sprintService = new SprintService(scrumTimeEntities);
                Sprint sprint = sprintService.GetSprintById(sprintId);
                if (sprint != null && sprint.Scrums.Count() > 0)
                {
                    Data.Add(CreateIdealScrumTaskJsonList(sprint));
                    Data.Add(CreateScrumTaskJsonList(sprint));

                    XAxisMinDate = sprint.StartDate.ToString("MM/dd/yyyy");
                    XAxisMaxDate = sprint.FinishDate.ToString("MM/dd/yyyy");
                    YAxisMin = 0;

                    ScrumService scrumService = new ScrumService(scrumTimeEntities);
                    YAxisMax = scrumService.GetMaxTaskHourCountBySprintId(sprint.SprintId);
                }
                else
                    HandleBadSprint();
            }
            else
                HandleBadSprint();
        }
示例#2
0
 public ScrumController()
 {
     _ScrumTimeEntities = new ScrumTimeEntities();
     _ScrumService = new ScrumService(_ScrumTimeEntities);
 }
 //private List<object> HandleEmptyScrumList(s
 // [['08/03/2010', 51, '08/03/2010'], ['08/05/2010', 49, '08/05/2010']]
 private List<object> CreateScrumTaskJsonList(Sprint sprint)
 {
     ScrumService scrumService = new ScrumService(new ScrumTimeEntities());
     List<Scrum> scrums = scrumService.GetScrumsBySprintId(sprint.SprintId);
     List<object> scrumJsonList = new List<object>();
     foreach (Scrum scrum in scrums)
     {
         List<object> scrumDetailList = new List<object>();
         scrumDetailList.Add(scrum.DateOfScrum.ToString("MM/dd/yyyy"));
         scrumDetailList.Add(scrum.ScrumDetails.Sum(s => s.HoursRemaining));
         scrumDetailList.Add(scrum.DateOfScrum.ToString("MM/dd/yyyy"));
         scrumJsonList.Add(scrumDetailList);
     }
     return scrumJsonList;
 }