private void CreateRequirementButton_Click(object sender, EventArgs e) { Feature feature = featureRepository.GetFeatureByTitle(this.FeatureComboBox.GetItemText(FeatureComboBox.SelectedItem), currentProjectId); Requirement requirement = new Requirement(); requirement.FeatureId = feature.Id; requirement.ProjectId = currentProjectId; requirement.Statement = StatementTextBox.Text; string result = requirementRepository.Add(requirement); if (!result.Equals("")) { MessageBox.Show(result, "Attention"); } else { this.Close(); } }
public string Add(Requirement requirement) { requirement.id = getNextRequirementId(); if (string.IsNullOrEmpty(requirement.Statement)) { return("Statement must have a value."); } foreach (Requirement r in _requirements) { if (r.Statement.Equals(requirement.Statement.Trim()) && r.ProjectId == requirement.ProjectId) { return(DUPLICATE_STATEMENT_ERROR); } } _requirements.Add(requirement); return(NO_ERROR); }
private void SelectRequirementButton_Click(object sender, EventArgs e) { Requirement modifyRequirement = new Requirement(); foreach (DataGridViewRow row in RequirementsList.SelectedRows) { modifyRequirement.Id = Int32.Parse(row.Cells[0].Value.ToString()); foreach (Feature f in formFeatureRepo.GetAll(selectedProject)) { if (f.Title == FeatureSelectionBox.Text.ToString()) { modifyRequirement.FeatureId = f.Id; } } modifyRequirement.Statement = row.Cells[1].Value.ToString(); modifyRequirement.ProjectId = selectedProject; } if (operationType == 0) { FormCreateRequirement modifyForm = new FormCreateRequirement(formRequirementRepo, formFeatureRepo, selectedProject, modifyRequirement, 1); modifyForm.ShowDialog(); modifyForm.Dispose(); Dispose(); } else if (operationType == 1) { DialogResult result = MessageBox.Show("Are you sure you want to remove requirement: " + modifyRequirement.Id + "?", "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { formRequirementRepo.Remove(modifyRequirement); Dispose(); } else { MessageBox.Show("Remove canceled", "Attention", MessageBoxButtons.OK); Dispose(); } } }
private void btnCreate_Click(object sender, EventArgs e) { Requirement requirement = new Requirement(); Feature feature = fake.GetFeatureByTitle(comboBox1.SelectedItem.ToString()); requirement.FeatureId = feature.Id; requirement.Statement = richTextBox1.Text.Trim(); requirement.ProjectId = selected_project; string result = fakeRequiremnet.Add(requirement); if (result == FakeFeatureRepository.NO_ERROR) { MessageBox.Show("Requirement Added Successfully"); } else { MessageBox.Show("Requirement not added, " + result, "Attention"); } this.Close(); }
private void selReq_Click(object sender, EventArgs e) { int selectedIdex = this.reqList.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = this.reqList.Rows[selectedIdex]; Requirement selectedRequirement = new Requirement(); selectedRequirement = R.GetRequirementById(Convert.ToInt32(selectedRow.Cells["reqId"].Value)); FormModifyRequirement modifyReq = new FormModifyRequirement(selectedRequirement); modifyReq.ShowDialog(); modifyReq.Dispose(); if (modifyReq.DialogResult == DialogResult.OK || modifyReq.DialogResult == DialogResult.Cancel) { this.DialogResult = DialogResult.OK; this.Close(); } }
private void mdfyReq_Click(object sender, EventArgs e) { Requirement modifiedRequirement = new Requirement(); modifiedRequirement.id = selectedRequirement.id; modifiedRequirement.ProjectId = selectedRequirement.ProjectId; modifiedRequirement.FeatureId = F.GetFeatureByTitle(this.featsList.Text.ToString()).id; modifiedRequirement.Statement = this.statBox.Text.ToString(); string modify = R.Modify(modifiedRequirement); if (string.IsNullOrEmpty(modify)) { this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show(modify, "Error !"); } }
private void FormRequirementModify_Load(object sender, EventArgs e) { this.CenterToParent(); List <Feature> features = fake.GetAll(selected_project); Requirement req = fakeRequiremnet.GetRequirementByID(selected_r); richTextBox1.Text = req.Statement; foreach (Feature f in features) { comboBox1.Items.Add(f.Title); if (f.Id == req.FeatureId) { comboBox1.SelectedItem = f.Title; } comboBox1.Items.Add(f.Title); } if (comboBox1.Items.Count < 1) { comboBox1.Enabled = false; } }
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; } }
public string Modify(Requirement requirement) { bool errorFlag = false; foreach (Requirement r in _requirements) { if (r.ProjectId == requirement.ProjectId && r.FeatureId == requirement.FeatureId && r.Statement.Equals(requirement.Statement) && r.id != requirement.id) { errorFlag = true; } } if (errorFlag) { return(DUPLICATE_STATEMENT_ERROR); } else { GetRequirementById(requirement.id).FeatureId = requirement.FeatureId; GetRequirementById(requirement.id).Statement = requirement.Statement; return(NO_ERROR); } }
public FormModifyRequirement(Requirement myRequirement) { selectedRequirement = myRequirement; InitializeComponent(); }
public FormCreateRequirement(FakeRequirementRepository reqRepo, FakeFeatureRepository featureRepo, int project, Requirement requirement, int type) { InitializeComponent(); formRequirementRepo = reqRepo; formFeatureRepo = featureRepo; selectedProject = project; modifyRequirement = requirement; operationType = type; }