コード例 #1
0
 public void Create(Shooter shooter)
 {
   t_shooter entity = new t_shooter();
   entity.UpdateEntity(shooter);
   _sqlRepository.Insert(entity);
   shooter.ShooterId = entity.ShooterId;
 }
コード例 #2
0
        public void Initialize(Shooter shooter)
        {
            _shooterParticipationDataStore = ServiceLocator.Current.GetInstance<IShooterParticipationDataStore>();
            _collectionShooterDataStore = ServiceLocator.Current.GetInstance<ICollectionShooterDataStore>();
            _shooterCollectionDataStore = ServiceLocator.Current.GetInstance<IShooterCollectionDataStore>();
            _sessionDataStore = ServiceLocator.Current.GetInstance<ISessionDataStore>();
            _sessionSubtotalDataStore = ServiceLocator.Current.GetInstance<ISessionSubtotalDataStore>();
            _shotDataStore = ServiceLocator.Current.GetInstance<IShotDataStore>();
            _sdk = ServiceLocator.Current.GetInstance<ServiceDeskConfiguration>();

            SelectedGrouping = null;
            SelectedParticipation = null;
            Shooter = shooter;
            Participations = new ObservableCollection<ParticipationViewModel>(FetchParticipationsByShooter(Shooter));
            Groupings = new ObservableCollection<GroupingViewModel>(FetchGroupsByShooter(Shooter));
            SelectedPersonChanged(shooter.ShooterId);

            MessengerInstance.Register<RefreshDataFromRepositoriesMessage>(this,
    x =>
    {
        Groupings = new ObservableCollection<GroupingViewModel>(FetchGroupsByShooter(Shooter));
        Participations = new ObservableCollection<ParticipationViewModel>(FetchParticipationsByShooter(Shooter));
        SelectedPersonChanged(Shooter.ShooterId);
    });
        }
コード例 #3
0
 public PersonShooterViewModel(Person person, Shooter shooter)
 {
     PersonId = person.PersonId;
     ShooterId = shooter.ShooterId;
     FirstName = person.FirstName;
     LastName = person.LastName;
     ShooterNumber = shooter.ShooterNumber;
     DateOfBirth = person.DateOfBirth;
 }
コード例 #4
0
 public UiCollectionShooter(Person person, Shooter shooter, int score)
 {
     PersonId = person.PersonId;
     ShooterId = shooter.ShooterId;
     FirstName = person.FirstName;
     LastName = person.LastName;
     ShooterNumber = shooter.ShooterNumber;
     DateOfBirth = person.DateOfBirth;
     CollectionShooterScore = score;
 }
コード例 #5
0
 public void Delete(Shooter shooter)
 {
   _repository.Delete(shooter);
 }
コード例 #6
0
 public void Update(Shooter shooter)
 {
   Shooter entity = FindById(shooter.ShooterId);
   entity.ShooterNumber = shooter.ShooterNumber;
   _repository.Commit();
 }
コード例 #7
0
 public void Create(Shooter shooter)
 {
   _repository.Insert(shooter);
 }
コード例 #8
0
 private Shooter CreateUnknownShooter(int shooterNumber)
 {
     Person person = new Person()
     {
         FirstName = "unknown",
         LastName = "unknown"
     };
     _personDataStore.Create(person);
     Shooter shooter = new Shooter();
     shooter.PersonId = person.PersonId;
     shooter.ShooterNumber = shooterNumber;
     _shooterDataStore.Create(shooter);
     return shooter;
 }
コード例 #9
0
 public void Delete(Shooter shooter)
 {
   t_shooter entity = _sqlRepository.Find(_ => _.ShooterId == shooter.ShooterId).Single();
   _sqlRepository.Delete(entity);
 }
コード例 #10
0
 public void Update(Shooter shooter)
 {
   t_shooter entity = _sqlRepository.Find(_ => _.ShooterId == shooter.ShooterId).Single();
   entity.UpdateEntity(shooter);
   _sqlRepository.Commit();
 }
コード例 #11
0
 public static t_shooter UpdateEntity(this t_shooter entity, Shooter shooter)
 {
   entity.ShooterNumber = shooter.ShooterNumber;
   entity.PersonId = shooter.PersonId;
   return entity;
 }
コード例 #12
0
        private IEnumerable<ParticipationViewModel> FetchParticipationsByShooter(Shooter shooter)
        {
            ServiceDeskConfiguration sdk = ServiceLocator.Current.GetInstance<ServiceDeskConfiguration>();
            ParticipationDescriptionCollection participations = sdk.ParticipationDescriptions;

            return from shooterParticipation in _shooterParticipationDataStore.FindByShooterId(shooter.ShooterId)
                join participation in participations.GetAll() on shooterParticipation.ProgramNumber.ToString() equals
                    participation.ProgramNumber
                orderby participation.ProgramNumber
                select new ParticipationViewModel
                {
                    ProgramName = participation.ProgramName,
                    ProgramNumber = shooterParticipation.ProgramNumber
                };
        }
コード例 #13
0
        private IEnumerable<GroupingViewModel> FetchGroupsByShooter(Shooter shooter)
        {
            ServiceDeskConfiguration sdk = ServiceLocator.Current.GetInstance<ServiceDeskConfiguration>();
            ParticipationDescriptionCollection participations = sdk.ParticipationDescriptions;

            return from collectionShooter in _collectionShooterDataStore.FindByShooterId(shooter.ShooterId)
                join shooterCollection in _shooterCollectionDataStore.GetAll() on collectionShooter.ShooterCollectionId equals shooterCollection.ShooterCollectionId
                   join participation in participations.GetAll() on shooterCollection.ProgramNumber.ToString()
                    equals
                    participation.ProgramNumber
                orderby shooterCollection.CollectionName
                select new GroupingViewModel
                {
                    ShooterCollectionId = collectionShooter.CollectionShooterId,
                    GroupingName = shooterCollection.CollectionName,
                    ParticipationName = participation.ProgramName
                };
        }
コード例 #14
0
        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));
            }
        }
コード例 #15
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);
      //}
    }