Re: Business Rule Validation



This is probably way beyond what you were thinking about, but DI/IOC
containers like Spring.Net (or Windsor) have validation frameworks that just
are for this sort of thing.

These approaches are elaborate and would be overkill for a simple
application, but if you really want to learn about an interesting style, its
a great experience.

jeff

"SiJP" <simonpearson@xxxxxxxxx> wrote in message
news:1192462809.555300.77990@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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#)



.



Relevant Pages

  • Re: COBOL/DB2 Date edit question
    ... data types before update occurs. ... RDB; incompatibilities between language data types and RDB data types. ... The modern trend is to place the editing and validation into stored ... The user enters various fields on various screens. ...
    (comp.lang.cobol)
  • Re: Validation for DataGrid
    ... > How could I insert a validation for this. ... ErrorMessage="- you must provide a valid Integer Value" ... data types. ... It also gives you the advantage of performing both client side ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: n-Tier development
    ... Validation and business rules... ... You can also implement some "atomic" business rules that concern the entity ... You have a business rule in the MiddleTier ... DB Constraints ...
    (microsoft.public.dotnet.general)
  • RE: UI Validation in NTier
    ... Have you considered abstracting your business rules in some generic XML format that can the be edited at will for adding/removing rules, but that any tier can read and interpret as needed for their side, be it UI validation or server side validation. ... "Piers" wrote: ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: Validation Rule for field
    ... current application I am working with, there are some business rules that change validation rules for a field based on values in other fields. ... Steve Schapel, Microsoft Access MVP ...
    (microsoft.public.access.formscoding)