Beginning with 3 Tier architecture – Asp.net -C#

By default Microsoft .NET Framework provides various ways to build application. There are many ready made frameworks and many open sources frameworks available to build application for Asp.Net, C#.

Please refer following 3 Tier application framework and structure for beginners and small scale application in C#, Microsoft .NET.

Please for any further information drop us an email at,
info@maven-infosoft.com

This system is created with the concept of 3-Tier. We have divided the system in several folder or directories. Details related to the Folders are as follow as per the role of it in System.

This folder is used to store different type of file relate to design. This folder is used to save following thing.

Master Pages

CSS

JS file

In this directory we are creating the folders and file for Admin and Front-end GUI. For both the modules there are different designs.

This directory is used to store the forms for the System. In this situation this directory stores two types of files.

ASPX file and

CS file

Controls

In this directory we are storing the controls which are going to be used in the system. This directory is having different sub-directory like, admin, frontend and general.  

 

App_Code

This folder is a system folder which has library code for the system. Code and class files related to the system are kept in this folder. 

All the Images related to the Project is kept in this folder

As this module is language independent, XML files of different languages are kept in this folder.

 

Flow of Structure from UI (User Interface) to BLL (Business Logic Layer)
and DAL (Data Access Layer)

In above diagram user interacts with Forms (UI). Form may contain some user controls that is inherited or created form the existing controls. Data moves from Forms to BLL and from BLL to it moves to DAL. And now data moves from DAL to database. The Data gets reverse to display proper information to the user.

We have created following namespaces to develop this module.

Maven.UserControls

Maven.HelperClasses

Maven.BLL

Maven.DAL

This namespace is used to create the controls on your page. You can create the control in asp. Page using the following code

Register the control in your aspx page.

<%@ Register Namespace=”Maven.UserControls” TagPrefix=”admin” %>

Now you can use the controls from this namespace using the TagPrefix as “admin”. For Example

Using User Controls

<admin:RolePage runat=”server” CheckPageFor=”Add” ID=”chk” />

Different types of controls used for developing this Module.

Control Name

Use

ChkRole

This control is used to get whether the User has right to use this page or not. If not he/she will be redirect to Dashboard.aspx page

RoleButton

This control inherits Button class. This controls gets Enable and Disable as per the roles and rights of logged in user

RoleAddEditPanel

This control inherits Panel class, This class is used to know whether the user has permission to Edit or Add page. If user hasn’t rights Panel will be Disabled otherwise it would be Enable.

RoleGridView

This control inherits the GridView Class. If the user has view right this will give Data else it will give Error Message

RoleUser

This class is used to manage the Page role wise and display the Login Name in Header

 

This namespace is used by different classes for different purposes. This namespace has following functionality. This class has Enum for better representation.

We can divide this namespace in following type of classes and Enum.

Enum

This class is having Enum for better presentation of code. There are different types of Enums in these classes,

CommandName – To know which type of command is fired or used.

RoleFor – To check for the role of user

ChkPageFor – To check for the mode of page for Add or Edit

RoleText – To check which type of role does the user have

Static classes

You can directly call this classes’ methods with className.MethodName()

ErrorMessage – This class is used to get the ErrorMessage.

Language – This class is used to translate the language.

Base Classes

You can call these classes with the help of object.

List of these classes is as follow:

SQLHelper – This class is used for Database operation. Insert, Update and Delete

SQLParamete – This class is used to create and use the Parameter for the Stored Procedure.

XMLHelper – This class is used for XML file operation. Insert, Update and Remove Node

Mail – This class is used to send mail

Error – This class is used for Error and Exception. This class redirects the Page on Error Page when there is any Exception.

This is the Business Logic Layer of the User Management Module. All the class in this Namespace is used as a bridge between User Interface and Data Access Layer.

This is the Data Access Layer for the User Management Module. All the class in this namespace is used as a bridge between data access layer and Database.

These are the User controls which have GUI. We can call these controls as follow

Registering User Control

<%@ Register Src=”~/controls/general/litral.ascx” TagName=”Label” TagPrefix=”admin” %>

Creating Control

<admin:Label runat=”server” ID=”lblUserName” ControlName=”UserName” FormName=”USER” IsRequired=”true” />

In above control FormName is the Node just after Language and befor Control Name

Different types of User controls are created as follow:

Control Name

User

Button

This is the user control to work as button. The Text for this control is retrieved from Language.xml file

Literal

This control is used to display the Text on the Web form. We can Retrieve the details from the Language.xml file.

OperationPanel

This Control Panel is used to display the button for Add, Delete and Moderate Functionality.

 Note: Images will be updated soon.