private void buttonDeleteClient_Click(object sender, EventArgs e) { if (IsValidClientData()) { DialogResult ans = MessageBox.Show("Do you really want to delete this Client?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (ans == DialogResult.Yes) { ClientDA.Delete(Convert.ToInt32(textBoxClientID.Text)); MessageBox.Show("Client record has been deleted successfully", "Confirmation"); ClearAll(); textBoxClientID.Focus(); textBoxClientID.Enabled = true; } } }
//Delete private void buttonClDel_Click(object sender, EventArgs e) { DialogResult ans = MessageBox.Show("Are you sure you want to delete the Client information?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (ans == DialogResult.Yes) { if (OrderDA.SearchByClientID(Convert.ToInt32(textBoxClID.Text)) != null) { MessageBox.Show("This client has open orders in the system, please verify the orders before deleting this client.", "ALERT!"); return; } ClientDA.Delete(Convert.ToInt32(textBoxClID.Text)); ClientDA.List(listViewSales); UpdateComboBoxes(); } }
public ResultEntity <int> DeleteById(int id) { var validationResult = new ResultEntity <int>(); using (var clientDA = new ClientDA()) { //var ids = new int[] { id }; validationResult.Value = clientDA.Delete(id); if (validationResult.Value != 1) { validationResult.Warning.Add("Failed delete record Client with ID: " + id); return(validationResult); } } return(validationResult); }
private void buttonDeleteBook_Click(object sender, EventArgs e) { ClientDA.Delete(Convert.ToInt32(textBoxClientId.Text)); MessageBox.Show("Client has been deleted successfully from the database", "Confirmation"); }