private void EditProjectToolStripMenuItem_Click( object sender, EventArgs e) { using (ProjectSelect dlg = new ProjectSelect()) { dlg.Text = "Edit Project"; if (dlg.ShowDialog() == DialogResult.OK) { ShowEditProject(dlg.ProjectId); } } }
private void AssignButton_Click(object sender, EventArgs e) { using (ProjectSelect dlg = new ProjectSelect()) { if (dlg.ShowDialog() == DialogResult.OK) { try { Resource.Assignments.AssignTo(dlg.ProjectId); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, "Error Assigning", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error Assigning", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void DeleteProjectToolStripMenuItem_Click(object sender, EventArgs e) { ProjectSelect dlg = new ProjectSelect(); dlg.Text = "Delete Project"; if (dlg.ShowDialog() == DialogResult.OK) { // get the project id var projectId = dlg.ProjectId; if (MessageBox.Show("Are you sure?", "Delete project", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { using (StatusBusy busy = new StatusBusy("Deleting project...")) { try { ProjectTracker.Library.ProjectEdit.DeleteProject(projectId); } catch (Csla.DataPortalException ex) { MessageBox.Show(ex.BusinessException.ToString(), "Error deleting", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error deleting", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }