473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Using Business Rules Table

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 = fi***@my.com
Second row
-------------
RuleNameID = Rule02
Constraint01 = TravelType
ConstraintValue01 = Domestic
Constraint02 = VisitType
ContactEmail = Internal Meeting
ContactEmail = vp@my.com
Second row
-------------
RuleNameID = Rule03
Constraint01 = TravelType
ConstraintValue01 = International
Constraint02 = TravelCost
ContactEmail = $3000
ContactEmail = sv*@my.com


Aug 24 '06 #1
5 1525
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 = fi***@my.com
Second row
-------------
RuleNameID = Rule02
Constraint01 = TravelType
ConstraintValue01 = Domestic
Constraint02 = VisitType
ContactEmail = Internal Meeting
ContactEmail = vp@my.com
Second row
-------------
RuleNameID = Rule03
Constraint01 = TravelType
ConstraintValue01 = International
Constraint02 = TravelCost
ContactEmail = $3000
ContactEmail = sv*@my.com


Aug 25 '06 #2
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.


Aug 25 '06 #3
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 =
"di*@mysite.com";

row 02: if (this.hdnTravelType.value == "Domestic" ||
this.hdnTravelReason.value != "Customer Visit") this.hdnApproverEmail =
"vp@mysite.com";

row 03: if (this.hdnTravelType.value == "International")
this.hdnApproverEmail = "sv*@mysite.com";

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]" <st*****@online.microsoft.comwrote in message
news:3d*************@TK2MSFTNGXA01.phx.gbl...
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.


Aug 25 '06 #4
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.

Aug 28 '06 #5
Thanks Steven,

I'll follow your example...
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:RQ**************@TK2MSFTNGXA01.phx.gbl...
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.

Aug 28 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
8
by: Monty | last post by:
Let's say you provide an online service from 7:00AM to 6:00PM Eastern Time (daylight time in the summer). Is there way of showing these hours of availability on a web page in the user's local...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
2
by: Terry | last post by:
Hello, I wonder if anyone can shed light on this problem for me. I have an Access 97 front end with an SQL 2000 database. There is a Business main form with an Owner subform and corresponding...
5
by: G. Stewart | last post by:
The word "Business" in the term implies some sort of commercial aspects or connotations. But from what I can see, that is not necesserially the case at all? So what is the reasoning behind the...
0
by: Al Fatykhov | last post by:
Using MABLE logic engine with existing .NET applications. MABLE web services provide an interface to MABLE business objects and logic. Let us review some technical details of the MABLE web...
8
by: Blast | last post by:
I need help modeling schema for a particular issue that i've never run across before. And for the life of me, I cannot figure out how to model it - at least in a way that feels correct. Please let...
2
by: Chris Zopers | last post by:
Hello, I would like to know what's the best way to implement a business logic layer between my user interface and my database. I would say I'd make a dll-project for the business logic layer...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.