예제 #1
0
        public DataReturnVersion CreateDataReturnVersion(Scheme scheme, int complianceYear, int quarter, bool isSubmitted = true, DataReturn dataReturn = null, WeeeCollectedReturnVersion weeeCollectedReturnVersion = null)
        {
            if (dataReturn == null)
            {
                dataReturn = GetOrCreateDataReturn(scheme, complianceYear, quarter);
            }

            Guid dataReturnVersionId = IntegerToGuid(GetNextId());

            var dataReturnVersion = new DataReturnVersion
            {
                Id           = dataReturnVersionId,
                DataReturn   = dataReturn,
                DataReturnId = dataReturn.Id,
                CreatedDate  = DateTime.UtcNow
            };

            if (isSubmitted)
            {
                dataReturnVersion.SubmittedDate       = DateTime.UtcNow;
                dataReturnVersion.SubmittingUserId    = GetOrCreateUser("Testuser").Id;
                dataReturn.CurrentDataReturnVersionId = dataReturnVersionId;
                dataReturn.CurrentDataReturnVersion   = dataReturnVersion;
            }

            if (weeeCollectedReturnVersion != null)
            {
                dataReturnVersion.WeeeCollectedReturnVersion = weeeCollectedReturnVersion;
            }

            model.DataReturnVersions.Add(dataReturnVersion);

            return(dataReturnVersion);
        }
예제 #2
0
        public DataReturnUpload CreateDataReturnUpload(Scheme scheme, DataReturnVersion dataReturnVersion = null)
        {
            int dataReturnUploadId            = GetNextId();
            DataReturnUpload dataReturnUpload = new DataReturnUpload
            {
                Id          = IntegerToGuid(dataReturnUploadId),
                SchemeId    = scheme.Id,
                Scheme      = scheme,
                Data        = string.Format("<SchemeReturn{0} />", dataReturnUploadId),
                Date        = DateTime.UtcNow,
                ProcessTime = TimeSpan.Zero
            };

            if (dataReturnVersion != null)
            {
                dataReturnUpload.DataReturnVersionId = dataReturnVersion.Id;
                dataReturnUpload.DataReturnVersion   = dataReturnVersion;

                if (dataReturnVersion.DataReturn != null)
                {
                    dataReturnUpload.ComplianceYear = dataReturnVersion.DataReturn.ComplianceYear;
                    dataReturnUpload.Quarter        = dataReturnVersion.DataReturn.Quarter;
                }
            }

            model.DataReturnUploads.Add(dataReturnUpload);

            return(dataReturnUpload);
        }
예제 #3
0
        public EeeOutputAmount CreateEeeOutputAmount(DataReturnVersion dataReturnVersion, RegisteredProducer registeredProducer, string obligationType, int weeeCategory, decimal tonnage)
        {
            var eeeOutputAmount = CreateEeeOutputAmount(registeredProducer, obligationType, weeeCategory, tonnage);

            AddEeeOutputAmount(dataReturnVersion, eeeOutputAmount);

            return(eeeOutputAmount);
        }
예제 #4
0
        public void AddWeeeDeliveredAmount(DataReturnVersion dataReturnVersion, WeeeDeliveredAmount weeeDeliveredAmount)
        {
            if (dataReturnVersion.WeeeDeliveredReturnVersion == null)
            {
                dataReturnVersion.WeeeDeliveredReturnVersion = CreateWeeeDeliveredReturnVersion();
            }

            AddWeeeDeliveredAmount(dataReturnVersion.WeeeDeliveredReturnVersion, weeeDeliveredAmount);
        }
예제 #5
0
        public void AddEeeOutputAmount(DataReturnVersion dataReturnVersion, EeeOutputAmount eeeOutputAmount)
        {
            if (dataReturnVersion.EeeOutputReturnVersion == null)
            {
                dataReturnVersion.EeeOutputReturnVersion = CreateEeeOutputReturnVersion();
            }

            AddEeeOutputAmount(dataReturnVersion.EeeOutputReturnVersion, eeeOutputAmount);
        }
예제 #6
0
        public WeeeCollectedAmount CreateWeeeCollectedAmount(DataReturnVersion dataReturnVersion, string obligationType, int weeeCategory, decimal tonnage)
        {
            var weeeCollectedAmount = new WeeeCollectedAmount
            {
                Id             = IntegerToGuid(GetNextId()),
                ObligationType = obligationType,
                Tonnage        = tonnage,
                WeeeCategory   = weeeCategory
            };

            AddWeeeCollectedAmount(dataReturnVersion, weeeCollectedAmount);

            return(weeeCollectedAmount);
        }
예제 #7
0
        public WeeeDeliveredAmount CreateWeeeDeliveredAmount(DataReturnVersion dataReturnVersion, AeDeliveryLocation location, string obligationType, int weeeCategory, decimal tonnage)
        {
            var weeeDeliveredAmount = new WeeeDeliveredAmount
            {
                Id = IntegerToGuid(GetNextId()),
                AeDeliveryLocationId = location.Id,
                AeDeliveryLocation   = location,
                ObligationType       = obligationType,
                Tonnage      = tonnage,
                WeeeCategory = weeeCategory
            };

            AddWeeeDeliveredAmount(dataReturnVersion, weeeDeliveredAmount);

            return(weeeDeliveredAmount);
        }
예제 #8
0
        public WeeeDeliveredAmount CreateWeeeDeliveredAmount(DataReturnVersion dataReturnVersion, AeDeliveryLocation location, string obligationType, int weeeCategory, decimal tonnage)
        {
            var weeeDeliveredAmount = new WeeeDeliveredAmount
            {
                Id = IntegerToGuid(GetNextId()),
                AeDeliveryLocationId = location.Id,
                AeDeliveryLocation = location,
                ObligationType = obligationType,
                Tonnage = tonnage,
                WeeeCategory = weeeCategory
            };

            AddWeeeDeliveredAmount(dataReturnVersion, weeeDeliveredAmount);

            return weeeDeliveredAmount;
        }
예제 #9
0
        public void AddWeeeDeliveredAmount(DataReturnVersion dataReturnVersion, WeeeDeliveredAmount weeeDeliveredAmount)
        {
            if (dataReturnVersion.WeeeDeliveredReturnVersion == null)
            {
                dataReturnVersion.WeeeDeliveredReturnVersion = CreateWeeeDeliveredReturnVersion();
            }

            AddWeeeDeliveredAmount(dataReturnVersion.WeeeDeliveredReturnVersion, weeeDeliveredAmount);
        }
예제 #10
0
        public WeeeCollectedAmount CreateWeeeCollectedAmount(DataReturnVersion dataReturnVersion, string obligationType, int weeeCategory, decimal tonnage)
        {
            var weeeCollectedAmount = new WeeeCollectedAmount
            {
                Id = IntegerToGuid(GetNextId()),
                ObligationType = obligationType,
                Tonnage = tonnage,
                WeeeCategory = weeeCategory
            };

            AddWeeeCollectedAmount(dataReturnVersion, weeeCollectedAmount);

            return weeeCollectedAmount;
        }
예제 #11
0
        public void AddEeeOutputAmount(DataReturnVersion dataReturnVersion, EeeOutputAmount eeeOutputAmount)
        {
            if (dataReturnVersion.EeeOutputReturnVersion == null)
            {
                dataReturnVersion.EeeOutputReturnVersion = CreateEeeOutputReturnVersion();
            }

            AddEeeOutputAmount(dataReturnVersion.EeeOutputReturnVersion, eeeOutputAmount);
        }
예제 #12
0
        public EeeOutputAmount CreateEeeOutputAmount(DataReturnVersion dataReturnVersion, RegisteredProducer registeredProducer, string obligationType, int weeeCategory, decimal tonnage)
        {
            var eeeOutputAmount = CreateEeeOutputAmount(registeredProducer, obligationType, weeeCategory, tonnage);
            AddEeeOutputAmount(dataReturnVersion, eeeOutputAmount);

            return eeeOutputAmount;
        }
예제 #13
0
        public DataReturnVersion CreateDataReturnVersion(Scheme scheme, int complianceYear, int quarter, bool isSubmitted = true, DataReturn dataReturn = null, WeeeCollectedReturnVersion weeeCollectedReturnVersion = null)
        {
            if (dataReturn == null)
            {
                dataReturn = GetOrCreateDataReturn(scheme, complianceYear, quarter);
            }

            Guid dataReturnVersionId = IntegerToGuid(GetNextId());

            var dataReturnVersion = new DataReturnVersion
            {
                Id = dataReturnVersionId,
                DataReturn = dataReturn,
                DataReturnId = dataReturn.Id,
                CreatedDate = DateTime.UtcNow
            };

            if (isSubmitted)
            {
                dataReturnVersion.SubmittedDate = DateTime.UtcNow;
                dataReturnVersion.SubmittingUserId = GetOrCreateUser("Testuser").Id;
                dataReturn.CurrentDataReturnVersionId = dataReturnVersionId;
                dataReturn.CurrentDataReturnVersion = dataReturnVersion;
            }

            if (weeeCollectedReturnVersion != null)
            {
                dataReturnVersion.WeeeCollectedReturnVersion = weeeCollectedReturnVersion;
            }

            model.DataReturnVersions.Add(dataReturnVersion);

            return dataReturnVersion;
        }
예제 #14
0
        public DataReturnUpload CreateDataReturnUpload(Scheme scheme, DataReturnVersion dataReturnVersion = null)
        {
            int dataReturnUploadId = GetNextId();
            DataReturnUpload dataReturnUpload = new DataReturnUpload
            {
                Id = IntegerToGuid(dataReturnUploadId),
                SchemeId = scheme.Id,
                Scheme = scheme,
                Data = string.Format("<SchemeReturn{0} />", dataReturnUploadId),
                Date = DateTime.UtcNow,
                ProcessTime = TimeSpan.Zero
            };

            if (dataReturnVersion != null)
            {
                dataReturnUpload.DataReturnVersionId = dataReturnVersion.Id;
                dataReturnUpload.DataReturnVersion = dataReturnVersion;

                if (dataReturnVersion.DataReturn != null)
                {
                    dataReturnUpload.ComplianceYear = dataReturnVersion.DataReturn.ComplianceYear;
                    dataReturnUpload.Quarter = dataReturnVersion.DataReturn.Quarter;
                }
            }

            model.DataReturnUploads.Add(dataReturnUpload);

            return dataReturnUpload;
        }