Пример #1
0
        private void RegisterAddParticipationToShooterDialog(IShooterParticipationDataStore shooterParticipationDataStore)
        {
            _messenger.Register <AddParticipationToShooterDialogMessage>(this,
                                                                         x =>
            {
                SelectParticipationViewModel vm = new SelectParticipationViewModel
                {
                    Title = "Wettkampf auswählen"
                };

                vm.Initialize(x.ShooterId);

                IWindow w   = _vs.ExecuteFunction <SelectParticipationViewModel, IWindow>((IWindow)Current.MainWindow, vm);
                bool?result = w.ShowDialog();

                if (!result.HasValue || !result.Value)
                {
                    return;
                }

                ShooterParticipation sp = new ShooterParticipation
                {
                    ProgramNumber = int.Parse(vm.SelectedParticipationDescription.ProgramNumber),
                    ShooterId     = x.ShooterId
                };

                shooterParticipationDataStore.Create(sp);

                _messenger.Send(new RefreshDataFromRepositoriesMessage());
            });
        }
Пример #2
0
        private void ExecuteAddToAssignedParticipationCommand(ParticipationListItem participation)
        {
            ShooterParticipation sp = new ShooterParticipation
            {
                ShooterId       = UiShooter.ShooterId,
                ParticipationId = participation.ParticipationId
            };

            _shooterParticipationDataStore.Create(sp);
            LoadAvailableParticipationList();
            LoadAssignedParticipationList();
        }
        private void ExecuteAddToAssignedParticipationCommand(ParticipationListItem participation)
        {
            ShooterParticipation sp = new ShooterParticipation
            {
                ShooterId       = UiShooter.ShooterId,
                ParticipationId = participation.ParticipationId
            };

            try
            {
                _shooterParticipationDataStore.Create(sp);
            }
            catch (Exception e)
            {
                _shooterParticipationDataStore.Revert();
                ReportException(e);
            }
            finally
            {
                LoadData();
            }
        }
Пример #4
0
        private void RegisterAddParticipationToShooterDialog(IShooterParticipationDataStore shooterParticipationDataStore)
        {
            _messenger.Register<AddParticipationToShooterDialogMessage>(this,
                x =>
                {
                    SelectParticipationViewModel vm = new SelectParticipationViewModel
                    {
                        Title = "Wettkampf auswählen"
                    };

                    vm.Initialize(x.ShooterId);

                    IWindow w = _vs.ExecuteFunction<SelectParticipationViewModel, IWindow>((IWindow) Current.MainWindow, vm);
                    bool? result = w.ShowDialog();

                    if (!result.HasValue || !result.Value) return;

                    ShooterParticipation sp = new ShooterParticipation
                    {
                        ProgramNumber = int.Parse(vm.SelectedParticipationDescription.ProgramNumber),
                        ShooterId = x.ShooterId
                    };

                    shooterParticipationDataStore.Create(sp);

                    _messenger.Send(new RefreshDataFromRepositoriesMessage());
                });
        }