Esempio n. 1
0
        public DataReturn CreateDataReturn(Scheme scheme, int complianceYear, int quarter)
        {
            int dataReturnId = GetNextId();

            var dataReturn = new DataReturn
            {
                Id = IntegerToGuid(dataReturnId),
                Scheme = scheme,
                SchemeId = scheme.Id,
                Quarter = quarter,
                ComplianceYear = complianceYear
            };
            model.DataReturns.Add(dataReturn);

            return dataReturn;
        }
Esempio n. 2
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;
        }
Esempio n. 3
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);
        }