Example #1
0
        private void RegisterRemoveParticipationFromShooterDialog(IShooterParticipationDataStore shooterParticipationDataStore)
        {
            _messenger.Register <RemoveParticipationFromShooterDialogMessage>(this,
                                                                              x =>
            {
                YesNoMessageBoxViewModel vm = new YesNoMessageBoxViewModel
                {
                    Caption    = "Wettkampf löschen",
                    DefaultYes = false,
                    Message    =
                        string.Format("Wettkampfzuordnung '{0}' wirklich löschen?", x.Participation.ProgramName)
                };

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

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

                ShooterParticipation shooterParticipation =
                    shooterParticipationDataStore.FindByShooterId(x.ShooterId)
                    .SingleOrDefault(sp => sp.ProgramNumber == x.Participation.ProgramNumber);
                shooterParticipationDataStore.Delete(shooterParticipation);

                _messenger.Send(new RefreshDataFromRepositoriesMessage());
            });
        }
 private void ExecuteRemoveFromAssignedParticipationCommand(ShooterParticipationListItem shooterParticipation)
 {
     try
     {
         ShooterParticipation participation = _shooterParticipationDataStore.FindById(shooterParticipation.ShooterParticipationId);
         _shooterParticipationDataStore.Delete(participation);
     }
     catch (Exception e)
     {
         _shooterParticipationDataStore.Revert();
         ReportException(e);
     }
     finally
     {
         LoadData();
     }
 }
Example #3
0
        private void RegisterRemoveParticipationFromShooterDialog(IShooterParticipationDataStore shooterParticipationDataStore)
        {
            _messenger.Register<RemoveParticipationFromShooterDialogMessage>(this,
                x =>
                {
                    YesNoMessageBoxViewModel vm = new YesNoMessageBoxViewModel
                    {
                        Caption = "Wettkampf löschen",
                        DefaultYes = false,
                        Message =
                            string.Format("Wettkampfzuordnung '{0}' wirklich löschen?", x.Participation.ProgramName)
                    };

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

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

                    ShooterParticipation shooterParticipation =
                        shooterParticipationDataStore.FindByShooterId(x.ShooterId)
                            .SingleOrDefault(sp => sp.ProgramNumber == x.Participation.ProgramNumber);
                    shooterParticipationDataStore.Delete(shooterParticipation);

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