private void AddEditEmployee(object sender, RoutedEventArgs e) { if (!EmployeeName.Text.Equals("") && CalendarE.SelectedDate != null) // && CBRoles.SelectedIndex != -1) { { Employee newEmp = new Employee(EmployeeName.Text, (DateTime)CalendarE.SelectedDate); //newEmp.AddRole(nomtek.Roles[CBRoles.SelectedIndex]); for (int i = 0; i < CBRoles.Length; i++) { if (CBRoles[i].IsChecked.Value) { newEmp.AddRole(nomtek.Roles[i]); } } nomtek.AddEditEmployee(newEmp); RefreshControls(); RefreshLists(); ListOfEmployees2.SelectedValue = newEmp.Name; Show_EmployeesDetails(); } else { MessageBox.Show("Nie przekazano wszystkich danych"); } }