Esempio n. 1
0
        public PackageRevenue AppsFindOrCreateAsDependable(ISession session, PartyPackageRevenue dependant)
        {
            var packageRevenues = dependant.Package.PackageRevenuesWherePackage;
            packageRevenues.Filter.AddEquals(this.Meta.InternalOrganisation, dependant.InternalOrganisation);
            packageRevenues.Filter.AddEquals(this.Meta.Year, dependant.Year);
            packageRevenues.Filter.AddEquals(this.Meta.Month, dependant.Month);
            var packageRevenue = packageRevenues.First ?? new PackageRevenueBuilder(session)
                                                                .WithInternalOrganisation(dependant.InternalOrganisation)
                                                                .WithPackage(dependant.Package)
                                                                .WithYear(dependant.Year)
                                                                .WithMonth(dependant.Month)
                                                                .WithCurrency(dependant.Currency)
                                                                .WithRevenue(0M)
                                                                .Build();

            return packageRevenue;
        }
 private static PartyPackageRevenueHistory CreatePartyRevenueHistory(ISession session, PartyPackageRevenue partyPackageRevenue)
 {
     return new PartyPackageRevenueHistoryBuilder(session)
                 .WithCurrency(partyPackageRevenue.Currency)
                 .WithInternalOrganisation(partyPackageRevenue.InternalOrganisation)
                 .WithParty(partyPackageRevenue.Party)
                 .WithPackage(partyPackageRevenue.Package)
                 .WithRevenue(0)
                 .Build();
 }