Re: Collection Class object enhancements
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Tue, 6 Jun 2006 11:08:35 -0500
"wb" <none> wrote
I have a collection class that I created to store LineItem objects of a<...>
shopping cart.
Inside my collection class I want to have something that tabulates the total<...>
of each item.
I also created a countNumberId function that takes the item Id (NC001) and<...>
will return the sum of quantity.
This works ok, but I think there might be a better way to accomplish this.
Suggestions?
It appears the collection is the shopping cart for one user. Since you know
you will want a tally of the individual items ordered, why not keep a list of
distinct items, instead of the line item scenareo. If they scan the same item
twice, it increments that item, rather than creating a new line item. etc...
When you return the Count, it should be the sum total of all items ordered.
There would be no need for the countNumberID function because every
different item would have its 'quantity ordered' already stored, easily available.
LFS
.
- Follow-Ups:
- References:
- Collection Class object enhancements
- From: wb
- Collection Class object enhancements
- Prev by Date: Re: Including Save As, Copy, Edit, etc into Program
- Next by Date: Re: Form1.Hide does not hide the form
- Previous by thread: Collection Class object enhancements
- Next by thread: Re: Collection Class object enhancements
- Index(es):
Relevant Pages
|