|
-
December 29th, 2014, 04:54 AM
#1
Obj.Orient. Structure question newbie/intermediate
Im Making a very simple vehicle renting program.
This is probably a simple question even if the text is a bit long.
I have made theese simple classes.
Vehicle, VehicleManager, VehicleForm with (Add/Remove buttons)
Customer, CustomerManager, CustomerForm(Add/Remove buttons)
Agreement, AgreementManager, AgreementForm(with Add/Remove buttons
one ComboBox with Customers and
one ComboBox with vehicles
(and 2 datepickers))
In AgreementManager I have 'private List<Agreement> _Agreements'
A very simple structure but....
I was planning to remove the customer in CustomerForm.
The problem comes up when I want to remove a customer that has an agreement.
This must be inhibited(Show error/informative message and all that) if the customer is found as a customer in the agreementlist witch resides in the AgreementManager class.
How can I look in this list from 'inside' the Customer form.
I cant just make another agreementamng. object, because making a new one will not have the agreements in it.
How should/can I access methods in AgreementManager from CustomerForm?
Alternatively I could have a boolean _HasAgreement in the Customer objekt, to prevent delete. But that seems like a rather primitive solution now that i am learning to use obejct orientation and ObjectLists and working with managers.
thanks
BlindNavigator
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|