コード例 #1
0
        private void SelectTestGridViewEvent(object sender, DataGridViewCellEventArgs e)
        {
            int    selectedRow = e.RowIndex;
            String getTestNameFromDataGridView;
            String getTestDescriptionFromDataGridView;

            if (e.ColumnIndex == 0 && selectedRow > -1)
            {
                ShowAddTestDialog testDialog = new ShowAddTestDialog((Test)_testGridView.Rows[selectedRow].DataBoundItem, _model);

                if (testDialog.ShowDialog() == DialogResult.OK)
                {
                    _model.getTraceAbilityMatrixFromSelectProject(_traceAbilityMatrixGridView);
                }
            }
            else if (e.ColumnIndex == 1 && selectedRow > -1)
            {
                getTestNameFromDataGridView        = _testGridView.Rows[selectedRow].Cells[2].Value.ToString();
                getTestDescriptionFromDataGridView = _testGridView.Rows[selectedRow].Cells[3].Value.ToString();
                DialogResult result = MessageBox.Show("確定要刪除需求: " + getTestNameFromDataGridView + " 嗎?", "確定刪除", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    _model.deleteTest(selectedRow);
                    _model.getTraceAbilityMatrixFromSelectProject(_traceAbilityMatrixGridView);
                }
            }
            else
            {
                TestDetailInfo testInfo = new TestDetailInfo((Test)_testGridView.Rows[selectedRow].DataBoundItem);
                testInfo.ShowDialog();
            }
        }
コード例 #2
0
        private void ClickAddTestBtn(object sender, EventArgs e)
        {
            ShowAddTestDialog showAddTestDialog = new ShowAddTestDialog((Project)_projectComboBox.SelectedItem, _manages);

            if (showAddTestDialog.ShowDialog() == DialogResult.OK)
            {
                Test test = new Test();
                if (showAddTestDialog.GetTestName() == "" || showAddTestDialog.GetTestDescription() == "")
                {
                    MessageBox.Show("輸入框偵測到空白\n請重新加入測試", "Wrong format", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (_manages.TestManage.GetTests((Project)_projectComboBox.SelectedItem).Exists(c => c.TestName == showAddTestDialog.GetTestName()))
                {
                    MessageBox.Show("已存在 " + showAddTestDialog.GetTestName() + "\n請重新加入測試", "Wrong Added", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    test.TestName        = showAddTestDialog.GetTestName();
                    test.TestDescription = showAddTestDialog.GetTestDescription();
                    test.Project         = (Project)_projectComboBox.SelectedItem;
                    List <Requirement> requirements = showAddTestDialog.GetRequirements();
                    _manages.TestManage.addTest(test, requirements);
                    ChangeTestDataSource();
                    UpdateTraceAbilityMatrix();
                }
            }
        }
コード例 #3
0
        private void ClickAddTestBtn(object sender, EventArgs e)
        {
            ShowAddTestDialog showAddTestDialog = new ShowAddTestDialog(_model);

            if (showAddTestDialog.ShowDialog() == DialogResult.OK)
            {
                _model.addTest(showAddTestDialog.GetTest());
                _model.getTraceAbilityMatrixFromSelectProject(_traceAbilityMatrixGridView);
            }
        }
コード例 #4
0
        private void SelectTestGridViewEvent(object sender, DataGridViewCellEventArgs e)
        {
            int    selectedRow = e.RowIndex;
            String getTestNameFromDataGridView;
            String getTestDescriptionFromDataGridView;

            if (e.ColumnIndex == 0 && selectedRow > -1)
            {
                Test test = (Test)_testGridView.Rows[selectedRow].DataBoundItem;
                ShowAddTestDialog testDialog = new ShowAddTestDialog((Project)_projectComboBoxTest.SelectedItem, test, _manages);

                if (testDialog.ShowDialog() == DialogResult.OK)
                {
                    test.TestName        = testDialog.GetTestName();
                    test.TestDescription = testDialog.GetTestDescription();
                    _manages.TestManage.editTest(test, testDialog.GetRequirements());
                    ChangeTestDataSource();
                    UpdateTraceAbilityMatrix();
                }
            }
            else if (e.ColumnIndex == 1 && selectedRow > -1)
            {
                Test test = (Test)_testGridView.Rows[selectedRow].DataBoundItem;
                getTestNameFromDataGridView        = _testGridView.Rows[selectedRow].Cells[2].Value.ToString();
                getTestDescriptionFromDataGridView = _testGridView.Rows[selectedRow].Cells[3].Value.ToString();
                DialogResult result = MessageBox.Show("確定要刪除需求: " + getTestNameFromDataGridView + " 嗎?", "確定刪除", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    _manages.TestManage.deleteTest(test);
                    ChangeTestDataSource();
                    UpdateTraceAbilityMatrix();
                }
            }
            else
            {
                if (e.RowIndex > -1)
                {
                    TestDetailInfo testInfo = new TestDetailInfo(_manages, (Test)_testGridView.Rows[selectedRow].DataBoundItem, (Project)_projectComboBoxTest.SelectedItem);

                    if (testInfo.ShowDialog() == DialogResult.OK)
                    {
                        UpdateTraceAbilityMatrix();
                    }
                }
            }
        }