private void RegisterAddGroupingToShooterDialog(ICollectionShooterDataStore collectionShooterDataStore) { _messenger.Register <AddGroupingToShooterDialogMessage>(this, x => { SelectGroupingViewModel vm = new SelectGroupingViewModel { Title = "Gruppe auswählen" }; vm.Initialize(x.ShooterId); IWindow w = _vs.ExecuteFunction <SelectGroupingViewModel, IWindow>((IWindow)Current.MainWindow, vm); bool?result = w.ShowDialog(); if (!result.HasValue || !result.Value) { return; } CollectionShooter cs = new CollectionShooter { ShooterId = x.ShooterId, ShooterCollectionId = vm.SelectedGrouping.ShooterCollectionId }; collectionShooterDataStore.Create(cs); _messenger.Send(new RefreshDataFromRepositoriesMessage()); }); }
private void RegisterRemoveGroupingFromShooterDialog(ICollectionShooterDataStore collectionShooterDataStore) { _messenger.Register <RemoveGroupingFromShooterDialogMessage>(this, x => { YesNoMessageBoxViewModel vm = new YesNoMessageBoxViewModel { DefaultYes = false, Caption = "Gruppierungszugehörigkeit löschen?", Message = string.Format("Möchtest du die Gruppierungszugehörigkeit '{0}' wirklich löschen?", x.Grouping.GroupingName) }; IWindow w = _vs.ExecuteFunction <YesNoMessageBoxViewModel, IWindow>((IWindow)Current.MainWindow, vm); bool?result = w.ShowDialog(); if (!result.HasValue || !result.Value) { return; } CollectionShooter cs = collectionShooterDataStore.FindById(x.Grouping.ShooterCollectionId); collectionShooterDataStore.Delete(cs); _messenger.Send(new RefreshDataFromRepositoriesMessage()); }); }
public void Update(CollectionShooter collectionShooter) { t_collectionshooter entity = _sqlRepository.Find(_ => _.CollectionShooterId == collectionShooter.CollectionShooterId).Single(); entity.UpdateEntity(collectionShooter); _sqlRepository.Commit(); }
public void Create(CollectionShooter shooter) { t_collectionshooter entity = new t_collectionshooter(); entity.UpdateEntity(shooter); _sqlRepository.Insert(entity); shooter.CollectionShooterId = entity.CollectionShooterId; }
private void ExecuteRemoveCommand(UiShooter obj) { IEnumerable <CollectionShooter> collectionShooters = _collectionShooterDataStore.FindByShooterCollectionId(SelectedUiShooterCollection.ShooterCollectionId); CollectionShooter collectionShooter = collectionShooters.FirstOrDefault(_ => _.ShooterId == obj.ShooterId); _collectionShooterDataStore.Delete(collectionShooter); LoadData(); }
private void ExecuteAssignShooterCommand(UiShooterCollection obj) { CollectionShooter collectionShooter = new CollectionShooter { ShooterId = UiShooter.ShooterId, ShooterCollectionId = UiShooterCollection.ShooterCollectionId }; _collectionShooterDataStore.Create(collectionShooter); _windowService.CloseEditShooterWindow(); }
private void ExecuteAssignCommand(UiShooter obj) { CollectionShooter collectionShooter = new CollectionShooter { ShooterCollectionId = SelectedUiShooterCollection.ShooterCollectionId, ShooterId = obj.ShooterId }; _collectionShooterDataStore.Create(collectionShooter); LoadData(); }
private void RemoveShooterFromGrouping() { if (SelectedShooterCollection != null && SelectedShooter != null) { int shooterCollectionId = SelectedShooterCollection.ShooterCollectionId; ICollectionShooterDataStore collectionShooterDataStore = ServiceLocator.Current.GetInstance <ICollectionShooterDataStore>(); CollectionShooter collectionShooter = collectionShooterDataStore.FindByShooterId(SelectedShooter.ShooterId) .SingleOrDefault(cs => cs.ShooterCollectionId == SelectedShooterCollection.ShooterCollectionId); collectionShooterDataStore.Delete(collectionShooter); MessengerInstance.Send(new RefreshDataFromRepositoriesMessage()); MessengerInstance.Send(new SetSelectedCollectionProgramNumber(ProgramNumber)); MessengerInstance.Send(new SetSelectedShooterCollectionMessage(shooterCollectionId)); } }
public void Delete(CollectionShooter collectionShooter) { t_collectionshooter entity = _sqlRepository.Find(_ => _.CollectionShooterId == collectionShooter.CollectionShooterId).Single(); _sqlRepository.Delete(entity); }
public static t_collectionshooter UpdateEntity(this t_collectionshooter entity, CollectionShooter shooter) { entity.ShooterId = shooter.ShooterId; entity.ShooterCollectionId = shooter.ShooterCollectionId; return(entity); }