private void AddClassificationToPropertyButton_Click(object sender, RoutedEventArgs e) { try { if (_SelectedClassificationId < 0) { return; } int selectedConceptId; int selectedParentId; if (ConceptsComboBox.SelectedValue != null) { selectedConceptId = _conceptsOutsideClassification .First(c => c.Value == ConceptsComboBox.SelectedValue.ToString()) .Key; } else { if (ConceptsComboBox.Text.Length == 0) { throw new Exception("Поле с понятием не должно быть пустым"); } if (_conceptsInClassification.Values.Contains(ConceptsComboBox.Text)) { throw new Exception("Понятие уже находится в классификации"); } selectedConceptId = _SQLClient.InsertConceptIdentity(ConceptsComboBox.Text); } if (ParentConceptComboBox.SelectedValue != null) { selectedParentId = _conceptsInClassification .First(c => c.Value == ParentConceptComboBox.SelectedValue.ToString()) .Key; } else { if (ParentConceptComboBox.Text.Length == 0) { throw new Exception("Поле с понятием не должно быть пустым"); } if (!_conceptsInClassification.Values.Contains(ConceptsComboBox.Text)) { throw new Exception("Родительское понятие должно находиться в классификации"); } selectedParentId = _conceptsInClassification .First(c => c.Value == ParentConceptComboBox.Text) .Key; } _SQLClient.InsertConceptToClassification( _SelectedClassificationId, selectedConceptId, selectedParentId, SpeciesDifferenceTextBox.Text ); SelectConceptsOutsideClassification(); SelectConceptsFromClassification(); if (Sender is TreeVisualizationPage) { TreeVisualizationPage.Instance.GenerateGraph(); } else if (Sender is Frames.Classifications) { Frames.Classifications.Instance.SelectClassificationConcepts(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка"); } }