예제 #1
0
        private void createbutton_Click(object sender, EventArgs e)
        {
            foreach (Project p in FakeProjectRepository._Projects)
            {
                if (newname == p.Name)
                {
                    id = p.Id;
                }
            }
            FakeFeatureRepository featureRepository = new FakeFeatureRepository();
            Feature feature = new Feature();

            feature.Title     = textBox1.Text.Trim();
            feature.ProjectId = id;
            string result = featureRepository.Add(feature);

            if (result == FakeFeatureRepository.NO_ERROR)
            {
                MessageBox.Show("Project added successfully");
            }
            else
            {
                MessageBox.Show(result);
            }
            this.Close();
        }
예제 #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);
        }
예제 #3
0
        private void comboBoxFeat_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            FakeFeatureRepository Fake = new FakeFeatureRepository();
            Feature feat         = new Feature();
            string  selectedFeat = comboBoxFeature.Text;

            feat       = Fake.GetFeatureByTitle(selectedFeat);
            _NewFeatID = feat.ID;
        }
예제 #4
0
        private void removeToolStripMenuItem1_Click(object sender, System.EventArgs e)
        {
            FormSelectRequirement     form = new FormSelectRequirement(selected_id);
            FakeFeatureRepository     fakeFeatureRepository     = new FakeFeatureRepository(selected_id);
            FakeRequiremnetRepository fakeRequiremnetRepository = new FakeRequiremnetRepository(selected_id);

            form.ShowDialog();
            Requirement  r            = fakeRequiremnetRepository.GetRequirementByID(form.selectedRequirementID);
            string       del          = "Are you sure you want to delete " + r.Statement + " ?";
            DialogResult dialogResult = MessageBox.Show(del, "Confirmation", MessageBoxButtons.YesNo);

            if (form.DialogResult == DialogResult.OK)
            {
                fakeRequiremnetRepository.Remove(r);
            }
        }
예제 #5
0
        private void modifybutton_Click(object sender, EventArgs e)
        {
            Feature modified = new Feature();
            FakeFeatureRepository featureRepository = new FakeFeatureRepository();

            modified.Id        = featid;
            modified.ProjectId = proid;
            modified.Title     = textBox1.Text.Trim();
            string result = featureRepository.Modify(modified);

            if (result == FakeFeatureRepository.NO_ERROR)
            {
                MessageBox.Show("Feature Modified Successfully");
            }
            else
            {
                MessageBox.Show(result);
            }
            this.Close();
        }
예제 #6
0
        private void removeToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            FormSelectFeature         formSelect                = new FormSelectFeature(selected_id);
            FakeFeatureRepository     fakeFeatureRepository     = new FakeFeatureRepository(selected_id);
            FakeRequiremnetRepository fakeRequiremnetRepository = new FakeRequiremnetRepository(selected_id);

            formSelect.ShowDialog();
            if (formSelect.DialogResult == DialogResult.OK)
            {
                Feature      tmp          = fakeFeatureRepository.GetFeatureByID(formSelect.selectedFeatureID);
                int          count        = fakeRequiremnetRepository.CountByFeatureID(formSelect.selectedFeatureID);
                string       del          = "Are you sure you want to delete " + tmp.Title;
                string       associated   = "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" + tmp.Title + "?";
                DialogResult dialogResult = MessageBox.Show(del, "Confirmation", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    if (count > 0)
                    {
                        DialogResult dialogResult2 = MessageBox.Show(associated, "Confirmation", MessageBoxButtons.YesNo);
                        if (dialogResult2 == DialogResult.Yes)
                        {
                            fakeFeatureRepository.Remove(tmp);
                            fakeRequiremnetRepository.RemoveByFeatureID(tmp.Id);
                        }
                        else
                        {
                            MessageBox.Show("Delete cancelled", "Attention");
                        }
                    }
                }
                else if (dialogResult == DialogResult.No)
                {
                    MessageBox.Show("Delete cancelled", "Attention");
                }
            }
            formSelect.Dispose();
        }