private void buttonAddEmployee_Click(object sender, EventArgs e) { int customer = 0; string strCustomer = string.Empty; if (comboBoxCustomer.SelectedIndex > -1) { strCustomer = comboBoxCustomer.SelectedItem.ToString(); } int employee = 0; string strEmployee = string.Empty; if (comboBoxEmployee.SelectedIndex > -1) { strEmployee = comboBoxEmployee.SelectedItem.ToString(); } int level = 0; string strLevel = string.Empty; if (comboBoxLevel.SelectedIndex > -1) { strLevel = comboBoxLevel.SelectedItem.ToString(); } int type = 0; string strType = string.Empty; if (comboBoxAgreement.SelectedIndex > -1) { strType = comboBoxAgreement.SelectedItem.ToString(); } if ((strCustomer != string.Empty) && (strEmployee != string.Empty) && (strLevel != string.Empty) && (strType != string.Empty)) { foreach (var c in bl.GetCustomersList()) { if (c.FullName == strCustomer) { customer = c.ID; break; } } foreach (var emp in bl.GetEmployeesList()) { if (emp.FullName == strEmployee) { employee = emp.ID; break; } } foreach (var l in bl.GetHopelessnessLevelsList()) { if (l.Name == strLevel) { level = l.ID; break; } } foreach (var t in bl.GetAgreementTypesList()) { if (t.Name == strType) { type = t.ID; break; } } bl.AddDeal(customer, employee, level, type); this.Close(); } else { MessageBox.Show("Данные не введены!"); } }