private void button1_Click(object sender, EventArgs e) { List <int> serv = new List <int>(); Medicine_Data data = new Medicine_Data(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { serv.Add(Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value)); } if (textBox1.Text != "") { if (dataGridView1.RowCount > 0) { data.Create_Reception_Record(GlobalVar.FMain_selected_docid, GlobalVar.selected_patientID_reception, date_lbl.Text, time_lbl.Text, comboBox1.Text); data.Create_Attendances_Record(GlobalVar.FMain_selected_docid, time_lbl.Text, date_lbl.Text, serv); MessageBox.Show("Запись успешно создана", "База данных", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } else { MessageBox.Show("Не выбраны услуги.", "База данных", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Выберите пациента.", "База данных", MessageBoxButtons.OK, MessageBoxIcon.Error); } }