private void rmvPrj_Click(object sender, EventArgs e) { //have project removed if it is not the same as the current project if (currentProject != projectToRemove) { //Remove string result = ProjectRepository.Remove(projectToRemove.Id); //If no errors, remove succesful if (result == FakeProjectRepository.NO_ERROR) { this.DialogResult = DialogResult.OK; this.isRemoved = true; this.Close(); } //If project not found, give error in message box else if (result == FakeProjectRepository.NO_PROJECT_FOUND_ERROR) { MessageBox.Show(FakeProjectRepository.NO_PROJECT_FOUND_ERROR, "Attention"); this.Close(); } } //If the project is the same as the current, give error in message box else { MessageBox.Show("Cannot remove your current session project.", "Attention"); this.Close(); } }
private void buttonRemove_Click(object sender, EventArgs e) { DialogResult isSure = MessageBox.Show("Are you sure you want to permenantly remove this project?", "Attention", MessageBoxButtons.YesNo); if (isSure == DialogResult.Yes) { FakeProjectRepository repository = new FakeProjectRepository(); string result = repository.Remove(_SelectedProjectId); if (result == FakeProjectRepository.NO_ERROR) { MessageBox.Show("Project removed.", "Information"); } else { MessageBox.Show(result, "Attention"); } Close(); } }