private void removeToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            FakeRequirementRepository requirementRepository = new FakeRequirementRepository();

            FormSelectFeature selectAFeature = new FormSelectFeature(currentProjectID);

            selectAFeature.ShowDialog();

            if (selectAFeature.featureId != -1)
            {
                DialogResult messageBoxResult = MessageBox.Show("Are you sure you want to remove: " + featureRepository.GetFeatureById(selectAFeature.featureId).Title, "Confirmation", MessageBoxButtons.YesNo);
                if (messageBoxResult == DialogResult.Yes)
                {
                    DialogResult messageBoxResultTwo = DialogResult.No;
                    if (requirementRepository.CountByFeatureId(selectAFeature.featureId) > 0)
                    {
                        messageBoxResultTwo = MessageBox.Show("There are one or more requirements associated with this feature These Requirements will be destoryed if you remove this feature. Are you sure you want to remove: " + featureRepository.GetFeatureById(selectAFeature.featureId).Title, "Confirmation", MessageBoxButtons.YesNo);
                    }

                    if (messageBoxResultTwo == DialogResult.Yes || requirementRepository.CountByFeatureId(selectAFeature.featureId) == 0)
                    {
                        featureRepository.Remove(featureRepository.GetFeatureById(selectAFeature.featureId));
                        requirementRepository.RemoveByFeatureId(selectAFeature.featureId);
                    }
                }
                else
                {
                }
            }
            selectAFeature.Dispose();
        }
Exemplo n.º 2
0
        private void FormModifyReq_Load(object sender, EventArgs e)
        {
            this.CenterToParent();

            FakeFeatureRepository     Fake1 = new FakeFeatureRepository();
            FakeRequirementRepository Freq1 = new FakeRequirementRepository();
            List <Feature>            feats = new List <Feature>();
            Requirement req = new Requirement();

            req = Freq1.GetRequirementByID(_RequirementID);

            feats = Fake1.GetAll(_ProjectID);
            int index = 0;

            foreach (Feature feat in feats)
            {
                comboBoxFeature.Items.Add(feat.Title);
                if (feat.ID == _FeatureID)
                {
                    comboBoxFeature.SelectedIndex = index;
                }
                index++;
            }
            textBoxState.Text = req.Statement.ToString();

            this.comboBoxFeature.SelectedIndexChanged += new System.EventHandler(comboBoxFeat_SelectedIndexChanged);
        }
Exemplo n.º 3
0
        private void buttonModify_Click(object sender, EventArgs e)
        {
            FakeRequirementRepository Freq = new FakeRequirementRepository();
            Requirement req = new Requirement();
            string      error;

            req.ProjectID = _ProjectID;
            req.FeatureID = _NewFeatID;
            req.ID        = _RequirementID;
            req.Statement = textBoxState.Text;

            error = Freq.Modify(req);
            if (error != "")
            {
                MessageBox.Show(error, "Attention");
            }
            else
            {
                MessageBox.Show("Requirement Successfully Modified!", "Attention");
                this.Close();
            }
        }