public CollectionCalendarPeriod GetPeriod(CollectionPeriod collectionPeriod)
 {
     return(collectionPeriod == null
         ? null
         : _collectionPeriods
            .Single(d => d.CollectionPeriod == collectionPeriod));
 }
        public CollectionPeriod GetNextPeriod(CollectionPeriod period)
        {
            var nextPeriodDate = new DateTime(period.CalendarYear, period.CalendarMonth, 1).AddMonths(1);

            return
                (_collectionPeriods
                 .Single(d => d.CalendarMonth == nextPeriodDate.Month && d.CalendarYear == nextPeriodDate.Year));
        }
 public CollectionCalendarPeriod(CollectionPeriod collectionPeriod, byte calendarMonth, short calendarYear, DateTime openDate, DateTime censusDate, bool active, bool periodEndInProgress)
 {
     CollectionPeriod    = collectionPeriod;
     CalendarMonth       = calendarMonth;
     CalendarYear        = calendarYear;
     OpenDate            = openDate;
     CensusDate          = censusDate;
     Active              = active;
     PeriodEndInProgress = periodEndInProgress;
 }
        public void SetActive(CollectionPeriod collectionPeriod)
        {
            var collectionPeriodToActivate = _collectionPeriods.FirstOrDefault(x => x.AcademicYear == collectionPeriod.AcademicYear &&
                                                                               x.PeriodNumber == collectionPeriod.PeriodNumber);

            if (collectionPeriodToActivate == null)
            {
                return;
            }

            foreach (var collectionCalendarPeriod in _collectionPeriods)
            {
                collectionCalendarPeriod.SetActive(false);
            }

            collectionPeriodToActivate.SetActive(true);
        }
        public void SetActive(CollectionPeriod collectionPeriod)
        {
            var collectionPeriodToActivate = _collectionPeriods.FirstOrDefault(x => x.CollectionPeriod == collectionPeriod);

            if (collectionPeriodToActivate == null)
            {
                return;
            }

            foreach (var collectionCalendarPeriod in _collectionPeriods)
            {
                collectionCalendarPeriod.SetActive(false);
                collectionCalendarPeriod.SetPeriodEndInProgress(false);
            }

            collectionPeriodToActivate.SetActive(true);
        }