Exemplo n.º 1
0
        private void FeatureSelectionBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            RequirementsLabel.Enabled       = true;
            RequirementsList.Enabled        = true;
            SelectRequirementButton.Enabled = true;

            DataTable  requirements = new DataTable("Requirements");
            DataColumn c0           = new DataColumn("ID");
            DataColumn c1           = new DataColumn("Requirement");

            requirements.Columns.Add(c0);
            requirements.Columns.Add(c1);

            DataRow row;

            foreach (Requirement r in formRequirementRepo.GetAll(selectedProject))
            {
                row                = requirements.NewRow();
                row["ID"]          = r.Id;
                row["Requirement"] = r.Statement;

                requirements.Rows.Add(row);
            }

            RequirementsList.DataSource       = requirements;
            RequirementsList.Columns[1].Width = RequirementsList.Width - RequirementsList.Columns[0].Width - 43;
        }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
0
        private void SelectFeatureButton_Click(object sender, EventArgs e)
        {
            Feature modifyFeature = new Feature();

            foreach (DataGridViewRow row in FeatureList.SelectedRows)
            {
                modifyFeature.Id        = Int32.Parse(row.Cells[0].Value.ToString());
                modifyFeature.ProjectId = selectedProject;
                modifyFeature.Title     = row.Cells[1].Value.ToString();
            }

            if (operationType == 0)
            {
                FormCreateFeature modifyForm = new FormCreateFeature(formFeatureRepo, selectedProject, 1, modifyFeature);
                modifyForm.ShowDialog();
                modifyForm.Dispose();
                Dispose();
            }

            else if (operationType == 1)
            {
                DialogResult result = MessageBox.Show("Are you sure you want to remove: " + modifyFeature.Title + "?", "Confirmation", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    foreach (Requirement r in formRequirementRepo.GetAll(selectedProject))
                    {
                        if (r.FeatureId == modifyFeature.Id)
                        {
                            DialogResult confirmResult = MessageBox.Show("There are one or more requirements associated with this feature.\nThese requirements will be destroyed if you remove this feature.\nAre you sure you want to remove: " + modifyFeature.Title + "?", "Confirmation", MessageBoxButtons.YesNo);
                            if (confirmResult == DialogResult.Yes)
                            {
                                formFeatureRepo.Remove(modifyFeature);
                            }

                            Dispose();
                        }
                    }

                    formFeatureRepo.Remove(modifyFeature);
                    Dispose();
                }

                else
                {
                    MessageBox.Show("Remove canceled", "Attention", MessageBoxButtons.OK);
                    Dispose();
                }
            }
        }
Exemplo n.º 4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Feature myFeature = F.GetFeatureByTitle(this.featureList.SelectedItem.ToString());

            this.reqList.Rows.Clear();

            if (myFeature.id == -1)
            {
                this.reqList.Rows.Clear();
                //this.reqList.Rows.Clear();
                this.label2.Enabled  = false;
                this.reqList.Enabled = false;
                this.selReq.Enabled  = false;
                this.reqList.ColumnHeadersVisible = false;
            }
            else
            {
                List <Requirement> Rs = new List <Requirement>();
                Rs = R.GetAll(currentProject);

                foreach (Requirement r in Rs)
                {
                    if (r.FeatureId == myFeature.id)
                    {
                        this.reqList.Rows.Add(r.id.ToString(), r.Statement);
                    }
                }

                this.reqList.ColumnHeadersVisible = true;
                this.label2.Enabled = true;

                if (this.reqList.Rows.Count > 0)
                {
                    this.reqList.Enabled = true;
                    this.selReq.Enabled  = true;
                }
                else
                {
                    this.reqList.Enabled = false;
                    this.selReq.Enabled  = false;
                }
            }
        }
        public void SetTable()
        {
            DataSet   data       = new DataSet("RequirementsDataSet");
            DataTable dataTable2 = new DataTable("RequirementsDataTable");
            DataRow   dataRow2;

            requirementList = requirementRepository.GetAll(currentProjectId);

            // Setup the table to insert the features into so we can select from them.
            DataColumn idDataColumn = new DataColumn();

            idDataColumn.DataType   = System.Type.GetType("System.Int32");
            idDataColumn.ColumnName = "Id";

            DataColumn titleDataColumn = new DataColumn();

            titleDataColumn.ColumnName = "Requirement";
            titleDataColumn.DataType   = System.Type.GetType("System.String");

            dataTable2.Columns.Add(idDataColumn);
            dataTable2.Columns.Add(titleDataColumn);

            foreach (Requirement requirement in requirementList)
            {
                // If the project id's match.
                if (currentProjectId == requirement.ProjectId && currentFeatureId == requirement.FeatureId)
                {
                    // Make a new row, add it.
                    dataRow2                = dataTable2.NewRow();
                    dataRow2["Id"]          = requirement.Id;
                    dataRow2["Requirement"] = requirement.Statement;
                    dataTable2.Rows.Add(dataRow2);
                }
            }

            dataGridView1.DataSource  = dataTable2;
            dataGridView1.MultiSelect = false;
            dataGridView1.AutoResizeColumns();
            dataGridView1.ReadOnly = true;
        }