private void CreateShooter(UiPerson person)
        {
            if (person != null)
            {
                int     shooterNumber = _shooterNumberService.GetShooterNumber();
                Shooter shooter       = new Shooter
                {
                    PersonId      = person.PersonId,
                    ShooterNumber = shooterNumber
                };

                _shooterDataWriter.WriteShooterData(new SsvShooterData
                {
                    FirstName     = person.FirstName,
                    LastName      = person.LastName,
                    LicenseNumber = (uint)shooter.ShooterNumber
                });

                _shooterDataStore.Create(shooter);

                MessengerInstance.Send(new RefreshDataFromRepositoriesMessage());
                MessengerInstance.Send(new SetSelectedPersonMessage(person.PersonId));
                MessengerInstance.Send(new SetSelectedShooterMessage(shooter.ShooterId));
            }
        }
Пример #2
0
        private void ExecuteCreateShooterCommand(UiPerson uiPerson)
        {
            try
            {
                Shooter shooter = new Shooter();
                shooter.ShooterNumber = _shooterNumberService.GetShooterNumber();
                shooter.PersonId      = uiPerson.PersonId;
                _shooterDataStore.Create(shooter);
                _shooterDataWriterService.WriteShooterData(new SsvShooterData
                {
                    FirstName     = uiPerson.FirstName,
                    LastName      = uiPerson.LastName,
                    LicenseNumber = (uint)shooter.ShooterNumber
                });
                _windowService.ShowMessage("Schütze erstellt", string.Format("Schütze mit Schützennummer '{0}' erfolgreich erstellt.", shooter.ShooterNumber));
            }
            catch (Exception e)
            {
                ReportException(e);
                _shooterDataStore.Revert();
            }
            finally
            {
                _uiEvents.ShooterDataStoreChanged();
            }

            //try
            //{
            //  _windowService.ShowCreateShooterWindow();
            //}
            //catch (Exception e)
            //{
            //  ReportException(e);
            //}
        }