I'm working on a bit of code that will involve two different bizobjs and I'm looking for suggestions on how to design the interaction (I can make it work, but I'd like to make it as "elegant" as possible).
Here's the scenario:
-Each invoice can have it's own set of rates.
-When a new invoice is create I copy the rates from a "master" table into an "InvoiceRates" table
-Each line in the invoice is linked to a record in the "InvoiceRates" table
-I have an object called LineRatesObj
-- This object has an AddRates() / DeleteRates() method that copies (from the "master")/deletes rates in the "InvoiceRates" table
- I have an InvoiceLinesObj
At some point, the user can decide to change the rates for the invoice. This would mean I'd have to AddRates() to the InvoiceRates table, DeleteRates() for the old set of rates, then relink the invoice lines to the new rates.
Which object should be resposible for this? Should I add a ChangeRates() method to my InvoiceLinesObj, then in there create an instance of LinesRatesObj and access it's methods (or do this in InvoiceLinesObj instead)? Either way seems "wrong" (although functional).
Is this a place where I should use an Event?