public FormRemoveRequirement(int projectId) { InitializeComponent(); this.projectId = projectId; repo = new FakeRequirementRepository(); DialogResult = DialogResult.Cancel; }
private void FormRemoveFeature_Load(object sender, EventArgs e) { FakeRequirementRepository reqRep = new FakeRequirementRepository(); FormSelectFeature form = new FormSelectFeature(projectId); form.ShowDialog(); CenterToScreen(); Feature feature; if (form.DialogResult == DialogResult.OK) { feature = repo.GetFeatureById(form.selectedId); DialogResult result = MessageBox.Show("Are you sure you want to remove : " + feature.Title, "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (reqRep.CountByFeatureId(feature.Id) != 0) { result = 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: " + feature.Title, "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { reqRep.RemoveByFeatureId(feature.Id); repo.Remove(feature); } } else { repo.Remove(feature); } } } Close(); }