private void mbAdd_Click(object sender, EventArgs e) { switch (metroTabControl1.SelectedIndex) { case 0: EditFormVPO add = new EditFormVPO(); add.ShowDialog(); updateDataGrid("SELECT VUZ.Id, VUZ.name as 'ВПО', VUZ.phone as 'Телефон', city.name as 'Город' FROM VUZ INNER JOIN city ON VUZ.Id_city=city.Id"); break; case 1: EditFormCity efc = new EditFormCity(); efc.ShowDialog(); updateDataGrid("SELECT Id, Name as 'Название' FROM city"); break; case 2: EditFormQulifyLevel efql = new EditFormQulifyLevel(); efql.ShowDialog(); updateDataGrid("SELECT Id, name as 'Название' FROM qulifyLevel"); break; case 3: EditFormDirectionTraining efdt = new EditFormDirectionTraining(); efdt.ShowDialog(); updateDataGrid("SELECT Id, name as 'Название', code as 'Код' FROM directionTraining"); break; case 4: EditFormForm eff = new EditFormForm(); eff.ShowDialog(); updateDataGrid("SELECT Id, name as 'Название' FROM form"); break; } }
private void mbEdit_Click(object sender, EventArgs e) { DataGridViewRow row = metroGrid1.Rows[selectedIndex]; switch (metroTabControl1.SelectedIndex) { case 0: EditFormVPO ef = new EditFormVPO("" + row.Cells[0].Value, "" + row.Cells[1].Value, "" + row.Cells[2].Value, "" + row.Cells[3].Value); ef.ShowDialog(); updateDataGrid("SELECT VUZ.Id, VUZ.name as 'ВПО', VUZ.phone as 'Телефон', city.name as 'Город' FROM VUZ INNER JOIN city ON VUZ.Id_city=city.Id"); break; case 1: EditFormCity efc = new EditFormCity("" + row.Cells[1].Value, "" + row.Cells[0].Value); efc.ShowDialog(); updateDataGrid("SELECT Id, Name as 'Название' FROM city"); break; case 2: EditFormQulifyLevel efql = new EditFormQulifyLevel("" + row.Cells[1].Value, "" + row.Cells[0].Value); efql.ShowDialog(); updateDataGrid("SELECT Id, name as 'Название' FROM qulifyLevel"); break; case 3: EditFormDirectionTraining efdt = new EditFormDirectionTraining("" + row.Cells[1].Value, "" + row.Cells[0].Value, "" + row.Cells[2].Value); efdt.ShowDialog(); updateDataGrid("SELECT Id, name as 'Название', code as 'Код' FROM directionTraining"); break; case 4: EditFormForm eff = new EditFormForm("" + row.Cells[1].Value, "" + row.Cells[0].Value); eff.ShowDialog(); updateDataGrid("SELECT Id, name as 'Название' FROM form"); break; } }