Click here to Skip to main content
15,884,537 members
Articles / Web Development / ASP.NET

A Task Management System using Three Layer Architecture

,
Rate me:
Please Sign up or sign in to vote.
4.27/5 (15 votes)
9 Apr 2010CPOL5 min read 64.3K   3.5K   54  
This describes a three Layer Architecture with examples
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>
/// Summary description for EmployeeBLL
/// </summary>
public class EmployeeBLL
{
	public EmployeeBLL()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public string AddNewEmployee(Employee employeeObj)
    {
         EmployeeGateway employeeGateWayObj = new EmployeeGateway();
         return employeeGateWayObj.InsertEmployee(employeeObj);
    }
    public DataTable SelectUserId()
    {
        EmployeeGateway employeeGateWayObj = new EmployeeGateway();
        return employeeGateWayObj.SelectAllUserId();
    }

    public DataTable SelectAdminId()
    {
        EmployeeGateway employeeGateWayObj = new EmployeeGateway();
        return employeeGateWayObj.SelectAllAdminId();
    }
    public DataTable SelectLoginRole(int index)
    {
        EmployeeGateway employeeGatewayObj = new EmployeeGateway();
        DataTable dt = new DataTable();
        switch (index)
        {
            case 0:
                dt = employeeGatewayObj.SelectAllAdminId();
                
                break;
            case 1:
                dt = employeeGatewayObj.SelectAllUserId();
                
                break;
                
        }
        return dt;
    }
    public void CreateAdmin(string userId)
    {
        EmployeeGateway employeeGateWayObj = new EmployeeGateway();
        employeeGateWayObj.CreateAdmin(userId);
    }
    public void CreateUser(string employeeId, string password)
    {
        EmployeeGateway employeeGateWayObj = new EmployeeGateway();
        employeeGateWayObj.CreateUser(employeeId, password);
    }
    public DataTable SelectAllEmployeeBasicInformation()
    {
        EmployeeGateway employeeGateWayObj = new EmployeeGateway();
        return employeeGateWayObj.SelectAllEmployeeData();
    }
    public string RemoveAdmin(string adminId)
    {
        EmployeeGateway employeeGateWayObj = new EmployeeGateway();
        ProjectGateway projectGateWayObj = new ProjectGateway();
        TaskGateWay taskGateWayObj = new TaskGateWay();

        if ((projectGateWayObj.CountRunningProjectOfUser(adminId) > 0) || (taskGateWayObj.CountRunningTaskOfUser(adminId) > 0))
        {
            return "The User is under running Project.";
        }
        else
        {

            employeeGateWayObj.RemoveAdmin(adminId);
            return "The Admin is removed";
        }
    }
    public string RemoveUser(string userId)
    {
        EmployeeGateway employeeGateWayObj = new EmployeeGateway();
        ProjectGateway projectGateWayObj = new ProjectGateway();
        TaskGateWay taskGateWayObj = new TaskGateWay();

        if ((projectGateWayObj.CountRunningProjectOfUser(userId) > 0) || (taskGateWayObj.CountRunningTaskOfUser(userId) > 0))
        {
            return "The User is under running Project.";
        }

        else
        {
            employeeGateWayObj.RemoveUser(userId);
            return "The User is removed";
        }
    }
    public DataTable SelectAllAdminData()
    {
        EmployeeGateway employeeObj = new EmployeeGateway();
        return employeeObj.SelectAllAdminData();
    }
    public DataTable SelectAllEmployeeId()
    {
        EmployeeGateway employeeObj = new EmployeeGateway();
        return employeeObj.SelectAllEmployeeId();
    }
    public DataTable SelectAllUserData()
    {
        EmployeeGateway employeeObj = new EmployeeGateway();
        return employeeObj.SelectAllUserData(); ;
    }


}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer Waveroamer Solutions, Advanced ERP(BD) LTD
Bangladesh Bangladesh
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Written By
Software Developer WaveRoamer Solution Ltd
Bangladesh Bangladesh
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions