private void LoadParticipations()
 {
     UiParticipations =
         new ObservableCollection <UiParticipation>(
             _participationDataStore.GetAll()
             .Where(_ => _.AllowCollectionParticipation)
             .Select(UiBusinessObjectMapper.ToUiParticipation)
             .Select(
                 _ =>
                 _.FetchShooters(_shooterCollectionParticipationDataStore,
                                 _shooterCollectionDataStore,
                                 _collectionShooterDataStore,
                                 _shooterDataStore,
                                 _personDataStore)));
 }
        private void LoadAvailableParticipationList()
        {
            Func <Participation, ParticipationListItem> selector = participation => new ParticipationListItem()
            {
                ParticipationId   = participation.ParticipationId,
                ParticipationName = participation.ParticipationName,
                GroupListItems    = new List <GroupListItem>()
                {
                }
            };

            AvailableParticipations =
                new ObservableCollection <ParticipationListItem>(
                    _participationDataStore.GetAll()
                    .Where(_ => AssignedParticipations.All(a => a.ParticipationName != _.ParticipationName))
                    .Select(selector));
        }
示例#3
0
        private void ExecutePrintBarcodeCommand(UiShooter uiShooter)
        {
            try
            {
                bool isNachwuchs = (from sp in _shooterParticipationDataStore.GetAll()
                                    join p in _participationDataStore.GetAll() on sp.ParticipationId equals p.ParticipationId
                                    where p.ParticipationName == "Nachwuchsstich" && sp.ShooterId == uiShooter.ShooterId
                                    select p.ParticipationId).
                                   Any();

                bool isGruppe = (from sp in _shooterParticipationDataStore.GetAll()
                                 join p in _participationDataStore.GetAll() on sp.ParticipationId equals p.ParticipationId
                                 where p.ParticipationName == "Gruppenstich" && sp.ShooterId == uiShooter.ShooterId
                                 select p.ParticipationId).
                                Any();

                bool isSieUndEr = (from sp in _shooterParticipationDataStore.GetAll()
                                   join p in _participationDataStore.GetAll() on sp.ParticipationId equals p.ParticipationId
                                   where p.ParticipationName == "Sie & Er" && sp.ShooterId == uiShooter.ShooterId
                                   select p.ParticipationId).
                                  Any();

                bool isWorschtUndBrot = (from sp in _shooterParticipationDataStore.GetAll()
                                         join p in _participationDataStore.GetAll() on sp.ParticipationId equals p.ParticipationId
                                         where p.ParticipationName == "Worscht & Brot" && sp.ShooterId == uiShooter.ShooterId
                                         select p.ParticipationId).
                                        Any();

                string groupName = (from cs in _collectionShooterDataStore.GetAll()
                                    join sc in _shooterCollectionDataStore.GetAll() on cs.ShooterCollectionId equals sc.ShooterCollectionId
                                    join scp in _shooterCollectionParticipationDataStore.GetAll() on cs.ShooterCollectionId equals
                                    scp.ShooterCollectionId
                                    join p in _participationDataStore.GetAll() on scp.ParticipationId equals p.ParticipationId
                                    where p.ParticipationName == "Gruppenstich" && cs.ShooterId == uiShooter.ShooterId
                                    select sc.CollectionName).SingleOrDefault();

                string sieUndErName = (from cs in _collectionShooterDataStore.GetAll()
                                       join sc in _shooterCollectionDataStore.GetAll() on cs.ShooterCollectionId equals sc.ShooterCollectionId
                                       join scp in _shooterCollectionParticipationDataStore.GetAll() on cs.ShooterCollectionId equals
                                       scp.ShooterCollectionId
                                       join p in _participationDataStore.GetAll() on scp.ParticipationId equals p.ParticipationId
                                       where p.ParticipationName == "Sie & Er" && cs.ShooterId == uiShooter.ShooterId
                                       select sc.CollectionName).SingleOrDefault();

                Person person = uiShooter.PersonId == null
          ? new Person()
                {
                    FirstName = "unknown", LastName = "unknown"
                }
          : _personDataStore.FindById((int)uiShooter.PersonId);
                BarcodeHerbstschiessen barcodeInfo = new BarcodeHerbstschiessen
                {
                    FirstName        = person.FirstName,
                    LastName         = person.LastName,
                    DateOfBirth      = person.DateOfBirth,
                    Gruppenstich     = groupName ?? string.Empty,
                    SieUndEr         = sieUndErName ?? string.Empty,
                    Barcode          = _barcodeBuilderService.BuildBarcode(uiShooter.ShooterNumber, uiShooter.Legalization),
                    IsGruppenstich   = isGruppe,
                    IsNachwuchsstich = isNachwuchs,
                    IsWorschtUndBrot = isWorschtUndBrot,
                    IsSieUndEr       = isSieUndEr
                };

                _barcodePrintService.Print(barcodeInfo);
            }
            catch (Exception e)
            {
                ReportException(e);
            }
        }
示例#4
0
        private void LoadAvailableParticipationList()
        {
            Func <Participation, ParticipationListItem> selector = participation => new ParticipationListItem()
            {
                ParticipationId   = participation.ParticipationId,
                ParticipationName = participation.ParticipationName
            };

            AvailableParticipations = new ObservableCollection <ParticipationListItem>(_participationDataStore.GetAll().Select(selector));
        }