Пример #1
0
 private void ClickNewTestButton(object sender, EventArgs e)
 {
     if (_requirementGridView.Rows.Count > 0)
     {
         int RequirementStatus = Convert.ToInt32(_requirementGridView.Rows[0].Cells[4].Value);
         if (_requirementGridView.Rows[0].DefaultCellStyle.BackColor == Color.Yellow || _requirementGridView.Rows[0].DefaultCellStyle.BackColor == Color.GreenYellow)
             return;
     }
     if (_projectComboBox.Text != "")
     {
         TestManage testForm = new TestManage(_presentationModel, _projectComboBox.Text);
         if (testForm.ShowDialog() == DialogResult.OK)
             InitializeTestGridView();
     }
 }
Пример #2
0
 private void ClickTestGridViewCell(object sender, DataGridViewCellEventArgs e)
 {
     ComboBox comboBox;
     DataGridViewComboBoxCell requirementComboBox;
     if (e.RowIndex >= 0)
     {
         switch (e.ColumnIndex)
         {
             case 5:
                 //design by http://stackoverflow.com/questions/241100/how-to-manually-drop-down-a-datagridviewcomboboxcolumn
                 _testGridView.BeginEdit(true);
                 comboBox = (ComboBox)_testGridView.EditingControl;
                 comboBox.DroppedDown = true;
                 break;
             case 6:
                 requirementComboBox = (DataGridViewComboBoxCell)_testGridView.Rows[e.RowIndex].Cells[5];
                 List<string> requirements = new List<string>();
                 for (int i = 0; i < requirementComboBox.Items.Count; i++)
                 {
                     requirements.Add(requirementComboBox.Items[i].ToString());
                 }
                 TestManage testForm = new TestManage(_presentationModel, _projectComboBox.Text, _testGridView.Rows[e.RowIndex].Cells[2].Value.ToString(), _testGridView.Rows[e.RowIndex].Cells[3].Value.ToString(), requirements);
                 if (testForm.ShowDialog() == DialogResult.OK)
                     InitializeTestGridView();
                 else
                     _testGridView.SelectedCells[0].Selected = false;
                 break;
             case 7:
                 _presentationModel.DeleteTest(_projectComboBox.Text, _testGridView.Rows[e.RowIndex].Cells[2].Value.ToString());
                 InitializeTestGridView();
                 break;
             default:
                 _testGridView.SelectedCells[0].Selected = false;
                 break;
         }
     }
 }