Click here to Skip to main content
16,019,614 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,

I am having an orderCollection which is bound with the dataGridView.So when I update the order Qty in the dataGrid it should be validated (let suppose order Qty should not be more than 100).

so how I can write a separate business Rule class and associate with collection to trigger the rule while user updates the Qty.

My question is here how I can handle the Business Object, Business Object Collection, Business Object Rules in the business Layer.

Please give me one example if you could........


Thanks
Posted
Updated 3-Jun-10 20:34pm
v2

3-Tier Architecture in ASP.NET with C#[^]
The article explains you how to create application using n-tier architecture with an example. Go through it.

Hope this helps!
 
Share this answer
 
Comments
dan!sh 4-Jun-10 3:34am    
It is a windows form based application since OP said he is using DataGridView. Although the link should give an idea on how to implement similar thing in a windows forms based application.
You can make use of the CellValidating event of the DataGridView. Handle it to call the business layer method that would do the validation and return the result.
 
Share this answer
 
Comments
Ankur\m/ 4-Jun-10 3:44am    
I am sorry, I didn't realize that. I was more focused in giving him an example of an application using n-tier architecture.
Thanks! :)
rajeshswami27 4-Jun-10 3:59am    
Thanks D@nish

I have got a broad idea through your comments.

it will be greatly appreciated if you can give me an outline/structure of handing the business layer with an Object Class, Object Collection and mostly the Business Rule.

for business rule can we add propertlyChanged event to handle the business Rule.
Here is my new reply based on your comment. You should have a class ( a data transfer object) in a separate project which should be used by all the layers to share the data around.

Now, you need two things:

1. When the user changes the value in the DataGridView, send across a string to your business layer to validate it.

2. When the user opts for something like save after he is done with the edits, send across the data source i.e. the DTO back to the business for it can validate the object.

Any example for a 3-tier architecture with the use of DTOs would be very helpful for you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900