public void Delete(SubSession sessionSubtotal) { t_sessionsubtotal entity = _sqlRepository.Find(_ => _.SessionSubtotalId == sessionSubtotal.SessionSubtotalId).Single(); _sqlRepository.Delete(entity); }
public static t_sessionsubtotal UpdateEntity(this t_sessionsubtotal entity, SubSession sessionSubtotal) { entity.SessionId = sessionSubtotal.SessionId; entity.BestShotId = sessionSubtotal.BestShotId; entity.SubtotalOrdinal = sessionSubtotal.Ordinal; return(entity); }
/// <summary>Stores the shot data to the repository and invokes module extension points.</summary> private void ShootingRangeOnShot(object sender, ShotEventArgs e) { if (_sessionsAwaitingProgramNumber.ContainsKey(e.LaneNumber)) { Session session = _sessionsAwaitingProgramNumber[e.LaneNumber]; _sessionsAwaitingProgramNumber.Remove(e.LaneNumber); _sessionsOngoing.Add(e.LaneNumber, session); session.ProgramNumber = e.ProgramNumber; _sessionDataStore.Create(session); SubSession subSession = session.CreateSubSession(); _sessionSubtotalDataStore.Create(subSession); AddShotToSubsession(e, subSession); } else if (_sessionsOngoing.ContainsKey(e.LaneNumber)) { Session session = _sessionsOngoing[e.LaneNumber]; SubSession subSession = session.CurrentSubsession(); if (subSession.SessionSubtotalId == 0) { _sessionSubtotalDataStore.Create(subSession); } AddShotToSubsession(e, subSession); } else { throw new InvalidOperationException("Session is not available."); } }
public void Update(SubSession sessionSubtotal) { t_sessionsubtotal entity = _sqlRepository.Find(_ => _.SessionSubtotalId == sessionSubtotal.SessionSubtotalId).Single(); entity.UpdateEntity(sessionSubtotal); _sqlRepository.Commit(); }
public void Create(SubSession sessionSubtotal) { t_sessionsubtotal entity = new t_sessionsubtotal(); entity.UpdateEntity(sessionSubtotal); _sqlRepository.Insert(entity); sessionSubtotal.SessionSubtotalId = entity.SessionSubtotalId; }
public void BasicTest() { InProcSubscriber inProc = new InProcSubscriber(); Publisher pub = new Publisher(inProc, 11000); Assert.AreEqual(0, pub.Topics.Count); Guid topicId1 = Guid.NewGuid(); string topicName1 = "EURUSD@TrueFx"; Guid topicId2 = Guid.NewGuid(); string topicName2 = "MSFT@YahooFinance"; Guid topicId3 = Guid.NewGuid(); string topicName3 = "USDJPY@OANDA-MT4"; pub.Topics.Add(topicId1, topicName1); pub.Topics.Add(topicId2, topicName2); pub.Topics.Add(topicId3, topicName3); Assert.AreEqual(3, pub.Topics.Count); pub.Start(); Assert.AreEqual(0, pub.Sessions.Count); Subscriber subs = new Subscriber(inProc); SubSession subSession = subs.BeginSession(); Dictionary <Guid, string> topics = subSession.GetTopics(); Assert.AreEqual(3, topics.Count); Assert.IsTrue(topics.ContainsKey(topicId1)); Assert.AreEqual(topics[topicId1], topicName1); Assert.IsTrue(topics.ContainsKey(topicId2)); Assert.AreEqual(topics[topicId2], topicName2); Assert.IsTrue(topics.ContainsKey(topicId3)); Assert.AreEqual(topics[topicId3], topicName3); subSession.Subscribe(topicId1, ReceiveNotification); Assert.AreEqual(1, pub.Sessions.Count); pub.Topics[topicId1].PushNotification(new byte[] { 1, 2, 3 }); wait.WaitOne(1000); Assert.AreEqual(3, lastMessage.Length); Assert.AreEqual(1, lastMessage[0]); Assert.AreEqual(2, lastMessage[1]); Assert.AreEqual(3, lastMessage[2]); }
/// <summary> /// Starts recording /// </summary> private static void StartRecording() { //register for the recording ended event, put the controller into record mode _currentSubSession = new SubSession(); VirtualMotionCaptureController.MotionCaptureDataRecord(true); VirtualMotionCaptureController.VirtualMotionCaptureSubSessionRecorded += new VirtualMotionCaptureController.VirtualMotionCaptureSubSessionRecordedEventHandler(VirtualMotionCaptureController_VirtualMotionCaptureSubSessionRecorded); _remoteDataManager.ServerPlayingStatus(false); Communication.OptitrackCommandParser_Server.VirtualMotionCaputrePlayback = false; _remoteDataManager.ServerRecordingStatus(true); }
private void ShootingRangeOnBestShot(object sender, ShotEventArgs e) { if (_sessionsOngoing.ContainsKey(e.LaneNumber)) { SubSession currentSubSession = _sessionsOngoing[e.LaneNumber].CurrentSubsession(); Shot shot = _shotDataStore.FindBySubSessionId(currentSubSession.SessionSubtotalId) .Single(_ => _.Ordinal == e.Ordinal); currentSubSession.BestShotId = shot.ShotId; _sessionSubtotalDataStore.Update(currentSubSession); } }
private void AddShotToSubsession(ShotEventArgs e, SubSession subSession) { Shot shot = new Shot { PrimaryScore = e.PrimaryScore, SecondaryScore = e.SecondaryScore, LaneNumber = e.LaneNumber, SubtotalId = subSession.SessionSubtotalId, Ordinal = e.Ordinal, }; _shotDataStore.Create(shot); }
/// <summary> /// Called everytime a sub session is recorded /// </summary> /// <param name="subSessionStartTime"></param> /// <param name="subSessionEndTime"></param> private static void VirtualMotionCaptureController_VirtualMotionCaptureSubSessionRecorded(DateTime subSessionStartTime, DateTime subSessionEndTime) { //Set the times _currentSubSession.SubSessionStartTime = subSessionStartTime; _currentSubSession.SubSessionEndTime = subSessionEndTime; _currentSession.MotionCaptureDataRecorded = true; //if the first, set the session start time if (_currentSession.SubSessions.Count == 0) { _currentSession.SessionStartTime = _currentSubSession.SubSessionStartTime; } //Add it to the session _currentSession.AddSubSession(_currentSubSession); _currentSession.SessionCompleted = true; _currentSession.ScheduledSession = false; _currentSubSession = new SubSession(); }
/// <summary> /// Gets ready to play back a session /// </summary> /// <param name="patientIndex"></param> /// <param name="sessionIndex"></param> /// <param name="subSessionIndex"></param> static void Patient_Remote_DataManager_OpenSessionForPlaybackRequestedByClient(int patientIndex, int sessionIndex, int subSessionIndex) { //use the indexes to load the correct subsession _currentSession = _patients[patientIndex].Sessions[sessionIndex]; _currentSubSessionIndex = subSessionIndex; _currentSubSession = _currentSession.SubSessions[_currentSubSessionIndex]; //Check the motion capture data is present on disk, if it is, open the subsession, else mark it as not pressent if (System.IO.File.Exists(VirtualMotionCaptureController.BuildSubSessionFileName(_currentSubSession.SubSessionStartTime))) { VirtualMotionCaptureController.OpenMotionCaptureSubSession(_currentSubSession.SubSessionStartTime); } else { //data isn't availiable _currentSession.MotionCaptureDataRecorded = false; _currentSession.SubSessions[_currentSubSessionIndex] = _currentSubSession; _patients[_patientIndex].Sessions[_currentSessionIndex] = _currentSession; Patient_Remote_DataManager_UpdatePatientRequestedByClient(_patients[_patientIndex], _patientIndex); } }
/// <summary> /// Fired when playback ends /// </summary> /// <param name="subSessionStartTime"></param> static void VirtualMotionCaptureController_VirtualMotionCaptureSubSessionPlaybackEnded(DateTime subSessionStartTime) { //If there are multiple subsessions and this wasn't the last, then move onto the next subsession //TODO moddify this to allow looping of subsessions and of the complete session if (_currentSubSessionIndex < _currentSession.SubSessions.Count - 1) { _currentSubSessionIndex++; _currentSubSession = _currentSession.SubSessions[_currentSubSessionIndex]; if (System.IO.File.Exists(VirtualMotionCaptureController.BuildSubSessionFileName(_currentSubSession.SubSessionStartTime))) { VirtualMotionCaptureController.OpenMotionCaptureSubSession(_currentSubSession.SubSessionStartTime); } else { StopPlayback(); } } else { StopPlayback(); } }