Exemple #1
0
        public static NextSection Next(ChangeOfCircs form, Sections completedSection)
        {
            var index = _order.IndexOf(completedSection) + 1;

            Sections?nextSection = null;

            while (!nextSection.HasValue && index < _order.Count)
            {
                var section = _order[index];

                if (!FeatureToggles.SkipWorkInProgressSection(section))
                {
                    var strategy = SectionStrategy.For(section);

                    if (strategy.Required(form))
                    {
                        nextSection = section;
                    }
                    else
                    {
                        strategy.SkipSection(form);
                    }
                }

                index++;
            }

            return(new NextSection
            {
                Id = form.Id,
                Section = nextSection,
            });
        }
Exemple #2
0
        public static void Populate(CocDetail detail, Sections section, ChangeOfCircs form)
        {
            var index = _order.IndexOf(section) - 1;

            while (index >= 0 && !detail.PreviousSection.HasValue)
            {
                var previousSection = _order[index];

                if (!FeatureToggles.SkipWorkInProgressSection(previousSection))
                {
                    var strategy = SectionStrategy.For(previousSection);

                    if (strategy.Required(form))
                    {
                        detail.PreviousSection = previousSection;
                    }
                }

                index--;
            }

            detail.IsFinalSection = (section == _order.Last());
        }