Biz Rule Tutorial

Feb 25, 2010 at 9:38 AM
Edited Feb 25, 2010 at 9:40 AM

Hi,

I have only been using NetSqlAzMan for a day and so far everything seems straightforward however I can't seem to find any tutorial or help on the Biz Rules.  How are they structured and how do you use them?  Is there a website that explains them or a document I can download?  I have downloaded the user guide but that only seem to introduce the concept of the biz rule and then goes into other things.  Can the Biz rules to linked into your actual development code and read values from it or is it self contained in the NetSqlAzMan application, so far none of this seems to of been made clear at all.

 

Any help would be welcome.

Feb 26, 2010 at 7:08 AM

Hi,

this is a Biz Rule example:

suppose you have an Operation called “Purchare Order” and your goal is to automatically allow this operation if the “Order Amount” (that you have at run-time only) is less than $1000 otherwise someone must approve it.

You can define a Biz Rule on the “Purchare Order” operation as the following:

Hi,

if you have a lot of Application ID … you can define a Business Rule on the task “ModifyBlah” like following:

using System;

using System.Security.Principal;

using System.IO;

using System.Data;

using System.Collections;

using System.Collections.Specialized;

using System.Collections.Generic;

using System.Text;

using NetSqlAzMan;

using NetSqlAzMan.Interfaces;

namespace PurchaseSystem.BizRules

{

public sealed class BizRule : IAzManBizRule

{

public BizRule()

{ }

public bool Execute(Hashtable contextParameters, IAzManSid identity, IAzManItem ownerItem, ref AuthorizationType authorizationType)

{

//Insert your code here

int orderAmount = (decimal)contextParameters[“Order Amount”].Value;

          if (orderAmount <= 1000.0M)

              authorizationType = AuthorizationType.Allow;

return true; //true means “consider Biz Rule result” … otherwise “do not consider biz rule result”

}

}

}

At run-time …. when you invoke CheckAccess method … just pass a contextParameter named “Order Amount” and its value (look for the overload with params ContextParamaters parameter).

Regards,

Andrea.

__________________________________
Andrea Ferendeles
NetSqlAzMan Project Coordinator  
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com