jake said:
Just an after-thought. How would you handle an occasion where more
than one combination total to the same price? I am actually curious
(not being sarcastic). Thanks.
As I generate the combinations, I put the price and the combo description,
i.e. "Crab/Shrimp", "55.49" into a Dictionary. I just check that for a dupe
before I insert any description/value combination into the DB.
Once that is done, I can easily call a stored procedure to do all the
inserts knowing that each value is unique.
However, one objective is that I need to flag all collisions of price. So
if I find a collision, where the prices are the same, yet the products are
different, I insert a record into a "collision" table that shows what
combo/price is causing the collision.
For example:
"Crab/Shrimp", 55.95
"Flounder/Shrimp", 55.95
The products that produce the price don't matter. What matters is that the
final price _needs_ to be unique. This would cause a record to be entered in
the Collisions table and also send out an email to the people that need to
fix this.
Management/finance people look at that table and make the cost changes to
prevent the collision. I cannot change the price of products. Gee I wish I
could ;-)
The current system here (at a BIG company that won't be named) is pretty
messed up.
Yeah, I know, the system is total crap. Why can't grouped offerings have
the same price? No big deal to me. However, it is a legacy problem from the
dude who built most of their "systems" when they were starting out as a small
subsidiary of a large corp.
The biggest challenge for me is that I _cannot_ kill the band-aid system
they have now. I have to add this feature and make sure it still works.
After that, I get to finally create a new system that can handle some basic
things like having product GROUPS with the same price. The previous guy
didn't use any primary keys, or even any indexes, so the only way to
_currently_ tell one product group from another is by the total price. Damn,
if the guy just knew about a primary key...
Jon provided some good stuff. After a few little tweaks, it is working well
(thanks again Jon).
Best,
AstroDrabb