private void ClickAddRequirementBtn(object sender, EventArgs e) { ShowAddRequirementDialog showAddRequirementDialog = new ShowAddRequirementDialog(); showAddRequirementDialog.Text = _projectComboBox.Text; if (showAddRequirementDialog.ShowDialog() == DialogResult.OK) { Requirement requirement = new Requirement(); if (showAddRequirementDialog.GetRequirementName() == "" || showAddRequirementDialog.GetRequirementDescription() == "") { MessageBox.Show("輸入框偵測到空白\n請重新加入需求", "Wrong format", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (_manages.RequirementManage.GetRequirements((Project)_projectComboBox.SelectedItem).Exists(c => c.RequirementName == showAddRequirementDialog.GetRequirementName())) { MessageBox.Show("已存在 " + showAddRequirementDialog.GetRequirementName() + "\n請重新加入需求", "Wrong Added", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { requirement.RequirementName = showAddRequirementDialog.GetRequirementName(); requirement.RequirementDescription = showAddRequirementDialog.GetRequirementDescription(); requirement.Project = (Project)_projectComboBox.SelectedItem; _manages.RequirementManage.addRequirement(requirement); ChangeRequirementDataSource(); UpdateTraceAbilityMatrix(); } } }
private void SelectRequirementGridViewEvent(object sender, DataGridViewCellEventArgs e) { int selectedRow = e.RowIndex; String getRequirementNameFromDataGridView; String getRequirementDescriptionFromDataGridView; DialogResult result; if (e.ColumnIndex == 0 && selectedRow > -1) { getRequirementNameFromDataGridView = _requirementGridView.Rows[selectedRow].Cells[2].Value.ToString(); getRequirementDescriptionFromDataGridView = _requirementGridView.Rows[selectedRow].Cells[3].Value.ToString(); ShowAddRequirementDialog requirementDialog = new ShowAddRequirementDialog(); requirementDialog.EditRequirementName(getRequirementNameFromDataGridView); requirementDialog.EditRequirementDescription(getRequirementDescriptionFromDataGridView); if (requirementDialog.ShowDialog() == DialogResult.OK) { _model.editRequirement(requirementDialog.GetRequirementName(), requirementDialog.GetRequirementDescription(), selectedRow); _model.getTraceAbilityMatrixFromSelectProject(_traceAbilityMatrixGridView); } } else if (e.ColumnIndex == 1 && selectedRow > -1) { getRequirementNameFromDataGridView = _requirementGridView.Rows[selectedRow].Cells[2].Value.ToString(); getRequirementDescriptionFromDataGridView = _requirementGridView.Rows[selectedRow].Cells[3].Value.ToString(); result = MessageBox.Show("確定要刪除需求: " + getRequirementNameFromDataGridView + " 嗎?", "確定刪除", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { _model.deleteRequirement(selectedRow); _model.getTraceAbilityMatrixFromSelectProject(_traceAbilityMatrixGridView); } } }
private void SelectRequirementGridViewEvent(object sender, DataGridViewCellEventArgs e) { int selectedRow = e.RowIndex; String getRequirementNameFromDataGridView; String getRequirementDescriptionFromDataGridView; DialogResult result; if (e.ColumnIndex == 0 && selectedRow > -1) { Requirement requirement = (Requirement)_requirementGridView.Rows[selectedRow].DataBoundItem; ShowAddRequirementDialog requirementDialog = new ShowAddRequirementDialog(requirement); if (requirementDialog.ShowDialog() == DialogResult.OK) { requirement.RequirementName = requirementDialog.GetRequirementName(); requirement.RequirementDescription = requirementDialog.GetRequirementDescription(); ChangeRequirementDataSource(); UpdateTraceAbilityMatrix(); } } else if (e.ColumnIndex == 1 && selectedRow > -1) { Requirement requirement = (Requirement)_requirementGridView.Rows[selectedRow].DataBoundItem; getRequirementNameFromDataGridView = _requirementGridView.Rows[selectedRow].Cells[2].Value.ToString(); getRequirementDescriptionFromDataGridView = _requirementGridView.Rows[selectedRow].Cells[3].Value.ToString(); result = MessageBox.Show("確定要刪除需求: " + getRequirementNameFromDataGridView + " 嗎?", "確定刪除", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { _manages.RequirementManage.deleteRequirement(requirement); ChangeRequirementDataSource(); UpdateTraceAbilityMatrix(); } } }
private void ClickAddRequirementBtn(object sender, EventArgs e) { ShowAddRequirementDialog showAddRequirementDialog = new ShowAddRequirementDialog(); showAddRequirementDialog.Text = _projectComboBox.Text; if (showAddRequirementDialog.ShowDialog() == DialogResult.OK) { string requirementName = showAddRequirementDialog.GetRequirementName(); string requirementDescription = showAddRequirementDialog.GetRequirementDescription(); _model.addRequirement(requirementName, requirementDescription); _model.getTraceAbilityMatrixFromSelectProject(_traceAbilityMatrixGridView); } }