Example #1
0
    /// <summary>
    /// Fills project DDL
    /// </summary>
    private void FillProjectDropDownList()
    {
        try
        {
            string         employeeId           = Session["userID"].ToString();
            ProjectGateway ProjectGatewayObject = new ProjectGateway();
            projectDropDownList.DataSource     = ProjectGatewayObject.GetProjectsOfUser(employeeId);
            projectDropDownList.DataTextField  = "Title";
            projectDropDownList.DataValueField = "ID";
            projectDropDownList.DataBind();

            if (ProjectGatewayObject.GetProjectsOfUser(employeeId).Count == 0)
            {
                errorLabel.Text = "Admin is not a member of any project. Can't create task for any project.";
            }
        }
        catch (SqlException sqlExceptionObj)
        {
            errorLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorLabel.Text = exceptionObj.Message;
        }
    }
 /// <summary>
 /// Fills up projectListBulletedList DDL
 /// </summary>
 private void FillProjectsOfUser()
 {
     try
     {
         ProjectGateway ProjectGatewayObject = new ProjectGateway();
         numberOfProjectsLabel.Text             = ProjectGatewayObject.GetProjectsOfUser(employeeId).Count + " Project(s) Assigned to this employee";
         projectListBulletedList.DataSource     = ProjectGatewayObject.GetProjectsOfUser(employeeId);
         projectListBulletedList.DataTextField  = "title";
         projectListBulletedList.DataValueField = "id";
         projectListBulletedList.DataBind();
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
    /// <summary>
    /// Fills up projectIdDropDownList DDL
    /// </summary>
    private void FillProjectIdDropDownList()
    {
        try
        {
            ProjectGateway ProjectGatewayObject = new ProjectGateway();
            projectIdDropDownList.DataSource     = ProjectGatewayObject.GetProjectsOfUser(Session["userID"].ToString());
            projectIdDropDownList.DataTextField  = "ID";
            projectIdDropDownList.DataValueField = "ID";
            projectIdDropDownList.DataBind();

            if (ProjectGatewayObject.GetProjectsOfUser(Session["userID"].ToString()).Count == 0)
            {
                errorLabel.Text = "Admin is not a member of any project yet. Can't edit any project information";
            }
        }
        catch (SqlException sqlExceptionObj)
        {
            errorLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorLabel.Text = exceptionObj.Message;
        }
    }