private void bAdd_Click(object sender, EventArgs e) { if (listBoxTables.SelectedItem == null) return; var firstOrDefault = _service.Tables.FirstOrDefault(t => t.Name == listBoxTables.SelectedItem.ToString()); var fields = firstOrDefault? .Fields.Select(field => field.Name).ToList(); var frm = new FormEdit_Add_(_service, this, fields, listBoxTables.SelectedItem.ToString()); frm.ShowDialog(); Refresh(); }
private void bEdit_Click(object sender, EventArgs e) { if (listBoxTables.SelectedItem == null) return; var editValuesList = new List<string>(); for (var i = 0; i < dataGridTable.SelectedRows[0].Cells.Count; i++) editValuesList.Add(dataGridTable.SelectedRows[0].Cells[i].Value.ToString()); var fields = _service.Tables.FirstOrDefault(t => t.Name == listBoxTables.SelectedItem.ToString())? .Fields.Select(field => field.Name).ToList(); var frm = new FormEdit_Add_(_service, this, fields, listBoxTables.SelectedItem.ToString(), editValuesList); frm.ShowDialog(); Refresh(); }