S
SiJP
I am creating a new winforms project using Visual Studio 2005. The
project is converting a paper-based application form into an
electronic one.
I need help implementing a correct method for 'Business Rules'
validation.
The paper-based form has 50 fields that vary in their content (some
are yes/no options, some are numeric fields, others are one field
allowing multiple lines).
Each field can have several rules associated with it, for example:
Field_1
- Must be either "A1", "A2", "A3" or "A4"
- Cannot be A3 if Field_3 is 3 or 5
- This field cannot be left blank
Field_2
- Must not be completed if Field_1 is A1 or A2
- Can only be completed if Field_3 is 3 or greater
- The number in this field must be equal to Field_4 plus Field_3
minus 2 if Field_4 is less than 2
Field_3
- Must be between 1-10
- Cannot be left blank
- Cannot be greater than 5 if Field_4 is less than 2
....
These are slightly fictional (but fundamentally similar to the actual)
rules.
The data being captured needs to be validated locally on our clients'
PC, before being transmitted as an XML document to a service on our
webserver. Each field will have other formatting rules assiciated
with it (length, data types etc) and I'm not sure if these would be
considered part of the business rules or best dealt with from the UI.
(I don't particularly want to do what I use to do in vb6, which is to
create a rule for each after_update event of the field!!)
I would appreciate any help, but sample code would be awesome! (vb.net
or c#)
project is converting a paper-based application form into an
electronic one.
I need help implementing a correct method for 'Business Rules'
validation.
The paper-based form has 50 fields that vary in their content (some
are yes/no options, some are numeric fields, others are one field
allowing multiple lines).
Each field can have several rules associated with it, for example:
Field_1
- Must be either "A1", "A2", "A3" or "A4"
- Cannot be A3 if Field_3 is 3 or 5
- This field cannot be left blank
Field_2
- Must not be completed if Field_1 is A1 or A2
- Can only be completed if Field_3 is 3 or greater
- The number in this field must be equal to Field_4 plus Field_3
minus 2 if Field_4 is less than 2
Field_3
- Must be between 1-10
- Cannot be left blank
- Cannot be greater than 5 if Field_4 is less than 2
....
These are slightly fictional (but fundamentally similar to the actual)
rules.
The data being captured needs to be validated locally on our clients'
PC, before being transmitted as an XML document to a service on our
webserver. Each field will have other formatting rules assiciated
with it (length, data types etc) and I'm not sure if these would be
considered part of the business rules or best dealt with from the UI.
(I don't particularly want to do what I use to do in vb6, which is to
create a rule for each after_update event of the field!!)
I would appreciate any help, but sample code would be awesome! (vb.net
or c#)