Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2005

Tip: Looking for answers? Try searching our database.

Architetural Decisions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruno Rodrigues - 11 Apr 2005 01:55 GMT
Hi,

 I'm on my way to my first OOP-for-real project in C#, and having some big
trouble with code architeture.

 I have four namespaces:
 - Layout
 - Info - Where I hold empty structs with business objects
 - DB - Where I fill my Info objects
 - Classes - Where I do all the business stuff with the return from DB

 A snapshot from my database:

 - Table Orders, Fields: ID, Date, ClientID
 - Table OrdersDetails, Fields: OrderID, ProductID, Price, Quant, Discount

 What I need, is to compute the total of an individual OrderDetail, and of
the entire order. I create this total fields with sum in sql, the fastest
way, and it's working nice.
 
 But... This calc is bussiness logic, and it should be in my "Classes"
namespace, isn't that right? Cause if I have some special discount to apply,
for example, I'm in trouble. But, the only way to do this logic in the
"Classes" namespace, is looping through each object of the collection I have
already created - this sucks.

 What concept I am misleading? What should I do?

Thanks in advance
Bruno Rodrigues.
Bonnie Berent [C# MVP] - 11 Apr 2005 02:03 GMT
Bruno,

I would keep the totaling in the database, as you already have it and just
use a Biz method if you need to calculate a discount (and yes, you'll have to
loop through stuff to do that).

~~Bonnie

> Hi,
>
[quoted text clipped - 26 lines]
> Thanks in advance
> Bruno Rodrigues.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.