public void Update(ShooterParticipation shooterParticipation)
 {
   t_shooterparticipation entity =
     _sqlRepository.Find(_ => _.ShooterParticipationId == shooterParticipation.ShooterParticipationId).Single();
   entity.UpdateEntity(shooterParticipation);
   _sqlRepository.Commit();
 }
 public void Create(ShooterParticipation shooterParticipation)
 {
   t_shooterparticipation entity = new t_shooterparticipation();
   entity.UpdateEntity(shooterParticipation);
   _sqlRepository.Insert(entity);
   shooterParticipation.ShooterParticipationId = entity.ShooterParticipationId;
 }
 public static t_shooterparticipation UpdateEntity(this t_shooterparticipation entity,
   ShooterParticipation shooterParticipation)
 {
   entity.ShooterId = shooterParticipation.ShooterId;
   entity.ProgramNumber = shooterParticipation.ProgramNumber;
   return entity;
 }
 public void Delete(ShooterParticipation shooterParticipation)
 {
   t_shooterparticipation entity =
     _sqlRepository.Find(_ => _.ShooterParticipationId == shooterParticipation.ShooterParticipationId).Single();
   _sqlRepository.Delete(entity);
 }
    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();
      }
    }
Exemplo n.º 6
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());
                });
        }
    private void ExecuteAddToAssignedParticipationCommand(ParticipationListItem participation)
    {
      ShooterParticipation sp = new ShooterParticipation
      {
        ShooterId = UiShooter.ShooterId,
        ParticipationId = participation.ParticipationId
      };

      _shooterParticipationDataStore.Create(sp);
      LoadAvailableParticipationList();
      LoadAssignedParticipationList();
    }