Exemple #1
0
        public Period(string name, FiscalYear fiscalYear, DateTime startDate, DateTime endDate)
        {
            bool isNotInFiscalYear = startDate <fiscalYear.StartDate || endDate> fiscalYear.EndDate;

            if (fiscalYear.IsClosed)
            {
                throw new ApplicationException(@"Fiscal year " + fiscalYear.Code + " is closed");
            }

            if (_fiscalYear.IsPeriodOverlaps(startDate, endDate) || isNotInFiscalYear)
            {
                throw new ApplicationException(@"The period is invalid. Either some periods are overlapping or the period's dates are not matching the scope of the fiscal year.");
            }

            _name       = name;
            _fiscalYear = fiscalYear;
            _startDate  = startDate;
            _endDate    = endDate;

            _fiscalYear.RegisteredPeriod.Add(this);
        }
Exemple #2
0
 public Period(String code, FiscalYear fiscalYear, DateTime startDate, DateTime endDate) : base(code)
 {
     _fiscalYear = fiscalYear;
     _startDate  = startDate;
     _endDate    = endDate;
 }