Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 System Design database and business logic

Author  Topic 

cornall
Posting Yak Master

148 Posts

Posted - 2010-01-28 : 14:47:16
Hi,

I was wondering peoples opinion on the best way to tackel my problem.

I have a database table activity and table resource

e.g.



Activity ID Activity Name cost/hour
1 an activity 10
2 a n other activity N/A

Resource ID Resource Name cost/hour
1 an activity 10



Cost of an activity can be calculated in two ways

either

User selects an activity and enters I need x times activity y with productivity of z activities per hour giving cost

x/z * (cost) y

10/5 = 2 hours -> 2 * 10 = £20

or

User selects an activity and says resource x will do activity y for z hours

(cost) x * z

10 * 10 = £100

So I have my data and I ahve my bussiness logic

Question 1 is it a good idea to mix activities that have a fixed cost and are calculated by productivity in the same table as activities that have no price and are perfromed by resoures with a cost per hour?

Next question should I store the calculates values in SQL or calculate them on the fly evey time a quote is opened in the system?

If I should store them in the DB how should I structure my tables?

If not arguments why I should calculate on the fly.

Cheers D
   

- Advertisement -