private void fillProjectListProgrammer(Data.UserInfo userInfo)
        {
            try {
                if (SQL.read.HasRows)
                {
                    while (SQL.read.Read())
                    {
                        // Create projectInfo object and add to arrayList
                        Data.ProjectInfo project = new Data.ProjectInfo(SQL.read[0].ToString(), SQL.read[1].ToString(), SQL.read[2].ToString(),
                                                                        SQL.read[3].ToString(), SQL.read[4].ToString(), SQL.read[5].ToString(), SQL.read[6].ToString(),
                                                                        SQL.read[7].ToString());
                        projects.Add(project);

                        // add to list box
                        listBoxProjects.Items.Add(String.Format("Title: {0}",
                                                                project.title));
                    }
                }
                else
                {
                    listBoxProjects.Items.Add(String.Format("No projects found for {0}", userInfo.username));
                }
            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }
示例#2
0
        public IssueDetailsPage(Data.IssueInfo issueInfo, String projectName, Data.UserInfo userInfo)
        {
            InitializeComponent();
            issue = issueInfo;
            this.StartPosition    = FormStartPosition.CenterParent;
            labelTitle.Text      += issue.issueid;
            labelReportDate.Text += FormHelper.getDateFromDT(issue.reportDate);
            labelProject.Text    += projectName;
            fillMaluableData();
            // stop focus of textbox
            textBoxDescription.GotFocus += textBox_GotFocus;
            textBoxStatus.GotFocus      += textBox_GotFocus;
            textBoxUrgency.GotFocus     += textBox_GotFocus;

            FormHelper.centerControlHalf(this, labelTitle);
            FormHelper.centerControlHalf(this, textBoxUrgency);
            FormHelper.centerControlHalf(this, textBoxStatus);
            FormHelper.centerControlHalf(this, textBoxDescription);
            FormHelper.centerControlHalf(this, labelReportDate);
            FormHelper.centerControlHalf(this, labelProject);

            if (userInfo.role == Data.UserInfo.PROGRAMMER_ROLE)
            {
                buttonUpdate.Hide();
                buttonUpdate.Enabled = false;
                FormHelper.centerControlHalf(this, buttonBack);
            }
        }
        public TaskDetailPage(Data.TaskInfo task, Data.UserInfo user)
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterParent;
            this.task          = task;

            compute();
        }
        public ProgrammerHome(Data.UserInfo userInfo)
        {
            InitializeComponent();
            this.userInfo      = userInfo;
            this.StartPosition = FormStartPosition.CenterParent;
            //  TODO: Too long username shorten
            labelWelcome.Text = String.Format("Welcome {0}", userInfo.username);

            FormHelper.centerControlHalf(this, labelWelcome);
        }
示例#5
0
        public ManagerHome(Data.UserInfo userInfo)
        {
            InitializeComponent();
            this.userInfo      = userInfo;
            this.StartPosition = FormStartPosition.CenterParent;

            // TODO: Trim username if longer than 0123456789012345678
            labelWelcome.Text = String.Format("Welcome {0}", userInfo.username);
            FormHelper.centerControlHalf(this, labelWelcome);
        }
示例#6
0
        public TaskPage(int projectid, Data.UserInfo userInfo)
        {
            InitializeComponent();
            projectidPass = projectid;
            this.userInfo = userInfo;

            this.StartPosition = FormStartPosition.CenterParent;
            listBoxTasks.HorizontalScrollbar = true;

            handleUserRole(userInfo);
        }
        public AddIssuePage(ArrayList listContent, Data.UserInfo userInfo)
        {
            InitializeComponent();
            this.userInfo                 = userInfo;
            this.StartPosition            = FormStartPosition.CenterParent;
            this.listContent              = listContent;
            comboBoxStatus.SelectedIndex  = 0;
            comboBoxUrgency.SelectedIndex = 0;

            fillListBox(listContent, userInfo);
        }
        public IssuesPage(Data.UserInfo userInfo)
        {
            InitializeComponent();
            this.userInfo = userInfo;

            this.StartPosition = FormStartPosition.CenterParent;
            listBoxIssues.HorizontalScrollbar = true;

            FormHelper.centerControlHalf(this, labelIssues);

            handleUserRole();
        }
示例#9
0
        private void handleUserRole(Data.UserInfo userInfo)
        {
            listBoxTasks.Items.Clear();
            switch (userInfo.role)
            {
            case Data.UserInfo.MANAGER_ROLE:
                SQL.selectTasksOnProjectid(projectidPass);
                break;

            case Data.UserInfo.PROGRAMMER_ROLE:
                SQL.getProgrammersTasks(userInfo.username);
                buttonAddTask.Text = "View Progress";
                break;
            }
            readInTasks();
        }
        public ProjectPage(Data.UserInfo userInfo)
        {
            InitializeComponent();
            this.userInfo      = userInfo;
            this.StartPosition = FormStartPosition.CenterParent;
            listBoxProjects.HorizontalScrollbar = true;

            FormHelper.centerControlHalf(this, labelProjects);



            // Get managers projects
            String query = String.Format("SELECT * FROM project JOIN manage " +
                                         "ON project.projectid = manage.projectid WHERE managerUsername = '******' ORDER BY status desc", userInfo.username);

            SQL.selectQuery(query);



            projects = new ArrayList();
            try {
                if (SQL.read.HasRows)
                {
                    while (SQL.read.Read())
                    {
                        // Create projectInfo object and add to arrayList
                        Data.ProjectInfo project = new Data.ProjectInfo(SQL.read[0].ToString(), SQL.read[1].ToString(), SQL.read[2].ToString(),
                                                                        SQL.read[3].ToString(), SQL.read[4].ToString(), SQL.read[5].ToString(), SQL.read[6].ToString(),
                                                                        SQL.read[7].ToString());
                        projects.Add(project);

                        // add to list box
                        listBoxProjects.Items.Add(String.Format("Title: {0} | Status: {1}",
                                                                project.title, project.status));
                    }
                }
                else
                {
                    listBoxProjects.Items.Add(String.Format("No projects found for {0}", userInfo.username));
                }
            } catch (Exception ex) {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex);
            }
        }
        // Fills projectComboBox with projects associated with issues and
        // returns list of those projects
        private void fillListBox(ArrayList content, Data.UserInfo userInfo)
        {
            switch (userInfo.role)
            {
            case Data.UserInfo.MANAGER_ROLE:
                foreach (Data.ProjectInfo project in content)
                {
                    listBoxContent.Items.Add(project.title);
                }
                break;

            case Data.UserInfo.PROGRAMMER_ROLE:
                labelProjectTask.Text = "Task:";
                foreach (Data.TaskInfo task in content)
                {
                    listBoxContent.Items.Add(task.name);
                }
                break;
            }
        }
        public ReportSelectPage(Data.UserInfo userInfo)
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterParent;
            listBoxProjects.HorizontalScrollbar = true;

            FormHelper.centerControlHalf(this, listBoxProjects);
            FormHelper.centerControlHalf(this, labelTitle);


            projects = new ArrayList();
            switch (userInfo.role)
            {
            case Data.UserInfo.MANAGER_ROLE:
                SQL.getManagerProjectAssc(userInfo.username);
                fillProjectListManager(userInfo);
                break;

            case Data.UserInfo.PROGRAMMER_ROLE:
                SQL.getProjectsForProgrammer(userInfo.username);
                fillProjectListProgrammer(userInfo);
                break;
            }
        }
示例#13
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            // hold userInfo
            Data.UserInfo userInfo = new Data.UserInfo();

            if (isEmptyInput())
            {
                return;
            }

            // get username and password from the text boxes
            try {
                userInfo.username = textBoxUserName.Text.Trim();
                userInfo.password = textBoxPassword.Text.Trim();
            } catch {
                MessageBox.Show("Username or Password given is in an incorrect format.");
                return;
            }

            userInfo.role = comboBoxRole.SelectedIndex;
            // query managers for username
            SQL.selectEmployee(userInfo.role, userInfo.username);

            Boolean loggedIn = false;

            // Check if table was returned -- Info has to be in first and only row as we used primary key to query
            try {
                if (SQL.read.HasRows)
                {
                    // read row
                    SQL.read.Read();
                    // check if combination exists
                    if (passwordMatches(userInfo))
                    {
                        // fill in other credentials
                        loggedIn = true;
                        fillRemainingCredentials(userInfo);
                        // Change window
                        Hide();

                        Form homePage;
                        switch (userInfo.role)
                        {
                        case 0:
                            homePage = new ProgrammerHome(userInfo);
                            break;

                        case 1:
                            homePage = new ManagerHome(userInfo);
                            break;

                        default:
                            throw new ArgumentNullException("No Role for user");
                        }
                        // open project view
                        homePage.ShowDialog();
                        this.Close();
                    }
                }
            } catch (Exception ex) {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex);
            }

            // wrong combination
            if (!loggedIn)
            {
                MessageBox.Show("Username and Password combination incorrect");
                textBoxUserName.Focus();
                return;
            }
        }
示例#14
0
 // returns true if username and password exists
 private Boolean passwordMatches(Data.UserInfo user)
 {
     return(user.password.Equals(SQL.read[1].ToString()));
 }
示例#15
0
 // Fills the remaining credentials of the user given that username and password checks out
 private void fillRemainingCredentials(Data.UserInfo user)
 {
     user.firstName = SQL.read[2].ToString();
     user.lastName  = SQL.read[3].ToString();
 }