private void buttonEdit_Click(object sender, EventArgs e) { if (dataGridView1.SelectedCells.Count != 0) { int id = (int)dataGridView1.SelectedCells[3].Value; TimeForVisit visit = db.TimeForVisitSet.Find(id); Form editVisit = new EditVisit(visit); editVisit.ShowDialog(); LoadData(db.TimeForVisitSet.ToList()); } else { MessageBox.Show("Выберите приём для редактирования"); } }
private void buttonRemoveDocFromJob_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0 || dataGridView1.SelectedCells[0].Value == null) { MessageBox.Show("Выберите приём", "Ошибка"); } else { int id = (int)dataGridView1.SelectedCells[3].Value; TimeForVisit visit = (TimeForVisit)db.TimeForVisitSet.Find(id); Form editVisit = new EditVisit(visit); editVisit.ShowDialog(); ReloadForm(true); } ReloadForm(); }