コード例 #1
0
    /// <summary>
    /// Check for open task
    /// also disable project closing if any open task founded
    /// </summary>
    private void CheckForOpenTask()
    {
        try
        {
            TaskGateway TaskGatewayObject = new TaskGateway();

            List <Task> listOfOpenTasksOfTheProject = TaskGatewayObject.SelectAllOpenTaskOfTheProject(projectDropDownList.SelectedItem.Value);
            int         numberOfOpenTask            = listOfOpenTasksOfTheProject.Count;
            if (numberOfOpenTask == 0)
            {
                successLabel.Text          = "All task of this project is closed.Admin can close this project";
                errorLabel.Text            = "";
                closeProjectButton.Visible = true;
            }
            else
            {
                errorLabel.Text = "Task listed below is not closed.Please close all task before.";
                openTaskBulletedList.Visible        = true;
                closeProjectButton.Visible          = false;
                successLabel.Text                   = "";
                openTaskBulletedList.DataSource     = listOfOpenTasksOfTheProject;
                openTaskBulletedList.DataTextField  = "Name";
                openTaskBulletedList.DataValueField = "ID";
                openTaskBulletedList.DataBind();
            }
        }
        catch (SqlException sqlExceptionObject)
        {
            errorLabel.Text = sqlExceptionObject.Message;
        }
        catch (Exception exceptionObject)
        {
            errorLabel.Text = exceptionObject.Message;
        }
    }
コード例 #2
0
    /// <summary>
    /// Fills up employeeIdDropDownList DDL
    /// </summary>
    private void FillEmployeeDropDownList()
    {
        try
        {
            TaskGateway     TaskGatewayObj        = new TaskGateway();
            EmployeeGateway EmployeeGatewayObject = new EmployeeGateway();
            employeeIdDropDownList.DataSource     = EmployeeGatewayObject.SelectAllNonUserEmployees();
            employeeIdDropDownList.DataTextField  = "Name";
            employeeIdDropDownList.DataValueField = "ID";
            employeeIdDropDownList.DataBind();

            if (EmployeeGatewayObject.SelectAllNonUserEmployees().Count == 0)
            {
                errorMessageLabel.Text = "All employee have been assign the user and type.";
            }
        }
        catch (SqlException sqlExceptionObj)
        {
            errorMessageLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorMessageLabel.Text = exceptionObj.Message;
        }
    }
コード例 #3
0
 protected void closeTaskButton_Click(object sender, EventArgs e)
 {
     try
     {
         TaskGateway TaskGatewayObject = new TaskGateway();
         taskObj            = TaskGatewayObject.SelectTask(taskId);
         taskObj.TaskStatus = "Close";
         message            = TaskGatewayObject.CloseTask(taskObj).ToString();
         if (message == "True")
         {
             message = "Task is closed.";
             SaveClosingComment();
             Response.Redirect("HomePage.aspx?" + "&message=" + Server.UrlEncode(message));
         }
         else
         {
             message = "Task is still open. some problem occurs during closing the task. ";
         }
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
コード例 #4
0
    /// <summary>
    /// Fills up taskIdDropDownList DDL
    /// </summary>
    private void FillTaskIdDropDownList()
    {
        try
        {
            string      employeeId        = Session["userID"].ToString();
            TaskGateway TaskGatewayObject = new TaskGateway();
            taskIdDropDownList.DataSource     = TaskGatewayObject.GetAllOpenTasksOfAUser(employeeId);
            taskIdDropDownList.DataTextField  = "Id";
            taskIdDropDownList.DataValueField = "Id";
            taskIdDropDownList.DataBind();

            if (TaskGatewayObject.GetAllOpenTasksOfAUser(employeeId).Count == 0)
            {
                errorLabel.Text = "Admin don't have any task in hand right now. Other employee is working on it. Cant edit task information now.";
            }
        }
        catch (SqlException sqlExceptionObj)
        {
            errorLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorLabel.Text = exceptionObj.Message;
        }
    }
 /// <summary>
 /// Assigen all task of the employee to admin before remove
 /// </summary>
 private void AssignEmployeesTaskToAdmin()
 {
     try
     {
         TaskGateway TaskGatewayObject = new TaskGateway();
         List <Task> taskListObject    = TaskGatewayObject.SelectAllOpenTaskOfTheProject(projectDropDownList.SelectedItem.Value, employeeDropDownList.SelectedItem.Value);
         foreach (Task task in taskListObject)
         {
             string employeeId   = Session["userID"].ToString();
             string employeeName = Session["userName"].ToString();
             Task   taskObject   = new Task();
             taskObject.Id                 = task.Id;
             taskObject.Name               = task.Name;
             taskObject.Project_Id         = projectDropDownList.SelectedItem.Value;
             taskObject.Project_Title      = projectDropDownList.SelectedItem.Text;
             taskObject.Employee_Id        = employeeId;
             taskObject.Employee_AssignTo  = employeeName;
             taskObject.Employee_AssigenBy = employeeId;
             taskObject.StartDate          = System.DateTime.Now;
             TaskGatewayObject.ForwardTask(taskObject);
         }
     }
     catch (SqlException sqlExceptionObject)
     {
         errorLabel.Text = sqlExceptionObject.Message;
     }
     catch (Exception exceptionObject)
     {
         errorLabel.Text = exceptionObject.Message;
     }
 }
コード例 #6
0
 protected void taskIdDropDownList_SelectedIndexChanged1(object sender, EventArgs e)
 {
     if (taskIdDropDownList.SelectedIndex.Equals(0))  // Item in index 0 is "-Select-" and not a valid item. So must not use
     {
         projectNameLabel.Text       = "";
         employeeNameLabel.Text      = "";
         taskNameTextBox.Text        = "";
         taskDescriptionTextBox.Text = "";
         startDateTextBox.Text       = "";
         estimatedDateTextBox.Text   = "";
         errorLabel.Text             = "";
         updateSuccessLabel.Text     = "";
         return;
     }
     try
     {
         TaskGateway TaskGatewayObject = new TaskGateway();
         Task        taskObject        = TaskGatewayObject.SelectTask(taskIdDropDownList.Text);
         projectNameLabel.Text       = taskObject.Project_Title;
         employeeNameLabel.Text      = taskObject.Employee_AssignTo;
         taskNameTextBox.Text        = taskObject.Name;
         taskDescriptionTextBox.Text = taskObject.Description;
         startDateTextBox.Text       = taskObject.StartDate.ToString();
         estimatedDateTextBox.Text   = taskObject.EstimatedTime.ToString();
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
コード例 #7
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        string message = null;

        Task taskObj = new Task();

        taskObj.Id                 = idLabel.Text;
        taskObj.Name               = nameLabel.Text;
        taskObj.Description        = descriptionLabel.Text;
        taskObj.Project_Title      = projectTitleLabel.Text;
        taskObj.StartDate          = Convert.ToDateTime(startDateLabel.Text);
        taskObj.EstimatedTime      = Convert.ToDateTime(estimateTimeLabel.Text);
        taskObj.Employee_AssignTo  = employeeNameLabel.Text;
        taskObj.Project_Id         = projectIdLabel.Text;
        taskObj.Employee_Id        = employeeIdLabel.Text;
        taskObj.Employee_AssigenBy = Session["userID"].ToString();

        try
        {
            TaskGateway TaskGateway = new TaskGateway();
            message = TaskGateway.InsertTask(taskObj).ToString();

            if (message == "True")
            {
                message = "Task information saved";
                Response.Redirect("TaskNewUIPage.aspx?" + "&message=" + Server.UrlEncode(message));
            }
            else
            {
                message = "Task information is not saved";
            }
        }
        catch (PrimaryKeyException primaryKeyExceptionObj)
        {
            errorMessageLabel.Text = primaryKeyExceptionObj.Message;
        }
        catch (SqlException sqlExceptionObj)
        {
            errorMessageLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorMessageLabel.Text = exceptionObj.Message;
        }
    }
コード例 #8
0
 private void LoadTaskInfo()
 {
     try
     {
         TaskGateway TaskGatewayObj = new TaskGateway();
         taskObj              = TaskGatewayObj.SelectTask(taskId);
         TaskIdLabel.Text     = taskObj.Id;
         TaskNameLabel.Text   = taskObj.Name;
         taskStatusLabel.Text = taskObj.TaskStatus;
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
コード例 #9
0
 /// <summary>
 /// Fills up tasksOfUserBulletedList DDL
 /// </summary>
 private void FillTaskOfUser()
 {
     try
     {
         TaskGateway TaskGatewayObj = new TaskGateway();
         numberOfTasksLabel.Text                = TaskGatewayObj.GetAllOpenTasksOfAUser(employeeId).Count + " task(s) " + " \nAssigened to this employee  \n";
         tasksOfUserBulletedList.DataSource     = TaskGatewayObj.GetAllOpenTasksOfAUser(employeeId);
         tasksOfUserBulletedList.DataTextField  = "Name";
         tasksOfUserBulletedList.DataValueField = "ID";
         tasksOfUserBulletedList.DataBind();
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
コード例 #10
0
    protected void updateButton_Click(object sender, EventArgs e)
    {
        if (!CheckInputValues())
        {
            return;
        }

        Task taskObject = new Task();

        taskObject.Id            = taskIdDropDownList.Text;
        taskObject.Name          = taskNameTextBox.Text;
        taskObject.Description   = taskDescriptionTextBox.Text;
        taskObject.StartDate     = Convert.ToDateTime(startDateTextBox.Text);
        taskObject.EstimatedTime = Convert.ToDateTime(estimatedDateTextBox.Text);

        try
        {
            TaskGateway TaskGateway = new TaskGateway();
            string      message     = TaskGateway.UpdateTask(taskObject).ToString();

            if (message == "True")
            {
                updateSuccessLabel.Text = "Task has been updated.";
            }
            else
            {
                updateSuccessLabel.Text = "Task is not updated";
            }

            // updateSuccessLabel.Text = message;
            errorLabel.Text = "";
        }
        catch (SqlException sqlExceptionObj)
        {
            errorLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorLabel.Text = exceptionObj.Message;
        }
    }
コード例 #11
0
    protected void saveButton_Click(object sender, EventArgs e)
    {
        string message = null;

        try
        {
            Employee employeeObj = new Employee();
            employeeObj.ID          = employeeIdLabel.Text;
            employeeObj.Name        = employeeNameLabel.Text;
            employeeObj.Address     = employeeAddressLabel.Text;
            employeeObj.PhoneNo     = employeePhoneLabel.Text;
            employeeObj.Email       = employeeEmailLabel.Text;
            employeeObj.JoiningDate = Convert.ToDateTime(joinDateLabel.Text);
            employeeObj.DOB         = Convert.ToDateTime(dOBLabel.Text);
            TaskGateway     TaskGatewayObj        = new TaskGateway();
            EmployeeGateway EmployeeGatewayObject = new EmployeeGateway();
            message = EmployeeGatewayObject.InsertEmployee(employeeObj).ToString();
            if (message == "True")
            {
                message = "Employee Data has been Saved";
            }
            else
            {
                message = "Employee Data has not been Saved";
            }

            Response.Redirect("EmployeeUIPage.aspx?" + "&message=" + Server.UrlEncode(message));
        }
        catch (PrimaryKeyException primaryKeyExceptionObj)
        {
            errorMessageLabel.Text = primaryKeyExceptionObj.Message;
        }
        catch (SqlException sqlExceptionObj)
        {
            errorMessageLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorMessageLabel.Text = exceptionObj.Message;
        }
    }
コード例 #12
0
 /// <summary>
 /// Loads task information in the page
 /// </summary>
 private void LoadTaskInfo()
 {
     try
     {
         TaskGateway TaskGatewayObj = new TaskGateway();
         Task        taskObj        = TaskGatewayObj.SelectTask(taskDropDownList.SelectedItem.Value);
         employeeNameTextBox.Text  = taskObj.Employee_AssignTo;
         employeeIdTextBox.Text    = taskObj.Employee_Id;
         descriptionTextBox.Text   = taskObj.Description;
         startDateTextBox.Text     = Convert.ToString(taskObj.StartDate);
         estimatedDateTextBox.Text = Convert.ToString(taskObj.EstimatedTime);
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
コード例 #13
0
    protected void DropDownListProject_SelectedIndexChanged1(object sender, EventArgs e)
    {
        //When project changes this information is no longer valid. so removed
        errorLabel.Text = "";
        taskDropDownList.Items.Clear();
        employeeNameTextBox.Text  = "";
        employeeIdTextBox.Text    = "";
        descriptionTextBox.Text   = "";
        startDateTextBox.Text     = "";
        estimatedDateTextBox.Text = "";
        allCommentTextBox.Text    = "";

        if (projectDropDownList.SelectedIndex.Equals(0))  // Item in index 0 is "-Select-" and not a valid item. So must not use
        {
            return;
        }

        try
        {
            TaskGateway TaskGatewayObj = new TaskGateway();
            taskDropDownList.DataSource     = TaskGatewayObj.SelectAllTasksOfTheProject(projectDropDownList.SelectedItem.Value);
            taskDropDownList.DataTextField  = "Name";
            taskDropDownList.DataValueField = "ID";
            taskDropDownList.DataBind();

            if (TaskGatewayObj.SelectAllTasksOfTheProject(projectDropDownList.SelectedItem.Value).Count == 0)
            {
                errorLabel.Text = "This project has no task";
            }
        }
        catch (SqlException sqlExceptionObj)
        {
            errorLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorLabel.Text = exceptionObj.Message;
        }
    }
コード例 #14
0
 /// <summary>
 /// Loads task information in the page
 /// </summary>
 private void LoadTaskInfo()
 {
     try
     {
         TaskGateway TaskGatewayObj = new TaskGateway();
         taskObj                     = TaskGatewayObj.SelectTask(taskId);
         taskIdTextBox.Text          = taskObj.Id;
         taskNameTextBox.Text        = taskObj.Name;
         projectNameTextBox.Text     = taskObj.Project_Title;
         taskDescriptionTextBox.Text = taskObj.Description;
         startDateTextBox.Text       = Convert.ToString(taskObj.StartDate);
         estimateDateTexeBox.Text    = Convert.ToString(taskObj.EstimatedTime);
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
コード例 #15
0
 /// <summary>
 /// Forwards a task
 /// </summary>
 private void ForwardTask()
 {
     try
     {
         TaskGateway TaskGatewayObj = new TaskGateway();
         Task        taskObject     = new Task();
         taskObject.Id                 = taskIdTextBox.Text;
         taskObject.Employee_Id        = employeeNameDropDownList.SelectedItem.Value;
         taskObject.Employee_AssignTo  = employeeNameDropDownList.SelectedItem.Text;
         taskObject.Employee_AssigenBy = taskObj.Employee_Id;
         taskObject.Project_Id         = projectNameTextBox.Text;
         taskObject.StartDate          = System.DateTime.Now;
         string forwardStatus = TaskGatewayObj.ForwardTask(taskObject).ToString();
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
 public TaskManager()
 {
     taskGateway = new TaskGateway();
 }
コード例 #17
0
 public ProjectManager()
 {
     projectGateway = new ProjectGateway();
     taskGateway    = new TaskGateway();
 }