private void IssueListViewLoad(object sender, EventArgs e) { keywordTextBox.Text = initialKeyword; selectSearchTypeComboBox.SelectedIndex = initialSearchType; issueList = issueController.searchIssues(keywordTextBox.Text, selectSearchTypeComboBox.SelectedIndex); issuesDataGridView.Rows.Clear(); if (user.Authority == (int)User.AuthorityEnum.GeneralUser) { foreach (Issue issue in issueList) { User reporter = userController.getUser(issue.ReporterId); User personInCharge = userController.getUser(issue.PersonInChargeId); issuesDataGridView.Rows.Add(new Object[] { issue.IssueId, issue.IssueName, issue.Priority, issue.Serverity, reporter.UserName, personInCharge.UserName, issue.ReportDate.Date, user.JoinedProjects.Find(x => x.ProjectId == issue.ProjectId).ProjectName, issue.State }); } } else { List <Project> allProjects = projectInfoController.getAllProjectList(user.UserId); foreach (Issue issue in issueList) { User reporter = userController.getUser(issue.ReporterId); User personInCharge = userController.getUser(issue.PersonInChargeId); issuesDataGridView.Rows.Add(new Object[] { issue.IssueId, issue.IssueName, issue.Priority, issue.Serverity, reporter.UserName, personInCharge.UserName, issue.ReportDate.Date, allProjects.Find(x => x.ProjectId == issue.ProjectId).ProjectName, issue.State }); } } }
private void updateView() { userModel.updateAuthenticatedUser(user.UserId); allProjectList = projectInfoController.getAllProjectList(user.UserId); allProjectList.Sort(compareProjectOrder); if (user.Authority == (int)User.AuthorityEnum.GeneralUser) { joinedProjectList = SecurityModel.getInstance().AuthenticatedUser.JoinedProjects; invitedProjectList = SecurityModel.getInstance().AuthenticatedUser.InvitedProjects; joinedProjectList.Sort(compareProjectOrder); invitedProjectList.Sort(compareProjectOrder); joinedProjectsDataGridView.Rows.Clear(); invitedProjectsDataGridView.Rows.Clear(); foreach (Project project in joinedProjectList) { joinedProjectsDataGridView.Rows.Add(new Object[] { project.ProjectId, project.ProjectName, project.Description.Replace("<br>", "; "), project.Manager }); } foreach (Project project in invitedProjectList) { invitedProjectsDataGridView.Rows.Add(new Object[] { project.ProjectId, project.ProjectName, project.Description.Replace("<br>", "; "), project.Manager, "接受", "拒絕" }); } } else { allProjectsDataGridView.Rows.Clear(); foreach (Project project in allProjectList) { allProjectsDataGridView.Rows.Add(new Object[] { project.ProjectId, project.ProjectName, project.Description.Replace("<br>", "; "), project.Manager }); } } }
public SecurityView(UserModel userModel, IssueModel issueModel, ProjectModel projectModel, ProjectMemberModel projectMemberModel) : base(userModel, issueModel, projectModel, projectMemberModel) { InitializeComponent(); this.userModel = userModel; this.issueModel = issueModel; this.projectModel = projectModel; this.projectMemberModel = projectMemberModel; userController = new UserController(userModel); securityController = new SecurityController(userModel); issueController = new IssueController(userModel, issueModel, projectModel); projectInfoController = new ProjectInfoController(projectModel); User user = SecurityModel.getInstance().AuthenticatedUser; usernameLabel.Text = user.UserName; emailAddressLabel.Text = user.EmailAddress; projectsNumberLabel.Text = projectInfoController.getAllProjectList(user.UserId).Count.ToString(); issuesNumberLabel.Text = issueController.getIssueList().Count.ToString(); usersNumberLabel.Text = securityController.listAccounts().Count.ToString(); editUsernameTextBox.Text = user.UserName; editEmailAddressTextBox.Text = user.EmailAddress; errorProvider = new ErrorProvider(); errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink; if (this.Owner == null) { base.logoutToolStripButton.Visible = true; base.logoutToolStripButton.Enabled = true; } }
private void searchTypeComboBoxSelectedIndexChanged(object sender, EventArgs e) { searchKeyComboBox.Items.Clear(); if (user.Authority == (int)User.AuthorityEnum.GeneralUser) { if (searchTypeComboBox.SelectedIndex == 0) { foreach (Project _project in user.JoinedProjects) { searchKeyComboBox.Items.Add(_project); } if (searchKeyComboBox.Items.Count > 0) { searchKeyComboBox.SelectedIndex = 0; } } else { searchKeyComboBox.Items.Add(user); searchKeyComboBox.SelectedIndex = 0; } } else { if (searchTypeComboBox.SelectedIndex == 0) { List <Project> projects = projectInfoController.getAllProjectList(user.UserId); foreach (Project _project in projects) { searchKeyComboBox.Items.Add(_project); } if (searchKeyComboBox.Items.Count > 0) { searchKeyComboBox.SelectedIndex = 0; } } else { List <User> users = securityController.listAccounts(); foreach (User _user in users) { searchKeyComboBox.Items.Add(_user); } if (searchKeyComboBox.Items.Count > 0) { searchKeyComboBox.SelectedIndex = 0; } } } }