Пример #1
0
        private async Task <Tuple <Guid, Guid> > CreateWeeeReusedSite(AatfSiteDataAccess dataAccess, AatfAddress aatfAddress, DatabaseWrapper database)
        {
            var organisation = ObligatedWeeeIntegrationCommon.CreateOrganisation();
            var scheme       = ObligatedWeeeIntegrationCommon.CreateScheme(organisation);
            var aatf         = ObligatedWeeeIntegrationCommon.CreateAatf(database, organisation);
            var @return      = ObligatedWeeeIntegrationCommon.CreateReturn(organisation, database.Model.AspNetUsers.First().Id);

            database.WeeeContext.Organisations.Add(organisation);
            database.WeeeContext.Schemes.Add(scheme);
            database.WeeeContext.Aatfs.Add(aatf);
            database.WeeeContext.Returns.Add(@return);

            await database.WeeeContext.SaveChangesAsync();

            var weeeReused = new WeeeReused(aatf.Id, @return.Id);

            database.WeeeContext.WeeeReused.Add(weeeReused);
            foreach (var category in Enum.GetValues(typeof(WeeeCategory)).Cast <WeeeCategory>())
            {
                database.WeeeContext.WeeeReusedAmount.Add(new WeeeReusedAmount(weeeReused, (int)category, (int)category, (int)category + 1));
            }

            await database.WeeeContext.SaveChangesAsync();

            var weeeReusedSite = new WeeeReusedSite(weeeReused, aatfAddress);

            await dataAccess.Submit(weeeReusedSite);

            return(Tuple.Create(@return.Id, aatf.Id));
        }
Пример #2
0
        private static async Task CreateWeeeReusedAmounts(
            ObligatedReusedDataAccess obligatedReusedDataAccess,
            AatfSiteDataAccess aatfSiteDataAccess,
            Return @return,
            Aatf aatf,
            AatfAddress address)
        {
            var weeeReused = new WeeeReused(aatf.Id, @return.Id);

            var weeeReusedAmount = new List <WeeeReusedAmount>();

            foreach (var category in Enum.GetValues(typeof(WeeeCategory)).Cast <WeeeCategory>())
            {
                weeeReusedAmount.Add(new WeeeReusedAmount(weeeReused, (int)category, (int)category, (int)category + 1));
            }

            var weeeReusedSite = new WeeeReusedSite(weeeReused, address);

            await obligatedReusedDataAccess.Submit(weeeReusedAmount);

            await aatfSiteDataAccess.Submit(weeeReusedSite);
        }