private void AddButton_Click(object sender, EventArgs e) { AddTariffForm addForm = new AddTariffForm { connectionString = this.connectionString }; addForm.ShowDialog(); ShowTariffs(); }
private void EditButton_Click(object sender, EventArgs e) { if (TariffsDataGrid.CurrentCell != null) { int row = TariffsDataGrid.CurrentCell.RowIndex; int id = Convert.ToInt32(TariffsDataGrid[0, row].Value); string name = Convert.ToString(TariffsDataGrid[1, row].Value); AddTariffForm editForm = new AddTariffForm { TariffId = id, TariffName = name, connectionString = this.connectionString }; editForm.ShowDialog(); ShowTariffs(); } else { MessageBox.Show("Не выбран тариф для редактирования!", "Ошибка!", MessageBoxButtons.OK); } }