Exemplo n.º 1
0
 public void SendRecords(IEnumerable <AbstractLisRecord> records)
 {
     try
     {
         if (records == null)
         {
             return;
         }
         if (!Connection.EstablishSendMode() && !Connection.EstablishSendMode())
         {
             fLog.Error("The LIS did not acknowledge the ENQ request.");
             throw new LISParserEstablishmentFailedException("The LIS did not acknowledge the ENQ request.");
         }
         fLog.Info("Send Mode Established");
         double recCount = 0.0;
         if (records is IList)
         {
             recCount = (records as IList).Count;
         }
         if (records != null)
         {
             int sendCounter = 0;
             IEnumerator <AbstractLisRecord> enumerator = records.GetEnumerator();
             if (enumerator != null)
             {
                 try
                 {
                     while (enumerator.MoveNext())
                     {
                         AbstractLisRecord rec = enumerator.Current;
                         Connection.SendMessage(rec.ToLISString());
                         if (@_OnSendProgress != null && recCount > 0.0)
                         {
                             @_OnSendProgress(this, new SendProgressEventArgs((double)sendCounter / recCount, @_ThreadGuid));
                         }
                         sendCounter++;
                     }
                 }
                 finally
                 {
                     enumerator.Dispose();
                 }
             }
         }
         Connection.StopSendMode();
     }
     catch (Exception ex)
     {
         fLog.Error(ex, "Exception in SendRecords");
         if (fOnExceptionHappened != null)
         {
             ThreadExceptionEventArgs ea = new ThreadExceptionEventArgs(ex);
             fOnExceptionHappened(this, ea);
         }
     }
 }
Exemplo n.º 2
0
 public ReceiveRecordEventArgs(AbstractLisRecord aReceivedRecord, LisRecordType aLisRecordType)
 {
     @_ReceivedRecord = aReceivedRecord;
     @_RecordType     = aLisRecordType;
 }