private void buttonSelectIssue_Click(object sender, EventArgs e) { targetId = Int32.Parse(dataGrid.CurrentRow.Cells[0].Value.ToString()); if (targetId != 0) { if (action == "Modify") { FormFeatureModify form = new FormFeatureModify(targetId); form.ShowDialog(); dataGrid.Rows.Clear(); FillGrid(); } if (action == "Remove") { if (MessageBox.Show("Are you sure you want to remove: " + _FakeFeatureRepository.GetFeatureById(targetId).Title, "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) { FakeRequirementRepository _FakeRequirementRepository = new FakeRequirementRepository(); if (_FakeRequirementRepository.CountByFeatureId(targetId) > 0) { if (MessageBox.Show("There are one or more requirements associated with this feature" + "These requirements will be destroyed if you remove this feature." + "Are you sure you want to remove: " + _FakeFeatureRepository.GetFeatureById(targetId).Title, "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) { _FakeFeatureRepository.Remove(_FakeFeatureRepository.GetFeatureById(targetId)); dataGrid.Rows.Clear(); FillGrid(); } else { MessageBox.Show("Remove cancelled.", "Attention"); Close(); } } else { _FakeFeatureRepository.Remove(_FakeFeatureRepository.GetFeatureById(targetId)); dataGrid.Rows.Clear(); FillGrid(); } } else { MessageBox.Show("Remove cancelled.", "Attention"); Close(); } } } }
private void featureSelectComboBox_SelectedIndexChanged(object sender, EventArgs e) { FakeFeatureRepository fakeFeature = new FakeFeatureRepository(); Feature selectedFeature = fakeFeature.GetFeatureByTitle(featureSelectComboBox.SelectedItem.ToString()); this.selectedFeatureId = selectedFeature.Id; requirementDataGridView1.Rows.Clear(); FakeRequirementRepository fakereq = new FakeRequirementRepository(); List <Requirement> requirementList = fakereq.GetAll(this.selectedProjectId); foreach (Requirement req in requirementList) { if (req.FeatureId == this.selectedFeatureId) { requirementDataGridView1.Rows.Add(req.Id, req.Statement); } } }
private void selectRequirementButton_Click(object sender, EventArgs e) { if (this.selectedFeatureId != -1) { if (requirementDataGridView1.SelectedCells.Count == 1 || requirementDataGridView1.SelectedRows.Count == 1) { int requirementId = Int32.Parse(requirementDataGridView1.CurrentRow.Cells[0].Value.ToString()); FakeRequirementRepository fakeRequirement = new FakeRequirementRepository(); Requirement req = fakeRequirement.GetRequirementById(requirementId); FormRequirementCreate RequirementForm = new FormRequirementCreate(this.selectedProjectId, FormRequirementCreate.ActionTypes.Modify, req); RequirementForm.ShowDialog(); Close(); } else { MessageBox.Show("A requirement must be chosen", "Attention"); } } else { MessageBox.Show("A feature must be chosen", "Attention"); } }