/// <summary> /// Delete selected /// </summary> private void button5_Click(object sender, System.EventArgs e) { try { switch (whichForm) { case WhichForm.Judge: { Connection.Connector(judge.Delete(dataGridView1.CurrentRow.Cells[0].Value.ToString()), deleteException); Connection.Connector(dataGridView1, judge.Display(), deleteException); break; } case WhichForm.Plaintiff: { Connection.Connector(plaintiff.Delete(dataGridView1.CurrentRow.Cells[0].Value.ToString()), deleteException); Connection.Connector(dataGridView1, plaintiff.Display(), deleteException); break; } case WhichForm.Defendant: { Connection.Connector(defendant.Delete(dataGridView1.CurrentRow.Cells[0].Value.ToString()), deleteException); Connection.Connector(dataGridView1, defendant.Display(), deleteException); break; } } RefreshData(); } catch (NullReferenceException ex) { MessageBox.Show("NO DATA SELECTED"); } }
private void button1_Click(object sender, EventArgs e) { switch (whichForm) { case WhichForm.Defendant: { if (idValidation.IsMatch(IdCB.Text)) { MessageBox.Show("Id writed incorrect. Only numbers."); } else { Connection.Connector(defendant.Delete(IdCB.Text), exception); } break; } case WhichForm.Judge: { if (idValidation.IsMatch(IdCB.Text)) { MessageBox.Show("Id writed incorrect. Only numbers."); } else { Connection.Connector(judge.Delete(IdCB.Text), exception); } break; } case WhichForm.Plaintiff: { if (idValidation.IsMatch(IdCB.Text)) { MessageBox.Show("Id writed incorrect. Only numbers."); } else { Connection.Connector(plaintiff.Delete(IdCB.Text), exception); } break; } case WhichForm.Case: { if (idValidation.IsMatch(IdCB.Text)) { MessageBox.Show("Id writed incorrect. Only numbers."); } else { Connection.Connector(@case.Delete(IdCB.Text), exception); } break; } default: { MessageBox.Show("NO FORM SELECTED"); Close(); break; } } IdCB.Text = null; }