private void RegisterDeleteGroupingDialog(IShooterCollectionDataStore shooterCollectionDataStore) { _messenger.Register <DeleteGroupingDialogMessage>(this, x => { YesNoMessageBoxViewModel vm = new YesNoMessageBoxViewModel { Caption = "Gruppierung löschen", Message = string.Format("Wollen Sie die Gruppierung '{0}' wirklich löschen?", x.CollectionName) }; IWindow w = _vs.ExecuteFunction <YesNoMessageBoxViewModel, IWindow>((IWindow)Current.MainWindow, vm); bool?result = w.ShowDialog(); if (!result.HasValue || !result.Value) { return; } ShooterCollection sc = shooterCollectionDataStore.FindById(x.ShooterCollectionId); shooterCollectionDataStore.Delete(sc); _messenger.Send(new RefreshDataFromRepositoriesMessage()); }); }
private void RegisterEditGroupingDialog(IShooterCollectionDataStore shooterCollectionDataStore) { _messenger.Register <EditGroupingDialogMessage>(this, x => { var m = new EditGroupingViewModel { GroupingName = x.GroupingName, GroupingId = x.GroupingId, Title = "Gruppenname ändern" }; IWindow w = _vs.ExecuteFunction <EditGroupingViewModel, IWindow>((IWindow)Current.MainWindow, m); bool?result = w.ShowDialog(); if (!result.HasValue || !result.Value) { return; } ShooterCollection sc = shooterCollectionDataStore.FindById(m.GroupingId); sc.CollectionName = m.GroupingName; shooterCollectionDataStore.Update(sc); _messenger.Send(new RefreshDataFromRepositoriesMessage()); }); }
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 RegisterDeleteGroupingDialog(IShooterCollectionDataStore shooterCollectionDataStore) { _messenger.Register<DeleteGroupingDialogMessage>(this, x => { YesNoMessageBoxViewModel vm = new YesNoMessageBoxViewModel { Caption = "Gruppierung löschen", Message = string.Format("Wollen Sie die Gruppierung '{0}' wirklich löschen?", x.CollectionName) }; IWindow w = _vs.ExecuteFunction<YesNoMessageBoxViewModel, IWindow>((IWindow) Current.MainWindow, vm); bool? result = w.ShowDialog(); if (!result.HasValue || !result.Value) return; ShooterCollection sc = shooterCollectionDataStore.FindById(x.ShooterCollectionId); shooterCollectionDataStore.Delete(sc); _messenger.Send(new RefreshDataFromRepositoriesMessage()); }); }
private void RegisterEditGroupingDialog(IShooterCollectionDataStore shooterCollectionDataStore) { _messenger.Register<EditGroupingDialogMessage>(this, x => { var m = new EditGroupingViewModel { GroupingName = x.GroupingName, GroupingId = x.GroupingId, Title = "Gruppenname ändern" }; IWindow w = _vs.ExecuteFunction<EditGroupingViewModel, IWindow>((IWindow) Current.MainWindow, m); bool? result = w.ShowDialog(); if (!result.HasValue || !result.Value) return; ShooterCollection sc = shooterCollectionDataStore.FindById(m.GroupingId); sc.CollectionName = m.GroupingName; shooterCollectionDataStore.Update(sc); _messenger.Send(new RefreshDataFromRepositoriesMessage()); }); }
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; }