Click here to Skip to main content
13,834,134 members
Click here to Skip to main content
Add your own
alternative version


43 bookmarked
Posted 27 Oct 2008
Licenced CPOL

RFC Architecture for Finance Projects (The Invoicing Part)

, 19 Nov 2008
Rate this:
Please Sign up or sign in to vote.
RFC Architecture for Finance Projects (The Invoicing Part)
Title:       RFC Architecture for Finance Project (The Invoicing Project)
Author:      Shivprasad Koirala 
Language:    Architecture Interview Questions
Level:       Beginner
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

ASPX pages

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


The RFC Architecture

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.



The current sections

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.

The invoicing part

You can download the invoicing requirements from
I really do not want to make this article large by pasting the requirement document.

Folders in the project


Folder Name

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 table structure

The invoicing part has two important tables one is the product table and the other is the Invoice table.

Mst_product 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.

Invoice table


This is unique key which identifies a invoice uniquely.

Invoice comments

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.



Business class structure and code

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.


Business class and code explanation

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();
objInvoiceDB.InsertInvoice(_InvoiceReference, _InvoiceComments,
_InvoiceDate, _ProductId, _Qty, _Amount, _TaxAmount, _PaidAmount, 
_CustomerName,_CustomerAddress, _UnitCost);

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("InvoiceReference",_InvoiceReference));
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.

ASPX pages

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.

Next version planning

• 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


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
Syed Javed11-Jan-10 20:12
memberSyed Javed11-Jan-10 20:12 
GeneralThanks for sharing but... Pin
fgoldenstein10-Dec-09 4:22
memberfgoldenstein10-Dec-09 4:22 
GeneralRe: Thanks for sharing but... Pin
Shivprasad koirala10-Dec-09 4:29
memberShivprasad koirala10-Dec-09 4:29 
Generalexcellent Pin
Donsw4-Feb-09 16:52
memberDonsw4-Feb-09 16:52 
GeneralSome Information about your Code Pin
Ravenet25-Nov-08 0:36
memberRavenet25-Nov-08 0:36 
GeneralRe: Some Information about your Code Pin
Shivprasad koirala4-Dec-08 7:39
memberShivprasad koirala4-Dec-08 7:39 
GeneralRe: Some Information about your Code Pin
sunil2337-Aug-12 5:24
membersunil2337-Aug-12 5:24 
GeneralPlease Note.. [modified] Pin
Ranjan.D19-Nov-08 18:02
professionalRanjan.D19-Nov-08 18:02 
GeneralRe: Please Note.. Pin
Shivprasad koirala20-Nov-08 8:37
memberShivprasad koirala20-Nov-08 8:37 
Hi Ranjan,

We are planning to use exception handling blocks what you pointed out is right. We already have the review in our code list.

Footprints on the sand are not made by sitting at the shore.

GeneralMMMMM ... this is more and more looking like Spamming to me Pin
Michael Moreno19-Nov-08 2:07
memberMichael Moreno19-Nov-08 2:07 
GeneralRe: MMMMM ... this is more and more looking like Spamming to me Pin
Shivprasad koirala19-Nov-08 3:31
memberShivprasad koirala19-Nov-08 3:31 
GeneralRe: MMMMM ... this is more and more looking like Spamming to me Pin
devnet24719-Nov-08 6:32
memberdevnet24719-Nov-08 6:32 
GeneralRe: MMMMM ... this is more and more looking like Spamming to me Pin
Shivprasad koirala19-Nov-08 6:59
memberShivprasad koirala19-Nov-08 6:59 
GeneralI have downloaded the project and it sound good but not fit for me Pin
xenofeeder27-Oct-08 22:24
memberxenofeeder27-Oct-08 22:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190114.1 | Last Updated 19 Nov 2008
Article Copyright 2008 by Shivprasad koirala
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid