Ejemplo n.º 1
0
 public static PartyRevenue AppsFindOrCreateAsDependable(ISession session, PartyProductRevenue dependant)
 {
     var partyRevenues = dependant.Party.PartyRevenuesWhereParty;
     partyRevenues.Filter.AddEquals(PartyRevenues.Meta.InternalOrganisation, dependant.InternalOrganisation);
     partyRevenues.Filter.AddEquals(PartyRevenues.Meta.Year, dependant.Year);
     partyRevenues.Filter.AddEquals(PartyRevenues.Meta.Month, dependant.Month);
     var partyRevenue = partyRevenues.First ?? new PartyRevenueBuilder(session)
                                                     .WithInternalOrganisation(dependant.InternalOrganisation)
                                                     .WithParty(dependant.Party)
                                                     .WithYear(dependant.Year)
                                                     .WithMonth(dependant.Month)
                                                     .WithCurrency(dependant.Currency)
                                                     .WithRevenue(0M)
                                                     .Build();
     return partyRevenue;
 }
Ejemplo n.º 2
0
 private static PartyProductRevenueHistory CreatePartyRevenueHistory(ISession session, PartyProductRevenue partyProductRevenue)
 {
     return new PartyProductRevenueHistoryBuilder(session)
                 .WithCurrency(partyProductRevenue.Currency)
                 .WithInternalOrganisation(partyProductRevenue.InternalOrganisation)
                 .WithParty(partyProductRevenue.Party)
                 .WithProduct(partyProductRevenue.Product)
                 .WithRevenue(0)
                 .WithQuantity(0)
                 .Build();
 }