private void btnNewTreatment_Click(object sender, EventArgs e) { treatmentsBindingSource.AddNew(); frmTreatment oTreatment = new frmTreatment(); oTreatment.CurrentElement = (Treatment)treatmentsBindingSource.Current; System.Windows.Forms.DialogResult res = oTreatment.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: oTreatment.CurrentElement.CancelEdit(); break; case System.Windows.Forms.DialogResult.Abort: treatmentsBindingSource.RemoveCurrent(); 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 EditTreatment() { frmTreatment oTreatment = new frmTreatment(); oTreatment.CurrentElement = (Treatment)treatmentsBindingSource.Current; System.Windows.Forms.DialogResult res = oTreatment.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: oTreatment.CurrentElement.CancelEdit(); break; case System.Windows.Forms.DialogResult.Abort: oTreatment.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; } }