Title: RFC Architecture for Finance Project (The Invoicing Project)
Author: Shivprasad Koirala
Language: Architecture Interview Questions
Description: RFC Architecture for Finance Project (The Invoicing Project)
RFC Architecture for Finance Project (The Invoicing Project)
The RFC Architecture
The current sections
The invoicing part
Folders in the project
The Invoicing table structure
Business class structure and code
Business class and code explanation
Next version planning
RFC is an open source initiative for Finance projects. It has reusable components like invoicing, accounting and purchase modules. In this section we will discuss about the invoicing section of the RFC architecture.
You can download the project details from http://www.codeplex.com/FinanceDotNET
RFC stands on a three tier architecture framework. It uses enterprise blocks heavily for data access layer, security, validation etc. The core of RFC is the business logic layer which can be used in a decoupled manner in your project. Currently the data access layer only supports SQL Server.
Currently RFC supports three major section Invoicing, purchase and journal section. Journal section is a double entry accounting system which is the heart of RFC. Any entries made in to invoicing or purchase is finally sent to the journal section.
You can download the invoicing requirements from http://www.codeplex.com/FinanceDotNET/SourceControl/ListDownloadableCommits.aspx
I really do not want to make this article large by pasting the requirement document.
What does it have
In the root folder we have the user interface of the application.
It has the database i.e. Invoicing.MDF
This has the business classes for the invoicing application.
This has the data access layer of the project.
The invoicing part has two important tables one is the product table and the other is the Invoice table.
This is unique key which identifies the product.
A simple description about the product.
Per unit cost of the product
<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; WIDTH: 329.4pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid" valign=removed" width="439">
Tax on the current amount.
This is unique key which identifies a invoice uniquely.
A short text which describes the comments
Per unit cost of the product
This is the product reference from the product master table
How much quantity of the product was ordered?
Total Amount to be paid by the customer
Many times the customer will not pay the complete amount so a paid amount field.
Customer Name and Address
This describes the customer credentials.
Invoice has two business classes invoice class i.e. ‘ClsInvoice’ and product class i.e. ‘ClsProduct’. Both of these call the ‘ClsInvoiceDB’ class to database operations.
Below is the ‘insert’ method of ‘clsInvoice’ class. It actually creates the object of ‘clsInvoiceDB’ to connect to the SQL Server database.
public void Insert()
clsInvoiceDB objInvoiceDB = new clsInvoiceDB();
_InvoiceDate, _ProductId, _Qty, _Amount, _TaxAmount, _PaidAmount,
The insert invoice class code is something as shown below.
public void InsertInvoice(string _InvoiceReference, string _InvoiceComments, DateTime _InvoiceDate, int _productId,
int _Qty, double _Amount, double _TaxAmount, double _PaidAmount, string _CustomerName, string _CustomerAddress, double _UnitCost)
SqlConnection ObjConnection = new SqlConnection();
ObjConnection.ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];
SqlCommand objCommand = new SqlCommand();
objCommand.Connection = ObjConnection;
objCommand.CommandText = "usp_InsertInvoice";
objCommand.CommandType = CommandType.StoredProcedure;
objCommand.Parameters.Add(new SqlParameter("@InvoiceComments", _InvoiceComments));
objCommand.Parameters.Add(new SqlParameter("@InvoiceDate", _InvoiceDate));
objCommand.Parameters.Add(new SqlParameter("@ProductId", _productId));
objCommand.Parameters.Add(new SqlParameter("@Qty", _Qty));
objCommand.Parameters.Add(new SqlParameter("@Amount", _Amount));
objCommand.Parameters.Add(new SqlParameter("@TaxAmount", _TaxAmount));
objCommand.Parameters.Add(new SqlParameter("@PaidAmount", _PaidAmount));
objCommand.Parameters.Add(new SqlParameter("@CustomerName", _CustomerName));
objCommand.Parameters.Add(new SqlParameter("@CustomerAddress", _CustomerAddress));
objCommand.Parameters.Add(new SqlParameter("@UnitCost", _UnitCost));
In the same way other methods of the business component and DAL interact. I am not pasting the code here as the article will become bulky. You can download the project from the codeplex to get a fell of the same.
There are two ASPX pages one is the Invoice entry screen (InvoiceEntry.aspx) and the second is the product selection screen (SelectProducts.aspx). The UI consumes the business object in a very standard format. To get more understanding you can see the ‘setObjectFromUI’ method where all the values from the UI is passed to the business object.
public void setObjectFromUI(clsInvoice objInvoice)
objInvoice.CustomerName = txtCustomerName.Text;
objInvoice.CustomerAddress = txtCustomerAddress.Text;
objInvoice.InvoiceComments = txtComments.Text;
objInvoice.InvoiceReference = txtInvoiceNumber.Text;
Finally in the button events the operations of the classes like insert , update and delete is called. For instance you can see in the update invoice click event we have called the ‘Update’ operation. Any exceptions raised from the user interface is finally caught and displayed in the error message label.
protected void btnUpdateInvoice_Click(object sender, EventArgs e)
clsInvoice objInvoice = new clsInvoice();
catch (Exception ex)
lblErrorMessage.Text = ex.Message.ToString();
The whole project goes with the same style of coding business object, DAL and the consumption in the UI. So if you are able to follow the above code you should be able to understand the other part of the project also.
• The data access layer will now go through Enterprise data access layer.
• Business validation will go through the enterprise validation application blocks
• Integration with the accounting system