private void CrtReq_Click(object sender, EventArgs e)
        {
            FakeRequirementRepository myReqs = new FakeRequirementRepository();
            FakeFeatureRepository     myFs   = new FakeFeatureRepository();
            Feature newF = new Feature();

            newF = myFs.GetFeatureByTitle(this.selFeat.SelectedItem.ToString());
            Requirement newR = new Requirement();

            newR.ProjectId = curProj;
            newR.FeatureId = newF.id;
            newR.Statement = this.statMentBox.Text.Trim();


            string addReq = myReqs.Add(newR);

            if (string.IsNullOrEmpty(addReq))
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show(addReq, "Error !");
            }
        }
예제 #2
0
        public FormSelectRequirement(FakeFeatureRepository featureRepo, FakeRequirementRepository requirementRepo, int project, int type)
        {
            InitializeComponent();

            formFeatureRepo     = featureRepo;
            formRequirementRepo = requirementRepo;
            selectedProject     = project;
            operationType       = type;
        }
예제 #3
0
        private void comboBoxFeat_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (comboBoxFeature.SelectedIndex != 0)
            {
                dataGridReqs.Enabled = true;
                buttonSelect.Enabled = true;

                this.dataGridReqs.DataSource = null;
                this.dataGridReqs.Rows.Clear();

                FakeRequirementRepository fakeReq = new FakeRequirementRepository();
                List <Requirement>        reqList = new List <Requirement>();
                string selF = comboBoxFeature.Text;

                foreach (Feature feat in Flist)
                {
                    if (feat.Title == selF)
                    {
                        _SelectedFeat = feat.ID;
                    }
                }

                reqList = Fake1.GetAll(_SelectedProj);



                dataGridReqs.ColumnCount        = 2;
                dataGridReqs.Columns[0].Name    = "ID";
                dataGridReqs.Columns[0].Width   = 30;
                dataGridReqs.Columns[1].Name    = "Requirement";
                dataGridReqs.Columns[1].Width   = 620;
                dataGridReqs.RowTemplate.Height = 20;

                foreach (Requirement req in reqList)
                {
                    if (req.FeatureID == _SelectedFeat)
                    {
                        string[] row = { req.ID.ToString(), req.Statement };
                        dataGridReqs.Rows.Add(row);
                    }
                }
                if (dataGridReqs.Rows.Count == 0)
                {
                    MessageBox.Show("This Feature Has No Requirements!\n Create Requirements to Modify Them.", "Attention");
                    dataGridReqs.Enabled = false;
                    buttonSelect.Enabled = false;
                }
            }
            else
            {
                this.dataGridReqs.DataSource = null;
                this.dataGridReqs.Rows.Clear();
                dataGridReqs.Enabled = false;
                buttonSelect.Enabled = false;
            }
        }
        private void selFeatToRem_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count == 0)
            {
                MessageBox.Show("A feature must be selected", "Error !");
            }
            else
            {
                int             selectedIndex = this.dataGridView1.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow   = this.dataGridView1.Rows[selectedIndex];

                int    selectedFeatureId    = Convert.ToInt32(selectedRow.Cells["featureId"].Value);
                string selectedFeatureTitle = selectedRow.Cells["featTitle"].Value.ToString();

                Feature featureToRemove = new Feature();
                featureToRemove.id        = selectedFeatureId;
                featureToRemove.ProjectId = curProjectId;
                featureToRemove.Title     = selectedFeatureTitle;

                FakeRequirementRepository myReqs  = new FakeRequirementRepository();
                FakeFeatureRepository     myFeats = new FakeFeatureRepository();

                if (myReqs.CountByFeatureId(selectedFeatureId) > 0)
                {
                    DialogResult confirmation = MessageBox.Show(String.Format("There are one or more requirements associateed with this feature" +
                                                                              "These requirements will be destroyed if you remove this feature.Are you sure you want to remove : {0}", selectedFeatureTitle), "Confirmation", MessageBoxButtons.YesNo);

                    if (confirmation == DialogResult.Yes)
                    {
                        string success = myFeats.Remove(featureToRemove);


                        myReqs.RemoveByFeatureId(selectedFeatureId);
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }

                    /*else
                     * {
                     *  this.DialogResult = DialogResult.Cancel;
                     *
                     * }*/
                }
                else
                {
                    DialogResult confirmation = MessageBox.Show(String.Format("Are you sure you want to remove : {0}", selectedFeatureTitle), "Confirmation", MessageBoxButtons.YesNo);
                    if (confirmation == DialogResult.Yes)
                    {
                        myFeats.Remove(featureToRemove);
                        this.Close();
                    }
                }
            }
        }
        private void selFeat_SelectedIndexChanged(object sender, EventArgs e)
        {
            FakeRequirementRepository myReqs  = new FakeRequirementRepository();
            FakeFeatureRepository     myFeats = new FakeFeatureRepository();
            Feature newFeature = new Feature();

            newFeature = myFeats.GetFeatureByTitle(this.selFeat.SelectedItem.ToString());
            if (newFeature.id != -1)
            {
                this.statMentBox.Enabled = true;
                this.CrtReq.Enabled      = true;
            }
            else
            {
                this.statMentBox.Enabled = false;
                this.CrtReq.Enabled      = false;
            }
        }
예제 #6
0
        private void selectButton_Click(object sender, EventArgs e)
        {
            if (dataRemove.SelectedCells.Count < 0)
            {
                MessageBox.Show("A must be selected.", "Attention");
            }
            else
            {
                _selectID = dataRemove.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow = dataRemove.Rows[_selectID];
                int             sID         = Convert.ToInt32(selectedRow.Cells["ID"].Value);

                _selectID = sID;

                FakeFeatureRepository fake1 = new FakeFeatureRepository();
                Feature f2 = fake1.GetFeatureByID(_selectID);
                FakeRequirementRepository req = new FakeRequirementRepository();


                DialogResult result = MessageBox.Show("Are you sure you want to Remove:" + f2.Title, "Confirmation", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    DialogResult result2 = MessageBox.Show("There are Requirements associated with this Feature.\n" + "These Requirements will also be deleted.", "Confirmation", MessageBoxButtons.YesNo);
                    if (result2 == DialogResult.Yes)
                    {
                        string res = fake1.Remove(f2);
                        req.RemoveByFeatureID(_selectID);
                    }
                    else
                    {
                        MessageBox.Show("Remove Canceled", "Attention", MessageBoxButtons.OK);
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Remove Canceled", "Attention", MessageBoxButtons.OK);
                }
            }
        }
예제 #7
0
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            FakeRequirementRepository freq1     = new FakeRequirementRepository();
            FakeFeatureRepository     fake2     = new FakeFeatureRepository();
            List <Feature>            listFeat1 = new List <Feature>();
            Requirement req = new Requirement();

            listFeat1 = fake2.GetAll(_selectProj);

            string s = comboBoxFeature.Text;

            foreach (Feature ft in listFeat1)
            {
                if (ft.Title == s)
                {
                    __selectFeat = ft.ID;
                }
            }


            req.ID        = freq1.GetNextReqID(_selectProj);
            req.ProjectID = _selectProj;
            req.FeatureID = __selectFeat;
            req.Statement = textBoxState.Text.Trim();

            string result = freq1.Add(req);

            if (result == "")
            {
                MessageBox.Show("Requirement Added Sucessfully", "", MessageBoxButtons.OK);
                this.Close();
            }
            else
            {
                MessageBox.Show(result, "Attention", MessageBoxButtons.OK);
                return;
            }
        }
예제 #8
0
        private void FormCreateReq_Load(object sender, EventArgs e)
        {
            this.CenterToParent();
            string isFeat;
            FakeFeatureRepository     fake     = new FakeFeatureRepository();
            FakeRequirementRepository freq     = new FakeRequirementRepository();
            List <Feature>            listFeat = new List <Feature>();

            listFeat = fake.GetAll(_selectProj);

            textBoxState.Enabled = false;
            buttonCreate.Enabled = false;

            comboBoxFeature.Items.Add("<Make Selection>");
            comboBoxFeature.SelectedIndex = 0;

            foreach (Feature f in listFeat)
            {
                isFeat = f.Title;
                comboBoxFeature.Items.Add(isFeat);
            }

            this.comboBoxFeature.SelectedIndexChanged += new System.EventHandler(comboBoxFeat_SelectedIndexChanged);
        }