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(); } } } }
public void fillDropDown() { List <Feature> features = _FakeFeatureRepository.GetAll(this.activeProjectId); foreach (Feature feature in features) { dropDownFeatures.Items.Add(feature.Title); } if (action == ActionTypes.Modify) { Feature requirementFeature = _FakeFeatureRepository.GetFeatureById(modifyRequirement.FeatureId); this.dropDownFeatures.SelectedIndex = dropDownFeatures.Items.IndexOf(requirementFeature.Title); } }
public FormFeatureModify(int featureId) { InitializeComponent(); this.featureToModify.Id = _FakeFeatureRepository.GetFeatureById(featureId).Id; this.featureToModify.ProjectId = _FakeFeatureRepository.GetFeatureById(featureId).ProjectId; }