예제 #1
0
        public void SetCurrentVersion(DataReturnVersion version)
        {
            Guard.ArgumentNotNull(() => version, version);

            if (version.DataReturn != this)
            {
                string errorMessage = "The specified data return version does not relate to this data return.";
                throw new InvalidOperationException(errorMessage);
            }

            CurrentVersion = version;
        }
예제 #2
0
        internal override void AddDataReturnVersion(DataReturnVersion dataReturnVersion)
        {
            var eeeOutputAmount = EeeOutputAmounts.FirstOrDefault();

            if (eeeOutputAmount != null &&
                dataReturnVersion != null)
            {
                ValidateEeeOutputAmountAndDataReturnVersion(eeeOutputAmount, dataReturnVersion);
            }

            base.AddDataReturnVersion(dataReturnVersion);
        }
        internal virtual void AddDataReturnVersion(DataReturnVersion dataReturnVersion)
        {
            Guard.ArgumentNotNull(() => dataReturnVersion, dataReturnVersion);

            var existingDataReturnVersion = DataReturnVersions.FirstOrDefault();

            if (existingDataReturnVersion != null &&
                dataReturnVersion.DataReturn != existingDataReturnVersion.DataReturn)
            {
                throw new InvalidOperationException("The data return version does not belong to the current data return");
            }

            DataReturnVersions.Add(dataReturnVersion);
        }
예제 #4
0
 public virtual void SetDataReturnVersion(DataReturnVersion returnVersion)
 {
     Guard.ArgumentNotNull(() => returnVersion, returnVersion);
     DataReturnVersion = returnVersion;
 }
예제 #5
0
        private static void ValidateEeeOutputAmountAndDataReturnVersion(EeeOutputAmount eeeOutputAmount, DataReturnVersion dataReturnVersion)
        {
            if (eeeOutputAmount.RegisteredProducer.Scheme.ApprovalNumber != dataReturnVersion.DataReturn.Scheme.ApprovalNumber)
            {
                string errorMesage = "The producer for the EEE output amount and the data return do not belong to the same scheme.";
                throw new InvalidOperationException(errorMesage);
            }

            if (eeeOutputAmount.RegisteredProducer.ComplianceYear != dataReturnVersion.DataReturn.Quarter.Year)
            {
                string errorMesage = "The producer for the EEE output amount and the data return do not have a matching compliance year.";
                throw new InvalidOperationException(errorMesage);
            }
        }