private void FormRecord_Load(object sender, EventArgs e) { this.CenterToParent(); //create and add a new issue Issue tmp = new Issue(); IssueRepository.Add(tmp); //get the index from newly implemented issue then remove it _i = tmp.Id; IssueRepository.Remove(tmp); IdBox.Text = (_i.ToString()); foreach (AppUser user in _userRepository.GetAll()) { comboBox1.Items.Add(user.LastName + ", " + user.FirstName); } comboBox1.SelectedIndex = 0; ComponentBox.SelectedText = ""; foreach (IssueStatus issueStatus in IssueStatusRepository.GetAll()) { comboBox2.Items.Add(issueStatus.Value); } comboBox2.SelectedIndex = 0; }
private void button2_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows == null) { MessageBox.Show("A project must be selected.", "Attention"); } else { string selectedId = dataGridView1.SelectedRows[0].Cells[0].Value + string.Empty; _SelectedIssueId = Convert.ToInt32(selectedId); } if (previousPage == 1) { this.Hide(); FormModifyIssue form = new FormModifyIssue(_SelectedIssueId); form.ShowDialog(); form.Dispose(); } if (previousPage == 2) { this.Hide(); DialogResult isSure = MessageBox.Show("Are you sure you want to remove: " + dataGridView1.SelectedRows[0].Cells[1].Value.ToString(), "Confirmation", MessageBoxButtons.YesNo); if (isSure == DialogResult.Yes) { FakeIssueRepository repository = new FakeIssueRepository(); int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); string title = dataGridView1.SelectedRows[0].Cells[1].Value + string.Empty; DateTime date = Convert.ToDateTime(dataGridView1.SelectedRows[0].Cells[2].Value.ToString()); string discoverer = dataGridView1.SelectedRows[0].Cells[3].Value + string.Empty; string description = dataGridView1.SelectedRows[0].Cells[4].Value + string.Empty; string component = dataGridView1.SelectedRows[0].Cells[5].Value + string.Empty; string status = dataGridView1.SelectedRows[0].Cells[6].Value + string.Empty; int issuestatus = _StatusRepository.GetIdByStatus(status); Issue issue = new Issue { Id = id, Title = title, DiscoveryDate = date, Discoverer = discoverer, InitialDescription = description, Component = component, IssueStatusId = issuestatus }; bool result = repository.Remove(issue); if (result == true) { MessageBox.Show("Issue removed.", "Information"); } else { MessageBox.Show("Error removing issue " + issue.Title, "Information"); } Close(); } if (isSure == DialogResult.No) { MessageBox.Show("Remove canceled", "Attention", MessageBoxButtons.OK); Close(); } } }
private void removebutton_Click_1(object sender, EventArgs e) { DialogResult isSure = MessageBox.Show("Are you sure you want to remove this issue? ", "Attention", MessageBoxButtons.YesNo); if (isSure == DialogResult.Yes) { killme = newissue.GetIssueById(selectedId); bool result = newissue.Remove(killme); } this.Close(); }
private void issuesRemoveToolStripMenuItem_Click(object sender, System.EventArgs e) { IssueSelect select = new IssueSelect(_CurrentAppUser, selected_id); select.ShowDialog(); if (select.DialogResult == DialogResult.OK) { Issue tmp = fakeIssueRepository.GetIssueByID(select.selectedIssueID); string del = "Are you sure you want to delete " + tmp.Title; DialogResult dialogResult = MessageBox.Show(del, "Confirmation", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { fakeIssueRepository.Remove(tmp); } else if (dialogResult == DialogResult.No) { MessageBox.Show("Delete cancelled", "Attention"); } } select.Dispose(); }
private void issuesRemoveToolStripMenuItem_Click(object sender, System.EventArgs e) { FormSelectIssue form = new FormSelectIssue(_CurrentAppUser, _id, faker); form.ShowDialog(); //if something was selected if (form.DialogResult == DialogResult.OK) { //isolate the selected issue SelectedIssue = faker.GetIssueById(form.chosenID); DialogResult result = MessageBox.Show("Are you sure you want to remove: " + SelectedIssue.Title, "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { //remove it bool isTrue = faker.Remove(SelectedIssue); if ((isTrue == true)) { MessageBox.Show("Issue Removed!"); } else { MessageBox.Show("Error! " + result, "Requires your attention!"); } } else { //cancel message and return home MessageBox.Show("Remove canceled", "Attention"); } } }