Wednesday, February 24, 2010

4 - Tier Architecture

See the 3-tier architecture in Microsoft


1. Business Object [BO]
2. Business Access Layer [BAL]
3. Data Access Layer [DAL]
4. Presentation Layer


Business Object(BO)
class employee.cs
{
int employeeID= 0;
string m_FirstName = string.Empty;
string m_LastName = string.Empty;
int salary= 0;

#region Propertiers
public int employeeID
{
get { return employeeID; }
set { employeeID = value; }
}
public string FirstName
{
get { return m_FirstName; }
set { m_FirstName = value; }
}
public string LastName
{
get { return m_LastName; }
set { m_LastName = value; }
}
public int Salary
{
get { return salary; }
set { salary = value; }
}
#endregion Properties
2. Business Access Layer [BAL]
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///
/// Summary description for PersonBAL
///

public class EmployeeBAL

{
public EmployeeBAL()
{
}
///
/// insert records into database
///

///
///

public int Insert(Employee employee)
{
EmployeeDAL eDAL = new EmployeeDAL();
try
{
return eDAL.Insert(person);
}
catch
{
throw;
}
}
///
/// Update records into database
///

///
///
public int Update(Employee employee)
{
EmployeeDAL eDAL = new EmployeeDAL();
try
{
return eDAL.Update(person);
}
catch
{
throw;
}
}
///
/// Load records from database
///

///
public DataTable Load()
{
EmployeeDAL eDAL = new employeeDAL();
try
{
return eDAL.Load();
}
catch
{
throw;
}
finally
{
eDAL = null;
}
}
///
/// Delete record from database
///

///
///
public int Delete(Person person)
{
EmployeeDAL eDAL = new EmployeeDAL();
try
{
return eDAL.Delete(person);
}
catch
{
throw;
}
finally
{
eDAL = null;
}
}
}

3. Data Access Layer [DAL]

this is also contains in App_Code folder and contains all the code to access database.

4. Presentation Layer
This Layer contains the UI.



See the 3-tier architecture in Microsoft

No comments:

Post a Comment