private void guna2ButtonDelete_Click(object sender, EventArgs e) { if (guna2TextBoxDeleteIdInstructor.Text != "") { DialogResult confirm = MessageBox.Show("Data Instructor akan dihapus. Anda Yakin ?", "Konfirmasi", MessageBoxButtons.YesNo); if (confirm == DialogResult.Yes) { Instructor del = new Instructor(id: guna2TextBoxDeleteIdInstructor.Text); string delete = del.Delete(); if (delete == "1") { MessageBox.Show("Data Berhasil Dihapus", "Info"); guna2ButtonClear_Click(guna2ButtonDelete, e); } else { MessageBox.Show($"Gagal Menghapus Data, Error : {delete}", "Error"); } } else { } } else { MessageBox.Show("Id Tidak Boleh Kosong", "Warning"); } }
/// <summary> /// Abre el formulario para borrar item /// <returns>void</returns> /// </summary> public override void DeleteObject(long oid) { if (MessageBox.Show(moleQule.Face.Resources.Messages.DELETE_CONFIRM, moleQule.Face.Resources.Labels.ADVISE_TITLE, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { try { //Se elimina la foto Images.Delete(List.GetItem(oid).Foto, Controler.FOTOS_INSTRUCTORES_PATH); Instructor.Delete(oid); _action_result = DialogResult.OK; //Se eliminan todos los formularios de ese objeto foreach (ItemMngBaseForm form in _list_active_form) { if (form.Oid == oid) { form.Dispose(); break; } } } catch (Csla.DataPortalException ex) { MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message); } } }
void Delete() { if (SystemProperties.ShowMessage.MessageQuestion(SystemProperties.MessageNotification.YouWantToDelete, "Instructor registration") == DialogResult.Yes) { if (checkEmpty()) { using (Instructor prof = new Instructor()) { DeleteImage(); prof.Delete(SetInstructor(true), ref MsgReturned); SystemProperties.ShowMessage.MessageInformation(MsgReturned, "Instructor registration"); } } else { SystemProperties.ShowMessage.MessageError(SystemProperties.MessageNotification.SelectFirst + " delete", "Instructor registration"); } } LoadInstructor(); txtSearch.ReadOnly = false; }