private void SaveSelectedPerson() { if (SelectedDetailedPerson == null) { throw new ArgumentException("SelectedDetailedPerson must not be null"); } if (IsNewModeActive) { Persons.Add(SelectedDetailedPerson); } var entity = SelectedDetailedPerson.AcceptChanges(); using (var session = _documentStoreFactory.CreateDocumentStore().OpenSession()) { session.Store(entity); session.SaveChanges(); } SelectedDetailedPerson.Id = entity.Id; SelectedDetailedPerson.SaveDocuments(); SelectedListPerson = SelectedDetailedPerson; _logger.Info(LoggerMessage.GetFunctionUsageMessage("Save Selected Person")); }
private void OnSelectedDetailedPersonChanged() { Notify("HasChanges"); SaveCommand.RaiseCanExecuteChanged(); DeleteCommand.RaiseCanExecuteChanged(); RevertCommand.RaiseCanExecuteChanged(); SelectedDetailedPerson?.CheckDocuments(); }
private void RevertChanges() { if (_messageDialogService.OpenConfirmationDialog("Änderungen verwerfen", "Wollen Sie die Änderungen verwerfen?")) { SelectedDetailedPerson?.ResetChanges(); if (IsNewModeActive) { SelectedDetailedPerson = null; SelectedListPerson = Persons.FirstOrDefault(); _logger.Info(LoggerMessage.GetFunctionUsageMessage("Revert Changes on New Mode")); } else { _logger.Info(LoggerMessage.GetFunctionUsageMessage("Revert Changes on Edit Mode")); } } }
private bool ChangeSelectedDetailedPerson() { var canChangeSelectedDetaiedPerson = true; if (IsNewModeActive || HasChanges) { canChangeSelectedDetaiedPerson = _messageDialogService.OpenConfirmationDialog("Änderungen verwerfen", "Wollen Sie die Änderungen verwerfen?"); if (canChangeSelectedDetaiedPerson) { SelectedDetailedPerson.ResetChanges(); } } if (canChangeSelectedDetaiedPerson) { SelectedDetailedPerson = SelectedListPerson; } return(canChangeSelectedDetaiedPerson); }
private void CreateNewPerson() { var canChangeSelectedDetaiedPerson = true; if (IsNewModeActive || HasChanges) { canChangeSelectedDetaiedPerson = _messageDialogService.OpenConfirmationDialog("Änderungen verwerfen", "Wollen Sie die Änderungen verwerfen?"); if (canChangeSelectedDetaiedPerson) { SelectedDetailedPerson.ResetChanges(); } } if (canChangeSelectedDetaiedPerson) { SelectedListPerson = null; SelectedDetailedPerson = IocKernel.GetPersonViewModel(this); _logger.Info(LoggerMessage.GetFunctionUsageMessage("Create New Person")); } }