private void OnSaveCommand() { try { var keywords = Keywords.Where(e => e.KeywordID > 0) .Select(e => e.KeywordID).Distinct().ToList(); var newKeywords = Keywords.Where(e => e.KeywordID < 0) .Select(e => e.Name).Distinct().ToArray(); Control.UpdateBindings(); Entity.Summary = _summaryEditor.Value; KbContext.CurrentKb.ManagerKnowledge.Save(Entity, keywords, newKeywords); if (newKeywords.Length > 0) { AppCore.Workspace.Keywords.Refresh(); } OnSaved(); } catch (ValidationException ex) { ErrorLabel.ShowException(Control, "Error save knowledge", ex); } catch (PermissionException ex) { Messages.ShowSecurityAlert(ex.Message, Entity.CategoryID); } catch (Exception ex) { ErrorForm.Show("Error save knowledge", ex); } }
private void ButtonOk_Click(object sender, RoutedEventArgs e) { try { SaveUser(); Close(); } catch (ValidationException ex) { ErrorLabel.ShowException(this, "Error save knowledge", ex); } catch (Exception ex) { ErrorForm.Show("Error save knowledge", ex); } }
/// <summary> /// Handles the Click event of the ButtonOk control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void ButtonOk_Click(object sender, RoutedEventArgs e) { try { SaveCategory(); Close(); } catch (ValidationException ex) { ErrorLabel.ShowException(this, "Error save category", ex); } catch (PermissionException ex) { Messages.ShowSecurityAlert(ex.Message, listCategories.Value); } catch (Exception ex) { ErrorForm.Show("Error save category", ex); } }