private void btn_delete_Click(object sender, EventArgs e) { //Client has invoice ? bool hasinvoice = sql.ClientHasInvoiceCheck(FM_LoginScreen.conString, "InvoiceTable", cb_clientselection.Text); if (hasinvoice == true) { MessageBox.Show("Unable to delete client!\n" + tb_clientName.Text + " has invoices present", "SQL Conflict"); return; } //delete a row in client database if (tickBox_editMode.Checked) { string message = "You are about to delete Client: " + tb_clientName.Text; string caption = "ClientTable"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, caption, buttons); if (result == DialogResult.Yes) { sql.RemoveRow(FM_LoginScreen.conString, "ClientTable", "ClientID", cb_clientselection.Text); tickBox_editMode.Checked = false; } } }
private void btn_delete_Click(object sender, EventArgs e) { if (tickBox_editMode.Checked) { string message = "You are about to Delete Invoice: " + lb_invoiceID.Text + "\nThat belongs to: " + lb_clientID.Text; string caption = "InvoiceTabel"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, caption, buttons); if (result == DialogResult.Yes) { sql.RemoveRow(FM_LoginScreen.conString, "InvoiceTable", "InvoiceID", lb_invoiceID.Text); tickBox_editMode.Checked = false; Set_Data_Table(); } } }