private void buttonDelete_Click(object sender, EventArgs e) { switch (PageID) { case 1: { DBBodyTypes.LoadData(dataGridView1); if (!DBBodyTypes.CheckUse()) { DatabaseControlService.SQL.SqlProcduceCommand(dataGridView1, DBBodyTypes.Delete()); Update(PageID); DatabaseControlService.DataGridSelectLast(dataGridView1); UpdateButtons(); } break; } case 2: { DBClasses.LoadData(dataGridView1); if (!DBClasses.CheckUse()) { DatabaseControlService.SQL.SqlProcduceCommand(dataGridView1, DBClasses.Delete()); Update(PageID); DatabaseControlService.DataGridSelectLast(dataGridView1); UpdateButtons(); } break; } case 3: { DBColors.LoadData(dataGridView1); if (!DBColors.CheckUse()) { DatabaseControlService.SQL.SqlProcduceCommand(dataGridView1, DBColors.Delete()); Update(PageID); DatabaseControlService.DataGridSelectLast(dataGridView1); UpdateButtons(); } break; } case 4: { DBCountries.LoadData(dataGridView1); if (!DBCountries.CheckUse()) { DatabaseControlService.SQL.SqlProcduceCommand(dataGridView1, DBCountries.Delete()); Update(PageID); DatabaseControlService.DataGridSelectLast(dataGridView1); UpdateButtons(); } break; } case 5: { DBGearTypes.LoadData(dataGridView1); if (!DBGearTypes.CheckUse()) { DatabaseControlService.SQL.SqlProcduceCommand(dataGridView1, DBGearTypes.Delete()); Update(PageID); DatabaseControlService.DataGridSelectLast(dataGridView1); UpdateButtons(); } break; } case 6: { DBLanguages.LoadData(dataGridView1); if (!DBLanguages.CheckUse()) { DatabaseControlService.SQL.SqlProcduceCommand(dataGridView1, DBLanguages.Delete()); Update(PageID); DatabaseControlService.DataGridSelectLast(dataGridView1); UpdateButtons(); } UpdateButtons(); break; } case 7: { DBManafacturers.LoadData(dataGridView1); if (!DBManafacturers.CheckUse()) { DatabaseControlService.SQL.SqlProcduceCommand(dataGridView1, DBManafacturers.Delete()); Update(PageID); DatabaseControlService.DataGridSelectLast(dataGridView1); UpdateButtons(); } break; } case 8: { DBWorkplaces.LoadData(dataGridView1); if (!DBWorkplaces.CheckUse()) { DatabaseControlService.SQL.SqlProcduceCommand(dataGridView1, DBWorkplaces.Delete()); Update(PageID); DatabaseControlService.DataGridSelectLast(dataGridView1); UpdateButtons(); } break; } default: { MessageBox.Show("О неееееееет!!!!!!!", "Гипер-пупер ошибка века!", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } }