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); }); }
public DefaultConfiguration() { //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20140516_164043.log"); //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Documents\My Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20140516_164043.log"); //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20130914_132912.log"); //_shootingRange = new SiusApiProvider("http://192.168.1.4"); _shootingRange = new SiusDataSocketProvider("127.0.0.1", 4000); _events = new ShootingRangeEvents(); _uiEvents = new UIEvents(); ShootingRangeEntities entities = new ShootingRangeEntities(); _personRepository = new PersonDataStore(entities); _shooterRepository = new ShooterDataStore(entities); _participationDataStore = new ParticipationDataStore(entities); _sessionDataStore = new SessionDataStore(entities); _shotDataStore = new ShotDataStore(entities); _sessionDetailsView = new SessionDetailsView(entities); _shooterNumberConfigDataStore = new ShooterNumberConfigDataStore(entities); _shooterParticipationDataStore = new ShooterParticipationDataStore(entities); _sessionSubtotalDataStore = new SessionSubtotalDataStore(entities); _programItemDataStore = new ProgramItemDataStore(entities); _groupMemberDetailsView = new GroupMemberDetailsView(entities); _groupDetailsView = new GroupDetailsView(entities); _shooterParticipationView = new ShooterParticipationView(entities); _windowService = new WindowService(); _barcodePrintService = new PtouchBarcodePrinter(); _barcodeBuilderService = new Barcode2Of5InterleavedService(); _shooterNumberService = new ShooterNumberService(_shooterNumberConfigDataStore); _shooterCollectionParticipationDataStore = new ShooterCollectionParticipationDataStore(entities); _shooterCollectionDataStore = new ShooterCollectionDataStore(entities); _collectionShooterDataStore = new CollectionShooterDataStore(entities); _ssvShooterDataWriterService = new SsvFileWriter(@"C:\Sius\SiusData\SSVDaten\SSV_schuetzen.txt"); }
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); }); }
public void Initialize() { _personDataStore = ServiceLocator.Current.GetInstance <IPersonDataStore>(); _shooterDataStore = ServiceLocator.Current.GetInstance <IShooterDataStore>(); _sessionDataStore = ServiceLocator.Current.GetInstance <ISessionDataStore>(); _sessionSubtotalDataStore = ServiceLocator.Current.GetInstance <ISessionSubtotalDataStore>(); _shotDataStore = ServiceLocator.Current.GetInstance <IShotDataStore>(); _shooterParticipationDataStore = ServiceLocator.Current.GetInstance <IShooterParticipationDataStore>(); _sdk = ServiceLocator.Current.GetInstance <ServiceDeskConfiguration>(); }
public void Initialize() { _personDataStore = ServiceLocator.Current.GetInstance<IPersonDataStore>(); _shooterDataStore = ServiceLocator.Current.GetInstance<IShooterDataStore>(); _sessionDataStore = ServiceLocator.Current.GetInstance<ISessionDataStore>(); _sessionSubtotalDataStore = ServiceLocator.Current.GetInstance<ISessionSubtotalDataStore>(); _shotDataStore = ServiceLocator.Current.GetInstance<IShotDataStore>(); _shooterParticipationDataStore = ServiceLocator.Current.GetInstance<IShooterParticipationDataStore>(); _sdk = ServiceLocator.Current.GetInstance<ServiceDeskConfiguration>(); }
public ShootingRangeEngine(IContainer container) { _sessionsAwaitingProgramNumber = new Dictionary<int, Session>(); _sessionsOngoing = new Dictionary<int, Session>(); _shootingRange = container.Resolve<IShootingRange>(); _shootingRange.Log += ShootingRangeOnLog; _sessionDataStore = container.Resolve<ISessionDataStore>(); _sessionSubtotalDataStore = container.Resolve<ISessionSubtotalDataStore>(); _shotDataStore = container.Resolve<IShotDataStore>(); _shooterDataStore = container.Resolve<IShooterDataStore>(); _personDataStore = container.Resolve<IPersonDataStore>(); }
public ShootingRangeEngine(IContainer container) { _sessionsAwaitingProgramNumber = new Dictionary <int, Session>(); _sessionsOngoing = new Dictionary <int, Session>(); _shootingRange = container.Resolve <IShootingRange>(); _shootingRange.Log += ShootingRangeOnLog; _sessionDataStore = container.Resolve <ISessionDataStore>(); _sessionSubtotalDataStore = container.Resolve <ISessionSubtotalDataStore>(); _shotDataStore = container.Resolve <IShotDataStore>(); _shooterDataStore = container.Resolve <IShooterDataStore>(); _personDataStore = container.Resolve <IPersonDataStore>(); }
private IEnumerable <Tuple <Person, int, decimal, decimal> > GetBestResults(int programNumber) { IShooterDataStore shooterDataStore = ServiceLocator.Current.GetInstance <IShooterDataStore>(); IShooterParticipationDataStore shooterParticipationDataStore = ServiceLocator.Current.GetInstance <IShooterParticipationDataStore>(); ISessionDataStore sessionDataStore = ServiceLocator.Current.GetInstance <ISessionDataStore>(); ISessionSubtotalDataStore sessionSubtotalDataStore = ServiceLocator.Current.GetInstance <ISessionSubtotalDataStore>(); IShotDataStore shotDataStore = ServiceLocator.Current.GetInstance <IShotDataStore>(); IPersonDataStore personDataStore = ServiceLocator.Current.GetInstance <IPersonDataStore>(); List <Shooter> shooters = (from s in shooterDataStore.GetAll() join sp in shooterParticipationDataStore.GetAll() on s.ShooterId equals sp.ShooterId where sp.ProgramNumber == programNumber select s).ToList(); // Person, ShooterId, TotalScore, DeepShot List <Tuple <Person, int, decimal, decimal> > result = new List <Tuple <Person, int, decimal, decimal> >(); foreach (Shooter shooter in shooters) { // Get the relevant sessions var lShooter = shooter; IEnumerable <Session> sessions = from s in sessionDataStore.GetAll() where s.ShooterId == lShooter.ShooterId && s.ProgramNumber == programNumber select s; // Get the results to the sessions var maxScoreGrouping = from session in sessions join subTotal in sessionSubtotalDataStore.GetAll() on session.SessionId equals subTotal.SessionId join shot in shotDataStore.GetAll() on subTotal.SessionSubtotalId equals shot.SubtotalId group shot by session into grouping select new { Session = grouping.Key, TotalScore = grouping.Sum(x => x.PrimaryScore) }; // Get the max scores of each session var bestGrouping = maxScoreGrouping.OrderByDescending(x => x.TotalScore).FirstOrDefault(); if (bestGrouping != null) { // select the max score as the result which shall go into ranking decimal maxScore = bestGrouping.TotalScore; decimal?deepShot = (from subTotal in sessionSubtotalDataStore.GetAll() join shot in shotDataStore.GetAll() on subTotal.SessionSubtotalId equals shot.SubtotalId where subTotal.SessionId == bestGrouping.Session.SessionId orderby shot.SecondaryScore descending select shot.SecondaryScore).FirstOrDefault(); if (lShooter.PersonId.HasValue) { Person person = personDataStore.FindById(lShooter.PersonId.Value); result.Add(new Tuple <Person, int, decimal, decimal>(person, shooter.ShooterId, maxScore, deepShot ?? 0)); } } } return(result); }