public static UiParticipation FetchShooters(this UiParticipation participation, IShooterCollectionParticipationDataStore shooterCollectionParticipationDataStore, IShooterCollectionDataStore shooterCollectionDataStore, ICollectionShooterDataStore collectionShooterDataStore, IShooterDataStore shooterDataStore, IPersonDataStore personDataStore) { participation.ShooterCollections = new List <UiShooterCollection>(); List <ShooterCollectionParticipation> shooterCollectionParticipations = shooterCollectionParticipationDataStore.FindByIdParticipationId(participation.ParticipationId).ToList(); List <ShooterCollection> shooterCollections = shooterCollectionParticipations.Select(_ => shooterCollectionDataStore.FindById(_.ShooterCollectionId)).ToList(); foreach (ShooterCollection shooterCollection in shooterCollections) { List <CollectionShooter> collectionShooters = collectionShooterDataStore.FindByShooterCollectionId(shooterCollection.ShooterCollectionId).ToList(); participation.ShooterCollections.Add(new UiShooterCollection { CollectionName = shooterCollection.CollectionName, ShooterCollectionId = shooterCollection.ShooterCollectionId, Shooters = collectionShooters.Select(_ => ToUiShooter(shooterDataStore.FindById(_.ShooterId)).FetchPerson(personDataStore)) }); } return(participation); }
private void ExecuteAddCommand(string obj) { ShooterCollection sc = new ShooterCollection { CollectionName = obj }; _shooterCollectionDataStore.Create(sc); UiEventsDelegate <UiParticipation> handler = _uiEvents.FetchSelectedParticipation; if (handler != null) { UiParticipation p = handler(); if (p != null) { ShooterCollectionParticipation scp = new ShooterCollectionParticipation { ParticipationId = p.ParticipationId, ShooterCollectionId = sc.ShooterCollectionId }; _shooterCollectionParticipationDataStore.Create(scp); } } _windowService.CloseTextBoxInputDialog(); }
private bool CanExecuteShooterCollectionParticipation(UiParticipation obj) { return(obj != null); }
private void ExecuteCreateShooterCollectionParticipation(UiParticipation obj) { _windowService.ShowTextBoxInputDialog(string.Format("'{0}' Gruppe erstellen", obj.ParticipationName), "Gruppenname eingeben"); LoadData(); }