private void btnNewAnimal_Click(object sender, EventArgs e) { animalsBindingSource.AddNew(); frmAnimal oAnimal = new frmAnimal(); oAnimal.CurrentElement = (Animal)animalsBindingSource.Current; System.Windows.Forms.DialogResult res = oAnimal.ShowDialog(); switch (res) { case System.Windows.Forms.DialogResult.OK: if (oViewEditing.actualStatus != state.insert) { oViewEditing.actualStatus = state.edit; } break; case System.Windows.Forms.DialogResult.Cancel: oAnimal.CurrentElement.CancelEdit(); break; case System.Windows.Forms.DialogResult.Abort: animalsBindingSource.Remove(oAnimal.CurrentElement); break; case System.Windows.Forms.DialogResult.Ignore: break; case System.Windows.Forms.DialogResult.No: break; case System.Windows.Forms.DialogResult.None: break; case System.Windows.Forms.DialogResult.Retry: break; case System.Windows.Forms.DialogResult.Yes: break; } }
private void EditAnimal() { frmAnimal oAnimal = new frmAnimal(); oAnimal.CurrentElement = (Animal)animalsBindingSource.Current; System.Windows.Forms.DialogResult res = oAnimal.ShowDialog(); switch (res) { case System.Windows.Forms.DialogResult.OK: if (oViewEditing.actualStatus != state.insert) { oViewEditing.actualStatus = state.edit; } break; case System.Windows.Forms.DialogResult.Cancel: oAnimal.CurrentElement.CancelEdit(); break; case System.Windows.Forms.DialogResult.Abort: oAnimal.CurrentElement.CancelEdit(); break; case System.Windows.Forms.DialogResult.Ignore: break; case System.Windows.Forms.DialogResult.No: break; case System.Windows.Forms.DialogResult.None: break; case System.Windows.Forms.DialogResult.Retry: break; case System.Windows.Forms.DialogResult.Yes: break; } }