コード例 #1
0
ファイル: RequestController.cs プロジェクト: Chators/Digger
 public RequestController(ProjectGateway projectGateway, RequestGateway requestGateway, DiggosService diggosService, GetAccessUser getAccessUser)
 {
     _projectGateway = projectGateway;
     _requestGateway = requestGateway;
     _diggosService  = diggosService;
     _getAccessUser  = getAccessUser;
 }
    /// <summary>
    /// Loads all open project of employee into project DDL
    /// </summary>
    private void LoadAllOpenProject()
    {
        try
        {
            string         employeeId           = Session["userID"].ToString();
            ProjectGateway ProjectGatewayObject = new ProjectGateway();
            int            noOfProject          = ProjectGatewayObject.SelectAllOpenProjects(employeeId).Count;
            projectDropDownList.DataSource = ProjectGatewayObject.SelectAllOpenProjects(employeeId);
            //Admin can remove an employee from a project only if he is a member of it

            projectDropDownList.DataTextField  = "Title";
            projectDropDownList.DataValueField = "ID";
            projectDropDownList.DataBind();
            if (noOfProject.Equals(0))
            {
                errorLabel.Text = "Admin is not a member of any project. Admin cant remove any employee";
            }
        }
        catch (SqlException sqlExceptionObject)
        {
            errorLabel.Text = sqlExceptionObject.Message;
        }
        catch (Exception exceptionObject)
        {
            errorLabel.Text = exceptionObject.Message;
        }
    }
コード例 #3
0
 protected void projectIdDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (projectIdDropDownList.SelectedIndex.Equals(0))
     {
         titleTextBox.Text        = "";
         descriptionTextBox.Text  = "";
         startDateTextBox.Text    = "";
         estimateDateTextBox.Text = "";
         projectStatusLabel.Text  = "";
         errorLabel.Text          = "";
         successLabel.Text        = "";
         clientNameDropDownList.Items.Clear();
         FillClientDropmDownList();
         return;
     }
     try
     {
         ProjectGateway ProjectGatewayObject = new ProjectGateway();
         Project        projectObject        = ProjectGatewayObject.SelectProject(projectIdDropDownList.Text);
         titleTextBox.Text           = projectObject.Title;
         descriptionTextBox.Text     = projectObject.Description;
         startDateTextBox.Text       = projectObject.StartDate.ToString();
         estimateDateTextBox.Text    = projectObject.EstimateTime.ToString();
         projectStatusLabel.Text     = projectObject.Status.ToString();
         clientNameDropDownList.Text = projectObject.ClientId;
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
コード例 #4
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;
        }
    }
    protected void saveButton_Click(object sender, EventArgs e)
    {
        Project        projectObj           = null;
        ProjectGateway ProjectGatewayObject = null;

        try
        {
            projectObj              = new Project();
            projectObj.ID           = idLabel.Text;
            projectObj.Title        = nameLabel.Text;
            projectObj.Description  = descriptionLabel.Text;
            projectObj.StartDate    = Convert.ToDateTime(startDateLabel.Text);
            projectObj.EstimateTime = Convert.ToDateTime(estimateTimeLabel.Text);
            projectObj.ClientId     = clientIdLabel.Text;
            projectObj.Employee_Id  = employeeIDs;
            projectObj.Status       = statusLabel.Text;

            ProjectGatewayObject = new ProjectGateway();
            string message = ProjectGatewayObject.InsertProject(projectObj).ToString();
            Response.Redirect("ProjectCreateUIPage.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;
        }
    }
コード例 #6
0
 protected void closeProjectButton_Click(object sender, EventArgs e)
 {
     if (projectDropDownList.SelectedIndex.Equals(0))
     {
         errorLabel.Text = "Please select a project";
         return;
     }
     try
     {
         Project projectObject = new Project();
         projectObject.ID     = projectDropDownList.SelectedItem.Value;
         projectObject.Status = "Close";
         ProjectGateway ProjectGatewayObject = new ProjectGateway();
         string         message = ProjectGatewayObject.CloseProject(projectObject).ToString();
         successLabel.Text = "Project has been closed";
         errorLabel.Text   = "";
         LoadAllOpenProject();
     }
     catch (SqlException sqlExceptionObject)
     {
         errorLabel.Text = sqlExceptionObject.Message;
     }
     catch (Exception exceptionObject)
     {
         errorLabel.Text = exceptionObject.Message;
     }
 }
    /// <summary>
    /// Remove an employee from project
    /// </summary>
    private void RemoveEmployee()
    {
        try
        {
            Project projectObject = new Project();
            projectObject.ID          = projectDropDownList.SelectedItem.Value;
            projectObject.Employee_Id = employeeDropDownList.SelectedItem.Value;
            ProjectGateway ProjectGatewayObject = new ProjectGateway();
            string         employeeRemoveStatus = ProjectGatewayObject.RemoveEmployeeFromProject(projectObject).ToString();
            successLabel.Text = employeeRemoveStatus;

            if (successLabel.Text == "True")
            {
                successLabel.Text = "Removed the employee to the project";
            }

            errorLabel.Text = "";
        }
        catch (SqlException sqlExceptionObject)
        {
            errorLabel.Text = sqlExceptionObject.Message;
        }
        catch (Exception exceptionObject)
        {
            errorLabel.Text = exceptionObject.Message;
        }
    }
コード例 #8
0
    /// <summary>
    /// Loads all open project of employee into project DDL
    /// </summary>
    private void LoadAllOpenProject()
    {
        try
        {
            string         employeeId           = Session["userID"].ToString();
            ProjectGateway ProjectGatewayObject = new ProjectGateway();
            projectDropDownList.DataSource     = ProjectGatewayObject.SelectAllOpenProjects();
            projectDropDownList.DataTextField  = "Title";
            projectDropDownList.DataValueField = "ID";
            projectDropDownList.DataBind();

            if (ProjectGatewayObject.SelectAllOpenProjects().Count == 0)
            {
                errorLabel.Text = "Admin is not a member of any project yet. Can't add employee(s) to any project";
            }
        }
        catch (SqlException sqlExceptionObject)
        {
            errorLabel.Text = sqlExceptionObject.Message;
        }
        catch (Exception exceptionObject)
        {
            errorLabel.Text = exceptionObject.Message;
        }
    }
コード例 #9
0
 public DiggosController(ProjectHub projectHub, RequestGateway requestGateway, ProjectGateway projectGateway, DGraphGateway dGraphGateway, GraphHub graphHub)
 {
     _projectGateway = projectGateway;
     _requestGateway = requestGateway;
     _dGraphGateway  = dGraphGateway;
     _projectHub     = projectHub;
     _graphHub       = graphHub;
 }
コード例 #10
0
    /// <summary>
    /// Load project Information
    /// </summary>
    private void LoadProjectInfo()
    {
        ProjectGateway ProjectGatewayObject = new ProjectGateway();
        Project        projectObject        = ProjectGatewayObject.SelectProject(projectDropDownList.SelectedItem.Value);

        clientIdLabel.Text      = projectObject.Client_Name;
        projectStatusLabel.Text = projectObject.Status;
    }
コード例 #11
0
ファイル: ProjectController.cs プロジェクト: Chators/Digger
 public ProjectController(ProjectGateway projectGateway, UserGateway userGateway, RequestGateway requestGateway, ProjectHub projectHub, DGraphGateway dGraphGateway, GetAccessUser getAccessUser)
 {
     _projectGateway = projectGateway;
     _userGateway    = userGateway;
     _requestGateway = requestGateway;
     _projectHub     = projectHub;
     _dGraphGateway  = dGraphGateway;
     _getAccessUser  = getAccessUser;
 }
コード例 #12
0
    protected void saveButton_Click(object sender, EventArgs e)
    {
        successLabel.Text = "";
        if (projectDropDownList.SelectedIndex.Equals(0))
        {
            errorLabel.Text = "Please select a project";
            return;
        }
        else if (selectedEmployeeListBox.Items.Count == 0)
        {
            errorLabel.Text = "Please select employee(s)";
            return;
        }

        string employeeNames = string.Empty;
        string employeeIDs   = string.Empty;

        try
        {
            foreach (ListItem item in selectedEmployeeListBox.Items)
            {
                employeeNames += item.Text + ",";
                employeeIDs   += item.Value + ",";
            }

            //removes the last coma from the string
            employeeNames = employeeNames.Substring(0, employeeNames.Length - 1);
            employeeIDs   = employeeIDs.Substring(0, employeeIDs.Length - 1);

            Project projectObject = new Project();
            projectObject.ID          = projectDropDownList.SelectedItem.Value;
            projectObject.Employee_Id = employeeIDs;
            ProjectGateway ProjectGatewayObject = new ProjectGateway();
            successLabel.Text = ProjectGatewayObject.AddEmployeeToProject(projectObject).ToString();

            if (successLabel.Text == "True")
            {
                successLabel.Text = "Added the new employee to the project";
            }

            errorLabel.Text = "";
            nonMemberEmployeeListBox.Items.Clear();
            selectedEmployeeListBox.Items.Clear();

            FillEmployeeListBox();
        }
        catch (SqlException sqlExceptionObj)
        {
            errorLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorLabel.Text = exceptionObj.Message;
        }
    }
コード例 #13
0
    protected void updateButton_Click(object sender, EventArgs e)
    {
        bool message = false;

        if (!CheckInputValues())
        {
            return;
        }

        Project projectObj = new Project();

        projectObj.ID           = projectIdDropDownList.Text;
        projectObj.Title        = titleTextBox.Text;
        projectObj.Description  = descriptionTextBox.Text;
        projectObj.StartDate    = Convert.ToDateTime(startDateTextBox.Text);
        projectObj.EstimateTime = Convert.ToDateTime(estimateDateTextBox.Text);
        projectObj.ClientId     = clientNameDropDownList.SelectedValue;
        //projectObj.Employee_Id = assignedToDropDownList.Text;
        projectObj.Status = projectStatusLabel.Text;


        try
        {
            ProjectGateway ProjectGatewayObject = new ProjectGateway();
            message           = ProjectGatewayObject.UpdateProject(projectObj);
            successLabel.Text = message.ToString();
            errorLabel.Text   = "";
        }
        catch (SqlException sqlExceptionObj)
        {
            errorLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorLabel.Text = exceptionObj.Message;
        }
        successLabel.Text = message.ToString();

        if (successLabel.Text == "True")
        {
            errorLabel.Text   = "";
            successLabel.Text = "Project details has been updated";
        }
        else
        {
            successLabel.Text = "";
            errorLabel.Text   = "Project details has not been updated";
        }

        LoadProjectData();
    }
コード例 #14
0
 /// <summary>
 /// Fills up projectGridView
 /// </summary>
 private void LoadProjectData()
 {
     try
     {
         ProjectGateway projectGatewayObj = new ProjectGateway();
         projectGridView.DataSource = projectGatewayObj.GetProjectTable();
         projectGridView.DataBind();
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
コード例 #15
0
 /// <summary>
 /// Loads all open project of employee into project DDL
 /// </summary>
 private void LoadAllOpenProject()
 {
     try
     {
         string         employeeId           = Session["userID"].ToString();
         ProjectGateway ProjectGatewayObject = new ProjectGateway();
         projectDropDownList.DataSource     = ProjectGatewayObject.SelectAllOpenProjects(employeeId);
         projectDropDownList.DataTextField  = "title";
         projectDropDownList.DataValueField = "ID";
         projectDropDownList.DataBind();
     }
     catch (SqlException sqlExceptionObject)
     {
         errorLabel.Text = sqlExceptionObject.Message;
     }
     catch (Exception exceptionObject)
     {
         errorLabel.Text = exceptionObject.Message;
     }
 }
コード例 #16
0
 /// <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;
     }
 }
コード例 #17
0
 /// <summary>
 /// Fills up projectDropDownList DDL
 /// </summary>
 private void LoadProjectDropDownList()
 {
     try
     {
         ProjectGateway ProjectGatewayObject = new ProjectGateway();
         projectDropDownList.DataSource     = ProjectGatewayObject.SelectAllOpenProjects();
         projectDropDownList.DataTextField  = "Title";
         projectDropDownList.DataValueField = "ID";
         projectDropDownList.DataBind();
         if (ProjectGatewayObject.SelectAllOpenProjects().Count == 0)
         {
             errorLabel.Text = "No project is created yet";
         }
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
コード例 #18
0
    /// <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;
        }
    }
コード例 #19
0
ファイル: GraphController.cs プロジェクト: Chators/Digger
 public GraphController(ProjectGateway projectGateway, DGraphGateway dGraphGateway, GetAccessUser getAccessUser)
 {
     _projectGateway = projectGateway;
     _dGraphGateway  = dGraphGateway;
     _getAccessUser  = getAccessUser;
 }
コード例 #20
0
ファイル: GetAccessUser.cs プロジェクト: Chators/Digger
 public GetAccessUser(UserGateway userGateway, ProjectGateway projectGateway)
 {
     _userGateway    = userGateway;
     _projectGateway = projectGateway;
 }
コード例 #21
0
 public ProjectController()
 {
     db = new ProjectGateway();
 }
コード例 #22
0
 public ProjectManager()
 {
     this.projectGateway = new ProjectGateway();
 }
コード例 #23
0
 public ProjectManager()
 {
     projectGateway = new ProjectGateway();
     taskGateway    = new TaskGateway();
 }
    /// <summary>
    /// Checks if admin can remove a employee
    /// </summary>
    /// <returns>true if admin can remove employee else false</returns>
    private bool CheckForEmployeeRemove()
    {
        successLabel.Text = "";

        try
        {
            string         employeeId           = Session["userID"].ToString();
            ProjectGateway ProjectGatewayObject = new ProjectGateway();
            int            numberOfProject      = ProjectGatewayObject.SelectAllOpenProjects(employeeId).Count;
            //Admin can remove an employee from a project only if he is a member of it
            //This counts the number of projects admin have


            EmployeeGateway EmployeeGatewayObject = new EmployeeGateway();
            int             numberOfEmployee      = EmployeeGatewayObject.GetAllEmployeesOfAProject(projectDropDownList.SelectedItem.Value).Count;
            //If there is only one project member then he cant be removed
            //This counts the number of members of the selected project

            UserGateway UserGatewayObjrct = new UserGateway();

            if (projectDropDownList.SelectedIndex.Equals(0))  // Item in index 0 is "-Select-" and not a valid item. So must not use
            {
                errorLabel.Text = "Please select a project";
                return(false);
            }
            else if (numberOfProject == 0)
            {
                errorLabel.Text = "Admin is not a member of any project. Admin cant remove any employee";
                return(false);
            }
            else if (numberOfEmployee == 1)
            {
                errorLabel.Text = "Only Admin is employee of the ptoject. Cant remove!";
                return(false);
            }
            else if (employeeDropDownList.SelectedIndex.Equals(0))  // Item in index 0 is "-Select-" and not a valid item. So must not use
            {
                errorLabel.Text = "Please select an employee to remove";
                return(false);
            }
            else if (UserGatewayObjrct.GetUserType(employeeDropDownList.SelectedItem.Value).ToString() == "True")
            {
                errorLabel.Text = "Admin cant be removed";
                return(false);
            }
            else
            {
                return(true);
            }
        }
        catch (NonUserEmployeeException nonUserEmployeeExceptionObject)
        {
            /*This exception occours when employee is not a user
             * but is a member of a project
             * A non user employee can be removed from the project
             * so true is returned
             * Admin will not be aware of this event as errorLabel.text will be removed when non user employee successfully removed
             * */
            errorLabel.Text = nonUserEmployeeExceptionObject.Message + "Can be removed";
            return(true);
        }
        catch (SqlException sqlExceptionObject)
        {
            errorLabel.Text = sqlExceptionObject.Message;
            return(false);
        }
        catch (Exception exceptionObject)
        {
            errorLabel.Text = exceptionObject.Message;
            return(false);
        }
    }