/// <summary> /// Push clients /// </summary> public void PushClients() { Trace.TraceInformation("{0}: -- Starting PUSH of patients to CR --", this.m_context.JobId); List <Int32> unsyncedChildren = new List <int>(); // Get the last sync to be completed using (SyncData dao = new SyncData()) { // Last modified filter var lastSync = dao.GetLastSync(); DateTime?lastModifiedFilter = lastSync == null ? null : (DateTime?)lastSync.StartTime; foreach (var id in dao.GetUnsyncedChildrenId()) { this.m_waitThread.QueueUserWorkItem(this.PushPatientsAsync, id); } } // Wait for the worker threads to finish this.m_waitThread.WaitOne(); if (this.m_errorState) { throw new InvalidOperationException("Sync resulted in error state"); } }