コード例 #1
0
        // [[1, 250, 'Unscheduled'], [2, 54, 'Sprint 1'], [3, 20, 'Sprint Banana'], [4, 0, 'Sprint Cross Reference'], [5, 8, 'Sprint Sammy']]
        private List <object> CreateTaskHoursPerSprintJsonList(Product product, int currentSprintId)
        {
            List <object> taskHoursPerSprintJsonList = new List <object>();

            ScrumTimeEntities scrumTimeEntities   = new ScrumTimeEntities();
            TaskService       taskService         = new TaskService(scrumTimeEntities);
            decimal           unassignedTaskHours = taskService.GetUnassignedTaskHours(product.ProductId);

            CheckSetYAxisMax(unassignedTaskHours);
            List <object> unassignedHoursList = new List <object>();

            unassignedHoursList.Add(1);
            unassignedHoursList.Add(unassignedTaskHours);
            unassignedHoursList.Add("Unassigned");
            taskHoursPerSprintJsonList.Add(unassignedHoursList);
            Ticks.Add(" ");

            SprintService sprintService     = new SprintService(scrumTimeEntities);
            List <Sprint> mostRecentSprints = sprintService.GetMostRecentSprints(product.ProductId, currentSprintId, 4);
            int           index             = 2;

            foreach (Sprint recentSprint in mostRecentSprints)
            {
                List <object> sprintHoursList = new List <object>();
                sprintHoursList.Add(index);
                sprintHoursList.Add(CalculateHoursForSprint(recentSprint));
                sprintHoursList.Add(recentSprint.Name);
                taskHoursPerSprintJsonList.Add(sprintHoursList);
                Ticks.Add(" ");
                index++;
            }

            return(taskHoursPerSprintJsonList);
        }
コード例 #2
0
ファイル: SessionHelper.cs プロジェクト: collabsoft/ScrumTime
        public static void CreateFirstTimeDefaults(string username)
        {
            ScrumTimeEntities scrumTimeEntities = new ScrumTimeEntities();
            UserSetting       userSetting       = UserSettingService.GetUserSettingByUsername(scrumTimeEntities, username);

            if (userSetting == null)
            {
                // Load sample product id
                ProductService productService    = new ProductService(scrumTimeEntities);
                int            productIdOfSample = productService.GetProductIdOfSample();
                if (productIdOfSample > -1)
                {
                    SprintService sprintService     = new SprintService(scrumTimeEntities);
                    List <Sprint> mostRecentSprints = sprintService.GetMostRecentSprints(productIdOfSample, -1, 1);
                    if (mostRecentSprints.Count > 0 && mostRecentSprints[0] != null)
                    {
                        userSetting = new UserSetting()
                        {
                            CurrentProduct      = productIdOfSample,
                            CurrentSprint       = mostRecentSprints[0].SprintId,
                            LastMainTabSelected = 1,
                            Username            = username
                        };
                        scrumTimeEntities.AddToUserSettings(userSetting);
                        scrumTimeEntities.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
                    }
                }
            }
        }