private void buttonAdd_Click(object sender, EventArgs e) { var diagEdit = new DiagnosisEditor(new Diagnosis(String.Empty)); diagEdit.Owner = this; diagEdit.ShowDialog(); }
private void buttonCorrect_Click(object sender, EventArgs e) { if (dataGridViewDiagnosis.SelectedCells.Count > 0) { var i = dataGridViewDiagnosis.SelectedCells[0].RowIndex; var id_in_db = Convert.ToInt64(dataGridViewDiagnosis.Rows[i].Cells[0].Value); var prototype = new Diagnosis(Convert.ToString(dataGridViewDiagnosis.Rows[i].Cells[1].Value)); prototype.ID = Convert.ToInt64(dataGridViewDiagnosis.Rows[i].Cells[0].Value); prototype.Description = Convert.ToString(dataGridViewDiagnosis.Rows[i].Cells[2].Value); prototype.Symptoms = Convert.ToString(dataGridViewDiagnosis.Rows[i].Cells[3].Value); prototype.Treatment = Convert.ToString(dataGridViewDiagnosis.Rows[i].Cells[4].Value); var diagEdit = new DiagnosisEditor(prototype); diagEdit.Owner = this; diagEdit.ShowDialog(); } else { MessageBox.Show("Ничего не выделено для редактирования!", "Объект не выделен", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }