Esempio n. 1
0
        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"));
        }
Esempio n. 2
0
        private void OnSelectedDetailedPersonChanged()
        {
            Notify("HasChanges");

            SaveCommand.RaiseCanExecuteChanged();
            DeleteCommand.RaiseCanExecuteChanged();
            RevertCommand.RaiseCanExecuteChanged();

            SelectedDetailedPerson?.CheckDocuments();
        }
Esempio n. 3
0
        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"));
                }
            }
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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"));
            }
        }