private void buttonAddEmployee_Click(object sender, EventArgs e) { string fullName = string.Empty; string surname = textBoxSurname.Text; string name = textBoxName.Text; string patronomyc = textBoxPatronymic.Text; int speciality = 0; string strSpeciality = string.Empty; if (comboBoxSpeciality.SelectedIndex > -1) { strSpeciality = comboBoxSpeciality.SelectedItem.ToString(); } int experience = 0; string strExperience = string.Empty; if (comboBoxSpeciality.SelectedIndex > -1) { strExperience = comboBoxExperience.SelectedItem.ToString(); } if ((surname != string.Empty) && (name != string.Empty) && (patronomyc != string.Empty) && (strSpeciality != string.Empty) && (strExperience != string.Empty)) { fullName = surname + " " + name + " " + patronomyc; foreach (var s in bl.GetSpecialitiesList()) { if (s.Name == strSpeciality) { speciality = s.ID; break; } } foreach (var exp in bl.GetExperiencesList()) { if (exp.Name == strExperience) { experience = exp.ID; break; } } bl.AddEmployee(fullName, speciality, experience); this.Close(); } else { MessageBox.Show("Данные не введены!"); } }