|
CustomerObject:
- has a Collection of Address objects
- has a Collection of Phone objects
Yup... :)
Customer c = Customer.GetCustomer(22);
List<Address> customerAddresses = c.GetAddresses();
Foreach(Address a in customerAddresses)
Console.WriteLine(a.Line1);
This would simply get customer 22 from the database for each of his
addresses, print address line one.
And how you expose the Collection is up to you, so if you still wantto have
"GetMailingAddress()" style methods you can.
GetMailingAddress would probably return a single address (the default,
or the one marked as mailing) given its name so you could do this too:
Order o = Order.GetOrder(12343);
Address shipAddress = o.ShipToAddress;
Customer c = o.Customer;
Address customerMailingAddress = c.MailingAddress;
if (shipAddress != customerMailingAddress)
//We're shipping to the non-default address
else
//We're shipping to the default address
-Walden
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.