Code Effects Business Rule Engine ASP, MVC 4.2 » Developer.Team - Developers Paradise!

Code Effects Business Rule Engine ASP, MVC 4.2

Code Effects Business Rule Engine ASP, MVC 4.2
Code Effects Business Rule Engine ASP, MVC 4.2 | 224 kB


Revolutionary web interface. By using the Code Effects business rules engine, any educated adult can write complex rules simply by selecting rule elements from the context-sensitive menu. The end result literally looks like a spoken sentence: If customer home state is Georgia then add no shipping cost else add shipping (9.95). No IT personnel are required to author business rules and no code re-compilation is needed if rules are modified. Evaluate rules from any .NET code. Create business rules online using Code Effects' editor, store them as XML in a database or file system, and evaluate them in any .NET environment by executing a simple statement.

It's fast! Code Effects component is capable of evaluating a collection of millions of complex source objects in just milliseconds, filtering out the ones that didn't make it through the rule(s).
Parentheses. For complex rules, Code Effects component employs parentheses to prioritize evaluation of rule conditions. Anyone who understands the difference between (A + B) x C and A + (B x C) can now create business rules of any complexity.
Automatic rule validation. Code Effects component automatically highlights invalid rule elements and even displays a short description of the problem for each invalid rule element if the rule author tries to save an invalid rule. This guarantees that each saved or modified rule is valid and ready for testing or deployment. To see this in action, simply try to save an invalid rule using the demo editor.
Supports all major browsers. Firefox, Chrome, Safari and Opera on Mac and Windows; IE 7 and up on Windows.
Reusable rules. Save any group of repetitive conditions as an evaluation type rule and reuse it in any other rule as if it was a regular field. The Sample Rule pre-loaded in the demo editor demonstrates this feature by using the Reusable Rule.
Runs on .NET 4.0 and up. Code Effects component supports ASP.NET 4.0 and MVC 3 and can even be used as a pure jаvascript object in Ajax web applications. Download our demo projects to see an implementation of Code Effects using these technologies.
No installation required. Code Effects component is delivered as a single self-contained .NET assembly less than 500Kb in size. It requires no GAC installation, no background processes, no dependency on third-party scripting frameworks, and no need to give a special write access to folders. Code Effects component runs fine even on bare-bones shared hosting accounts.
Built-in help. By default, Code Effects component displays a Help String that detects what's already in the rule and automatically describes the next possible action. It also suggests the next selection via context menu as you create a new rule or navigate through the existing rule.
Simple licensing. Nothing beats the price of the free version if your project doesn't require high performance. For more demanding environments, you pay per domain name where your copy of Code Effects will be actually used. Or purchase the Unlimited license which allows you to use Code Effects anywhere and even distribute it with your own product.
Customization. Almost all members of your source object can be decorated with optional attributes. They instruct Code Effects as to how to render its UI, display rule elements and evaluate rules. Code Effects component provides attributes for properties, methods, parameters, return values, etc. Use them to change the default behavior of Code Effects. You can set date and time formats, min and max limits for numeric values, the type of values rule authors should be allowed to input, and so on.

Besides business rules management, Code Effects component provides a feature that is unique not only to the business rules industry but to .NET LINQ programming as well. It's called Rule-Based Data Filtering, and it can be used with any LINQ provider as long as it supports common operators, such as contains, less than, is null, and so on. You can try this feature by using our live demo.

A filter is nothing more than a business rule attached to a data selection query. It's safe to say that rule-based data filtering is a logical "side effect" of business rules.

You are already familiar with SQL filters if you have ever created a statement that uses a where clause. Although SQL provides an extremely powerful filtration mechanism, the problem is that access to that power is limited to people who are fluent in SQL. To combat this limitation and allow end users to define their own search criteria, applications usually include search forms.

A typical search form contains a single text box, a Go button, and a link that takes a user to an advanced search form. The text box is usually smart enough to recognize a proprietary syntax that the user can use to filter the search results. For example, a phrase in quotes would return all items that contain that exact phrase, while that same phrase without quotes would return items that contain any word included in that phrase.

That works fine except that before being able to use the form to its full potential, the user must learn the syntax. And yet, this kind of form cannot possibly offer the full power of SQL from a single text box. Applications try to address this limitation by providing so-called advanced search forms.

An advanced form could be as simple as a group of related drop downs and text boxes, or as complex as a bulky collection of all input controls supported by the HTML specification:

Get records where
	date of birth is in the past of August 17, 1976 and
	(
		email address does not contain "domain" or
		alcohol box is checked
	)
	and
	(
		(
			home zip is "30040" and
			gender is Male and
			work city is not home city
		)
		or physician is equal to Stephen Lee
	)


Well, Code Effects Software has already invented such a UI by introducing its Rule Editor. Now, to achieve the same goal, all developers need to do is to add it to the page, set its Mode to Filter, add a Search button, and add a simple code to handle its click event (an ASP.NET example is used; an MVC example is available in our demo projects):

<%@ Register assembly="CodeEffects.Rule"
	namespace="CodeEffects.Rule.Asp" tagprefix="filter" %>

<div>
	<filter:RuleEditor
		ID="filterControl" runat="server"
		SourceAssembly="DemoProject"
		SourceType="DemoProject.Patient"
		Mode="Filter" />
</div>
<div style="margin-top:10px;text-align:right;">
	<asp:Button ID="btnSearch" runat="server" Text="Search"
		CssClass="button" onclick="SearchClicked" />
</div>


private void SearchClicked(object sender, EventArgs e)
{
	if(this.filterControl.IsEmpty || !this.filterControl.IsValid)
	{
		this.someInfoLabel.Text = "The filter is empty or invalid";
		return;
	}
 
	YourEntityFrameworkDatabase dc = new YourEntityFrameworkDatabase();
 
	var q = from p in dc.Patients.Filter(this.filterControl.GetRuleXml())
		select new
		{
			p.PatientID,
			p.FirtsName,
			p.LastName,
			p.Email
		};
 
	this.someGridViewControl.DataSource = q;
	this.someGridViewControl.DataBind();
}


This code assumes that you have also added the someInfoLabel label and someGridViewControl grid view control to the page, and that the YourEntityFrameworkDatabase database with the Patient table is properly mapped in your project. By using this page, most business users are able to create the above filter in seconds, the same way they would create a business rule, even if they know nothing about Code Effects component and how it works:

That's all it takes to create complex data filters and execute them against LINQ to Entity. Remember that in Code Effects, data filters are essentially evaluation type rules. Rules of execution type cannot be used as data filters.

When you set RuleEditor.Mode to Filter, Code Effects component hides the Toolbar and uses the filter-related built-in version of the Help XML while rendering labels and names on the client. All other settings and features of Code Effects in Filter mode work the same as documented in the Creating Business Rules section.

Code Effects component hides the Toolbar in Filter mode, because the most common use of any web-based filter is a "drive-by search": users visit a page, type search criteria into the search box, hit the Search button, and use the results. Most site visitors don't need to save their searches for later use. The Toolbar is a feature that allows the saving, loading, and deletion of rules or filters, and it's usually not needed in drive-by searches.

There could be situations where saving a filter is not only desirable, but actually required. In such cases, the use of Toolbar would greatly simplify filter management for users. Here are a few examples:

A heavy reporting application that serves reports through long-running procedures. By saving a custom filter, the user could instruct the system's database to run a certain report with that filter applied, and send out a notification when the report is ready. Filters from all users could be stored as XML strings in a dynamic queue/table.
An online store or auction that allows its users to store custom searches for items that are not yet (or no longer) available for sale. As new items arrive in the store, the system could run each new item through all relevant filters and notify the user that an item of interest just became available if any (or all) filters evaluated to True. The high performance of Code Effects' engine could help to make such system very fast and efficient.

[/b]

[b] Only for V.I.P
Warning! You are not allowed to view this text.