public string GetGearNameByGearID(int GearID) { DBGearTypes.MainID = GearID; DBGearTypes.LoadData(); return(DBGearTypes.MainValue); }
public void CallEdit(int TableID, DataGridView DG) { switch (TableID) { case 1: { EditorMode = 1; DBBodyTypes.LoadData(DG); ValueEdit.Text = DBBodyTypes.MainValue; this.Text = "Изменить тип кузова..."; this.ShowDialog(); break; } case 2: { EditorMode = 1; DBClasses.LoadData(DG); ValueEdit.Text = DBClasses.MainValue; this.Text = "Изменить класс..."; this.ShowDialog(); break; } case 3: { EditorMode = 1; DBColors.LoadData(DG); ValueEdit.Text = DBColors.MainValue; this.Text = "Изменить цвет..."; this.ShowDialog(); break; } case 5: { EditorMode = 1; DBGearTypes.LoadData(DG); ValueEdit.Text = DBGearTypes.MainValue; this.Text = "Изменить тип привода..."; this.ShowDialog(); break; } case 6: { EditorMode = 1; DBWorkplaces.LoadData(DG); ValueEdit.Text = DBLanguages.MainValue; this.Text = "Изменить язык..."; this.ShowDialog(); break; } case 7: { EditorMode = 1; DBManafacturers.LoadData(DG); ValueEdit.Text = DBManafacturers.MainValue; this.Text = "Изменить производителя..."; this.ShowDialog(); break; } case 8: { EditorMode = 1; DBWorkplaces.LoadData(DG); ValueEdit.Text = DBWorkplaces.MainValue; this.Text = "Изменить место работы..."; this.ShowDialog(); break; } default: { MessageBox.Show("О неееееееет!!!!!!!", "Гипер-пупер ошибка века!", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } PageID = TableID; }
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; } } }