Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Using Business Rules Table

Reply
Thread Tools

Using Business Rules Table

 
 
sck10
Guest
Posts: n/a
 
      08-24-2006
Hello,

I need to create a Business Rules table that can be pulled into the web page
and use it as criteria for who should receive the approval email. For
example, I have created a travel request form that ask a series of
questions:

TravelType: Domestic or International
VisitType: (Customer, Internal Meeting, Seminar)
TravelCost

In my table I have the following:

TravelRules
------------
RuleNameID
Constraint01
ConstraintValue01
Constraint02
ConstraintValue02
ContactEmail

Below is an example of the rules that I would like to use. My question is
as follows:
1. Does my table structure seem feasible?
2. How do I add the rules to the web page and then use them with my data?

Also, the two constraints are used as an "AND" statement where the different
rows constitute an "OR" statement. So I would have to account for multiple
rules.

Any help with this would be appreciated, sck10


First row
---------
RuleNameID = Rule01
Constraint01 = TravelType
ConstraintValue01 = Domestic
Constraint02 = VisitType
ContactEmail = Customer
ContactEmail = http://www.velocityreviews.com/forums/(E-Mail Removed)


Second row
-------------
RuleNameID = Rule02
Constraint01 = TravelType
ConstraintValue01 = Domestic
Constraint02 = VisitType
ContactEmail = Internal Meeting
ContactEmail = (E-Mail Removed)


Second row
-------------
RuleNameID = Rule03
Constraint01 = TravelType
ConstraintValue01 = International
Constraint02 = TravelCost
ContactEmail = $3000
ContactEmail = (E-Mail Removed)






 
Reply With Quote
 
 
 
 
=?Utf-8?B?QXVndXN0aW4gUHJhc2FubmE=?=
Guest
Posts: n/a
 
      08-25-2006
Hi,

1) Table design seems perfect (i guess, you will be normalizing it).
2) I didn't get your second question.

Regards,
Augustin
http://augustinprasanna.blogspot.com

"sck10" wrote:

> Hello,
>
> I need to create a Business Rules table that can be pulled into the web page
> and use it as criteria for who should receive the approval email. For
> example, I have created a travel request form that ask a series of
> questions:
>
> TravelType: Domestic or International
> VisitType: (Customer, Internal Meeting, Seminar)
> TravelCost
>
> In my table I have the following:
>
> TravelRules
> ------------
> RuleNameID
> Constraint01
> ConstraintValue01
> Constraint02
> ConstraintValue02
> ContactEmail
>
> Below is an example of the rules that I would like to use. My question is
> as follows:
> 1. Does my table structure seem feasible?
> 2. How do I add the rules to the web page and then use them with my data?
>
> Also, the two constraints are used as an "AND" statement where the different
> rows constitute an "OR" statement. So I would have to account for multiple
> rules.
>
> Any help with this would be appreciated, sck10
>
>
> First row
> ---------
> RuleNameID = Rule01
> Constraint01 = TravelType
> ConstraintValue01 = Domestic
> Constraint02 = VisitType
> ContactEmail = Customer
> ContactEmail = (E-Mail Removed)
>
>
> Second row
> -------------
> RuleNameID = Rule02
> Constraint01 = TravelType
> ConstraintValue01 = Domestic
> Constraint02 = VisitType
> ContactEmail = Internal Meeting
> ContactEmail = (E-Mail Removed)
>
>
> Second row
> -------------
> RuleNameID = Rule03
> Constraint01 = TravelType
> ConstraintValue01 = International
> Constraint02 = TravelCost
> ContactEmail = $3000
> ContactEmail = (E-Mail Removed)
>
>
>
>
>
>
>

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      08-25-2006
Hi Steve,

Based on the table structure, I can get your business rules as below:

1. each rule record will define a travel request type and the final contact
(email)

2. each record row contains multiple constraint which will work together as
"AND" to detailedly define the rule

Currently, for your second question:

=========
2. How do I add the rules to the web page and then use them with my data?
===========

I'm wondering whether you're wantting to create a page for admin and manage
these rules or will create a page which create concrete travel requests
but will refer to this table?

If convenient, would you provide some further information such as what will
be presented on the page UI and how will the user interact with the page to
finish a task.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.




 
Reply With Quote
 
sck10
Guest
Posts: n/a
 
      08-25-2006
Hi Steven,


After sleeping on it, I was wondering if the best way to handle this would
be to have the actual code in the table?

For example, on my webpage, I have the hidden variables:
hdnTravelType
hdnTravelReason
hdnApproverEmail


(Please forgive my c# I'm still more comfortable with vb)

So, in the database I would store the following:

TravelRules
------------
RuleNameID
Constraint


row 01: if (this.hdnTravelType.value == "Domestic" ||
this.hdnTravelReason.value == "Customer Visit") this.hdnApproverEmail =
"(E-Mail Removed)";

row 02: if (this.hdnTravelType.value == "Domestic" ||
this.hdnTravelReason.value != "Customer Visit") this.hdnApproverEmail =
"(E-Mail Removed)";

row 03: if (this.hdnTravelType.value == "International")
this.hdnApproverEmail = "(E-Mail Removed)";

In my CodeBehind, I would call the stored procedure and read each record
(below). So my question is, as the DataReader reads each record, how can it
execute each "if statement"?

Thanks again, sck10

....

using (OleDbDataReader spRules = cmdSearch.ExecuteReader())
{
if (spRules.HasRows)
{
while (spRules.Read())
{
if (spRules["Constraint"].ToString() != null) Execute the if
statements from the database;

} //Loop
} //End if
} //End Using






"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Steve,
>
> Based on the table structure, I can get your business rules as below:
>
> 1. each rule record will define a travel request type and the final
> contact
> (email)
>
> 2. each record row contains multiple constraint which will work together
> as
> "AND" to detailedly define the rule
>
> Currently, for your second question:
>
> =========
> 2. How do I add the rules to the web page and then use them with my data?
> ===========
>
> I'm wondering whether you're wantting to create a page for admin and
> manage
> these rules or will create a page which create concrete travel requests
> but will refer to this table?
>
> If convenient, would you provide some further information such as what
> will
> be presented on the page UI and how will the user interact with the page
> to
> finish a task.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
>
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      08-28-2006
Thanks for your reply Steve,

I'm afraid the idea of "storing the complete rule detection and processing
code in database and execute it dynamically after reading them from
database" is not supported due to the net framework exeution model. We can
not dynamically compile and execute a discretionary code fragment. IMO, a
more proper approach is defing a component/helper class which provide some
helper methods to parse the text based rules(read from database) and
execute the proper code to maniplate controls and values in page. for
example:

public class HelperClass
{

public void ProcessByRules(string rule, control ctrl1, control ctrl2 ....)
{
if( ....)

if (....)

or

switch(...)
{
case...

case...

}
}

}


How do you think of this? Anyway, we need to let our program code accept
some more understandable identity or values (to represent the rules) so
that it is easier to process the page in code. Please let me know if you
have any other consideration or ideas.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
sck10
Guest
Posts: n/a
 
      08-28-2006
Thanks Steven,

I'll follow your example...


"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks for your reply Steve,
>
> I'm afraid the idea of "storing the complete rule detection and processing
> code in database and execute it dynamically after reading them from
> database" is not supported due to the net framework exeution model. We can
> not dynamically compile and execute a discretionary code fragment. IMO, a
> more proper approach is defing a component/helper class which provide some
> helper methods to parse the text based rules(read from database) and
> execute the proper code to maniplate controls and values in page. for
> example:
>
> public class HelperClass
> {
>
> public void ProcessByRules(string rule, control ctrl1, control ctrl2
> ....)
> {
> if( ....)
>
> if (....)
>
> or
>
> switch(...)
> {
> case...
>
> case...
>
> }
> }
>
> }
>
>
> How do you think of this? Anyway, we need to let our program code accept
> some more understandable identity or values (to represent the rules) so
> that it is easier to process the page in code. Please let me know if you
> have any other consideration or ideas.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rules for Cisco PIX 525 firewall rules KAS Cisco 2 10-02-2005 07:12 PM
[ANN] DynamicDOM APIs for XRules Business Rules Waleed Abdulla XML 0 06-01-2005 06:22 AM
EJB - integrity (business) rules implementation (like unique) hab Java 3 03-18-2005 01:52 PM
Business Rules & Referential Integrity Paul Johnson ASP .Net 0 11-20-2004 04:41 PM
Complex validation of business rules possible with XML Schema? Any other validation "languages"? Mike XML 1 11-21-2003 07:27 PM



Advertisments