Click here to Skip to main content
15,892,161 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.5K   3.5K   54  
This describes a three Layer Architecture with examples
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;

public partial class UI_CreateProject : System.Web.UI.Page
{
    DataExecuteClass DEC = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        string userId = Session["userId"].ToString();
        string userRole = Session["userRole"].ToString();
        this.Master.userId = userId;
        this.Master.UserRole = userRole;

       this.GenerateProjectId();
    }
    private void GenerateProjectId()
    {
        DEC = new DataExecuteClass();
        string countProject = "SELECT COUNT(*) FROM t_Project";
        object o = DEC.getSingleValue(countProject);
        int counter = int.Parse(o.ToString())+1;
        string n=null;
        if (counter < 10)
        {
            n = "00" + counter.ToString();
        }
        if (counter < 100 && counter > 9)
        {
            n = "0"+ counter.ToString();
        }
        if (counter > 99 && counter < 1000)
        {
            n = counter.ToString();
        }
        string projectId = "PRO-" + DateTime.Now.Year+"-"+n;
        projectIdTextBox.Text = projectId;

    }
    protected void createProjectButton_Click(object sender, EventArgs e)
    {
        ProjectBLL project = new ProjectBLL();
        //string projectAdmin = Request.QueryString["userId"].ToString();
        string projectAdmin = "fahmina90";
        Project projectObj = new Project(projectIdTextBox.Text, projectNameTextBox.Text, projectDescriptionTextBox.Text, projectClientTextBox.Text, creationDateTextBox.Text, endDateTextBox.Text, projectAdmin);
        string UserRole = "Admin";
        ProjectDetails ProjectDetailsObj = new ProjectDetails(projectIdTextBox.Text, projectAdmin, UserRole, creationDateTextBox.Text, endDateTextBox.Text);
        project.AddUserToProject(ProjectDetailsObj);
        int countUser = CheckBoxList1.Items.Count;
        for (int i = 0; i < countUser; i++)
        {
            if (CheckBoxList1.Items[i].Selected)
            {
                string userId = CheckBoxList1.Items[i].ToString();
                string userRole="User";
                ProjectDetails projectDetailsObj = new ProjectDetails(projectIdTextBox.Text, userId, userRole, creationDateTextBox.Text, endDateTextBox.Text);
                project.AddUserToProject(projectDetailsObj);
            }
        }
        string msg = project.AddNewProject(projectObj);
        Response.Redirect("CreateProject.aspx");

    }
}

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