This project is read-only.

Yet Another CRUD Tool! But Why?

Stay warned! MixERP invents its own wheels. If you expect to see Entity Framework (or similar) here, you might not be happy.

This just an opposite of ORM or CRUD frameworks that generate codes. You will find a hundred free CRUD tools/frameworks available for the .net framework. Moreover, there are also some commercial products which do the job pretty well. But, none of the existing tools could be fit in our scenario.

The problem we found with the existing tools were:
  • Too much generalized.
  • Too much schema bound.
This introduces a weird limitation to developers by forcing them to choose a single entity to work with. What if you wanted to display (GridView) the "X View" to the user and then present (Form) "Y Table" for insert, edit, or delete operation. MixERP solves this.
  • No provision to define the display fields of the foreign key on their base tables.
This will be problematic in cases where your users would have to choose an arbitrary item id (ex 1345) or you would have to make the item name the primary key. What would users choose if the referenced primary key was a GUID column. MixERP again solves this.
  • No provision to exclude columns for insert. The tools failed to understand a simple concept that some columns could be either computed, updated by a trigger, or are timestamp fields when manual insert or modification should not be allowed.
  • No provision to add a policy for allowing and/or restricting the edit, insert, and/or delete operation based on application user or role.

The FormControl achieves its goal by automating the following major tasks
  • Displaying a database table
  • Adding a row to the database table
  • Editing the selected row
  • Deleting the selected row
  • Printing the displayed table
The source code can be found on the following directory:

Root/MixERP.Net.FrontEnd/UserControls/Forms/FormControl.ascx

The control exposes following properties
#region Properties
public bool DenyEdit { get; set; }
public bool DenyDelete { get; set; }
public bool DenyAdd { get; set; }
public string Description { get; set; }
public string DisplayFields { get; set; }
public string DisplayViews { get; set; }
public string Exclude { get; set; }
public string KeyColumn { get; set; }
public int PageSize { get; set; }
public string SelectedValues { get; set; }
public string Table { get; set; }
public string TableSchema { get; set; }
public string Text { get; set; }
public string View { get; set; }
public string ViewSchema { get; set; }
public int Width { get; set; }
#endregion

Properties Explained

DenyEdit

This property when set to true will restrict a user from editing the selected row. This property could be enabled on runtime depending upon the currently signed in user's role or authorization policy defined by the administrator.

DenyDelete

This property when set to true will restrict a user from deleting the selected row. This property could be enabled on runtime depending upon the currently signed in user's role or authorization policy defined by the administrator.

DenyAdd

This property when set to true will restrict a user from adding a new row to the view. This property could be enabled on runtime depending upon the currently signed in user's role or authorization policy defined by the administrator.

Description

This property's value, if set, will be displayed under the form title as an alert or information to the user. Refer to the following screenshot:




DisplayFields

If the table has foreign keys, set this to a comma separated list of the name of the field or Column Expression to be displayed on the DropDownList control.

Column Expression

Expressions could be used instead of column name. Please refer to the following MSDN articles for more information on Expression Columns:

http://msdn.microsoft.com/en-us/library/zwxk25bd(v=vs.100).aspx
http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.100).aspx

Syntax

Comma separated list of [Fully qualified column]-->[display_column or expression]

as in
DisplayFields="office.users.user_id-->user_name, core.accounts.account_id-->account_code + ' (' + account_name + ')'" 

DisplayViews

This property when set a value will enable a popup selection of foreign keys by displaying the base tables. Set this to a comma separated list of the name of the Database View or Database Table to be displayed on the popup window.

Syntax

Comma separated list of [Fully qualified column]-->[fully qualified PostgreSQL view]

as in
DisplayViews="office.users.user_id-->office.user_view, core.accounts.account_id-->core.account_view"        


Refer to the source code of BankAccount.aspx:
https://mixerp.codeplex.com/SourceControl/latest#MixERP.net.FrontEnd/Finance/Setup/BankAccounts.aspx


Todo: Space reserved for further documentation.


Note: Feel free to edit this documentation for simplification and fixing grammar and typos.

Last edited Sep 3, 2013 at 9:29 PM by binodnp, version 32