private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) { if (SelectedItem == null) { return; } DialogResult res = MessageBox.Show("Would you like to duplicate key workers?", "Key Workers", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (res == DialogResult.Cancel) { return; } ServiceUser serviceuser = SelectedItem.Duplicate(res == DialogResult.Yes); serviceuser.surname += " - Copy"; serviceuser.Save(); objectListView1.AddObject(serviceuser); objectListView1.BuildList(); }
private void duplicateUserToolStripMenuItem_Click(object sender, EventArgs e) { if (SelectedItem == null) { return; } DialogResult res = MessageBox.Show("Would you like to duplicate key serviceusers?", "Key Service Users", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (res == DialogResult.Cancel) { return; } try { Cursor = Cursors.WaitCursor; Worker worker = SelectedItem.Duplicate(res == DialogResult.Yes); worker.surname += " - Copy"; worker.Save(); //TODO - this objectListView1.AddObject(worker); objectListView1.BuildList(); Cursor = Cursors.Default; } catch (Exception ex) { Cura.Common.Common.LogError("Error Duplicating Worker", ex); } Cursor = Cursors.Default; }