Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complex Design Problem
Message
 
 
To
07/05/2009 14:18:46
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01398420
Message ID:
01398430
Views:
58
>Is the price in the Inventory table related to the current selling price? IOW, if the price of an item change, do you change the Inventory price field? If so, my guess would be that you need to add a price field in the OrderDetails table to keep the original price (at the time of the purchase). You don't want an invoice that change with the fluctuations of the items prices.
>

I was thinking about it couple of days ago (or may be even weeks - lost count), but when I discussed this problem with my boss then, I think the answer was to not keep it there.

At the end of the day the orders are going to be added to the main database, so having price field in the OrderDetails is not mandatory.

However, it does present a complexity in the design, DS,TA, BL, so I guess I rather go ahead with the simpliest solution and add price into the OrderDetails.

Now, would my TA refresh or I would need to somehow change several methods?

Thanks again.

>>Ok, this would be a most complicated question for the day (or beginning of the day).
>>
>>Here is a method I'm duplicating:
>/// <summary>
>>        /// Get Order Subtotal
>>        ///     returns the subtotal of all items in a given order.
>>        /// </summary>
>>        /// <param name="dt"></param>
>>        /// <returns></returns>
>>        public decimal GetOrderSubTotal(OrderDetailsDS.OrderDetailsDataTable dt)
>>        {
>>            decimal subtotal = 0.00M;
>>            foreach (OrderDetailsDS.OrderDetailsRow  dr in dt.Rows)
>>            {
>>                if (!dr.RowState.Equals(DataRowState.Deleted) || !dr.RowState.Equals(DataRowState.Detached))
>>                {
>>                    subtotal += (dr.Qty  * (decimal)dr.); // not yet complete
>>                }
>>            }
>>
>>            return subtotal;
>>        }
>However, in my case the Price is in the Inventory table and I don't have it in OrderDetails. So, what should be my approach to take here?
>>
>>1. Add the Price field to the table OrderDetails?
>>
>>2. Somehow add this field from the Inventory related table into TA?
>>
>>3. On each record attempt to retrieve Price from another table?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform