コード例 #1
0
        public static List <IntervaloDTO> GenerateRanges()
        {
            List <IntervaloDTO> sprintRanges      = new List <IntervaloDTO>();
            DateTime            lastSprintEndDate = new DateTime(2022, 01, 05);
            int currentYear           = Convert.ToInt32(DateTime.Now.ToString("yyyy"));
            int sprintCountPerRelease = 6;
            int maxReleases           = 4;

            for (int release = 1; release <= maxReleases; release++)
            {
                for (int sprint = 1; sprint <= sprintCountPerRelease; sprint++)
                {
                    IntervaloDTO range = new IntervaloDTO
                    {
                        Name    = $"{currentYear} R{release}S{sprint}",
                        IniDate = lastSprintEndDate.AddDays(1),
                        EndDate = lastSprintEndDate.AddDays(14)
                    };

                    sprintRanges.Add(range);

                    lastSprintEndDate = range.EndDate;
                }
            }

            return(sprintRanges);
        }
コード例 #2
0
        private void BtnAddSprint_Click(object sender, EventArgs e)
        {
            try
            {
                IntervaloDTO range = new IntervaloDTO
                {
                    Name    = cbbSprintRanges.SelectedItem.ToString(),
                    IniDate = dtpIniDate.Value,
                    EndDate = dtpEndDate.Value
                };

                switch (fluxo)
                {
                case UtilDTO.NAVIGATION.DEVOPS:
                    SprintDevOpsDTO newSprint = new SprintDevOpsDTO()
                    {
                        Range     = range,
                        ImagePath = sprintImagePath
                    };

                    //Remove e adiciona para caso ele esteja atualizando os dados
                    sprintsDevOpsList.Remove(sprintsDevOpsList.Find(s => s.Range.Name == newSprint.Range.Name));
                    sprintsDevOpsList.Add(newSprint);
                    sprintsDevOpsList.Sort((x, y) => x.Range.Name.CompareTo(y.Range.Name));
                    break;

                case UtilDTO.NAVIGATION.VARIOS_RELATORIOS:
                    SprintDevDTO newDevSprint = new SprintDevDTO()
                    {
                        Range     = range,
                        ImagePath = sprintImagePath
                    };

                    //Remove e adiciona para caso ele esteja atualizando os dados
                    sprintsDevList.Remove(sprintsDevList.Find(s => s.Range.Name == newDevSprint.Range.Name));
                    sprintsDevList.Add(newDevSprint);
                    sprintsDevList.Sort((x, y) => x.Range.Name.CompareTo(y.Range.Name));

                    SprintSmDTO newSmSprint = new SprintSmDTO()
                    {
                        Range     = range,
                        ImagePath = sprintImagePath
                    };

                    //Remove e adiciona para caso ele esteja atualizando os dados
                    sprintsSmList.Remove(sprintsSmList.Find(s => s.Range.Name == newSmSprint.Range.Name));
                    sprintsSmList.Add(newSmSprint);
                    sprintsSmList.Sort((x, y) => x.Range.Name.CompareTo(y.Range.Name));
                    break;

                case UtilDTO.NAVIGATION.DEV:
                    SprintDevDTO newAdaptaionSprint = new SprintDevDTO()
                    {
                        Range     = range,
                        ImagePath = sprintImagePath
                    };

                    //Remove e adiciona para caso ele esteja atualizando os dados
                    sprintsDevList.Remove(sprintsDevList.Find(s => s.Range.Name == newAdaptaionSprint.Range.Name));
                    sprintsDevList.Add(newAdaptaionSprint);
                    sprintsDevList.Sort((x, y) => x.Range.Name.CompareTo(y.Range.Name));
                    break;

                case UtilDTO.NAVIGATION.SM:
                    SprintSmDTO newSmSprintToAdd = new SprintSmDTO()
                    {
                        Range     = range,
                        ImagePath = sprintImagePath
                    };

                    //Remove e adiciona para caso ele esteja atualizando os dados
                    sprintsSmList.Remove(sprintsSmList.Find(s => s.Range.Name == newSmSprintToAdd.Range.Name));
                    sprintsSmList.Add(newSmSprintToAdd);
                    sprintsSmList.Sort((x, y) => x.Range.Name.CompareTo(y.Range.Name));
                    break;

                default:
                    throw new NotImplementedException();
                }

                pbxSprintImage.Image = null;

                //atualizar a lista de sprints
                lsbSprints.Items.Remove(range.Name);
                lsbSprints.Items.Add(range.Name);

                sprintImagePath     = null;
                btnNextForm.Enabled = true;

                if (cbbSprintRanges.SelectedIndex < cbbSprintRanges.Items.Count - 1)
                {
                    cbbSprintRanges.SelectedIndex += 1;
                }

                ShowLog("Sprint adicionada com sucesso.");
            }
            catch (Exception ex)
            {
                txbResult.Text = $"Erro. {ex.Message}";
            }
        }