.net layered design: return error code to forms indicating which controls have an error
Posted
by
David Casillas
on Stack Overflow
See other posts from Stack Overflow
or by David Casillas
Published on 2011-03-10T08:08:42Z
Indexed on
2011/03/10
8:10 UTC
Read the original article
Hit count: 293
.NET
|error-handling
Let's say I have a simple application. It tries to add a new entry to a database grabing the info from the user. The information is a tipical MasterDetail objetc like an invoice.
- The Invoice object used to collect the data has some simple atributes (Id, Date, etc...) and a List of InvoiceDetail, consisting of some simple atributes (invoiceId, productId, quantity, etc...)
- A form in the UI Layer collects the data from the user, creates an instance of Invoice and sends it to the Bussiness Layer.
- The Bussines layer sends the data to a Validation Module. If any error in the input is detected it has to return some kind of error code.
- The Bussiness Layer has to send the error code back to the Form to let the user correct the worng information.
I want the application to display some kind of warning (a different background color for example) in every form control with an error. ¿What's a good aproach to I manage the errors to be able to inform the form which controls are wrong? ¿Can I create an error object?¿Use delegates?.
I'm using VB.net but don't think this is relevant to the solution of the problem. P.D: Please suggest me some tags to this post.
© Stack Overflow or respective owner