private void ModifyIssueButton_Click(object sender, EventArgs e) { if (IssueRepository.IsDuplicate(TitleBox.Text.Trim()) == true) { MessageBox.Show("Name must be unique!!", "Attention!!"); } else { int StatusOffset = 1; ModIssue.Title = TitleBox.Text; ModIssue.DiscoveryDate = DateTimePicker.Value; ModIssue.Discoverer = DiscovererComboBox.Text; ModIssue.Component = ComponentBox.Text; ModIssue.IssueStatusId = StatusComboBox.SelectedIndex + StatusOffset; ModIssue.InitialDescription = InitialDescription.Text; string result = IssueRepository.Modify(ModIssue); if ((result == FakeIssueRepository.NO_ERROR)) { MessageBox.Show("Modify Successful!!"); } else { MessageBox.Show("Error! " + result, "Requires your attention!"); } this.Close(); } }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Text.IsNullOrEmpty() || dateTimePicker1.Checked == false || comboBoxStatus.SelectedIndex == -1 || comboBoxDiscoverer.SelectedIndex == -1) { MessageBox.Show("Please verify all required elements are inpu", "Attention"); } else { Issue tmp = new Issue(); tmp.Id = Convert.ToInt32(textBox1.Text); tmp.Title = textBox2.Text.Trim(); tmp.DiscoveryDate = dateTimePicker1.Value; tmp.Discoverer = comboBoxDiscoverer.SelectedItem.ToString(); tmp.IssueStatusId = fakeIssueStatus.GetIdByStatus(comboBoxStatus.SelectedItem.ToString()); tmp.InitialDesscription = richTextBoxDescription.Text.Trim(); tmp.Component = textBox3.Text.Trim(); string result = fake.Modify(tmp); if (result != FakeIssueRepository.NO_ERROR) { MessageBox.Show("Error modifying project. Error: " + result); } else { MessageBox.Show("Issue modification successful.", "Information"); this.Close(); } } }
private void mdfyIssue_Click(object sender, EventArgs e) { FakeIssueStatusRepository iss = new FakeIssueStatusRepository(); FakeIssueRepository modify = new FakeIssueRepository(); Issue modifiedIssue = new Issue(); modifiedIssue.id = Int32.Parse(this.issueID.Text); modifiedIssue.project_id = issToModify.project_id; modifiedIssue.Discoverer = this.disc.Text; modifiedIssue.Component = this.issComp.Text; modifiedIssue.initialDescription = this.initDesc.Text; modifiedIssue.IssueStatusid = iss.GetIdByStatus(this.issStatus.Text); modifiedIssue.DiscoveryDate = DateTime.ParseExact(this.discDate.Text, "hh:mm:ss tt d MMM yyyy", null); modifiedIssue.Title = this.issueTitle.Text.Trim(); string modifyResult = modify.Modify(modifiedIssue); if (string.IsNullOrEmpty(modifyResult)) { this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show(modifyResult, "Error!"); //this.DialogResult = DialogResult.Cancel; //this.Close(); } }
private void button2_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(IssueTitleBox.Text)) { MessageBox.Show("No issue title provided", "Attention", MessageBoxButtons.OK); return; } if (string.IsNullOrWhiteSpace(discovererBox.Text)) { MessageBox.Show("No issue discoverer provided", "Attention", MessageBoxButtons.OK); return; } if (string.IsNullOrWhiteSpace(componentBox.Text)) { MessageBox.Show("No issue component provided", "Attention", MessageBoxButtons.OK); return; } if (string.IsNullOrWhiteSpace(statusBox.Text)) { MessageBox.Show("No issue status provided", "Attention", MessageBoxButtons.OK); return; } modifyIssue.ID = Int32.Parse(IssueIdBox.Text); modifyIssue.title = IssueTitleBox.Text; modifyIssue.projectId = selectedProject; modifyIssue.discoveryDate = dateTimePicker.Value; modifyIssue.discoverer = discovererBox.Text; modifyIssue.initialDescription = descriptionBox.Text; modifyIssue.component = componentBox.Text; FakeIssueStatusRepository formStatusRepo = new FakeIssueStatusRepository(); foreach (IssueStatus s in formStatusRepo.GetAll()) { if (s.Value == statusBox.Text) { modifyIssue.status = s.Id; } } FakeIssueRepository issueRepo = new FakeIssueRepository(); foreach (Issue i in issueRepo.GetAll(selectedProject)) { if (i.title == modifyIssue.title) { MessageBox.Show("Duplicate issue names not allowed", "Attention", MessageBoxButtons.OK); return; } } issueRepo.Modify(modifyIssue); Dispose(); }
private void ButtonModify_Click(object sender, EventArgs e) { FakeIssueRepository iss2 = new FakeIssueRepository(); Issue i3 = new Issue { ID = Convert.ToInt32(modID.Text), Title = modTitle.Text, DiscoveryDate = Convert.ToDateTime(modDateTime.Text), Discoverer = modDis.Text, Component = modComp.Text, IssueStatusID = Convert.ToInt32(modStatus.Text), InitialDescription = modDes.Text }; _ = iss2.Modify(i3); this.Close(); }